ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
e57::SourceDestBufferImpl Class Reference

#include <SourceDestBufferImpl.h>

Inheritance diagram for e57::SourceDestBufferImpl:
Collaboration diagram for e57::SourceDestBufferImpl:

Public Member Functions

 SourceDestBufferImpl (ImageFileImplWeakPtr destImageFile, const ustring &pathName, const size_t capacity, bool doConversion=false, bool doScaling=false)
 
template<typename T >
void setTypeInfo (T *base, size_t stride=sizeof(T))
 
 SourceDestBufferImpl (ImageFileImplWeakPtr destImageFile, const ustring &pathName, StringList *b)
 
ImageFileImplWeakPtr destImageFile () const
 
ustring pathName () const
 
MemoryRepresentation memoryRepresentation () const
 
void * base () const
 
StringListustrings () const
 
bool doConversion () const
 
bool doScaling () const
 
size_t stride () const
 
size_t capacity () const
 
unsigned nextIndex () const
 
void rewind ()
 
int64_t getNextInt64 ()
 
int64_t getNextInt64 (double scale, double offset)
 
float getNextFloat ()
 
double getNextDouble ()
 
ustring getNextString ()
 
void setNextInt64 (int64_t value)
 
void setNextInt64 (int64_t value, double scale, double offset)
 
void setNextFloat (float value)
 
void setNextDouble (double value)
 
void setNextString (const ustring &value)
 
void checkCompatible (const std::shared_ptr< SourceDestBufferImpl > &newBuf) const
 
void dump (int indent=0, std::ostream &os=std::cout)
 

Detailed Description

Definition at line 36 of file SourceDestBufferImpl.h.

Constructor & Destructor Documentation

◆ SourceDestBufferImpl() [1/2]

SourceDestBufferImpl::SourceDestBufferImpl ( ImageFileImplWeakPtr  destImageFile,
const ustring pathName,
const size_t  capacity,
bool  doConversion = false,
bool  doScaling = false 
)

Definition at line 35 of file SourceDestBufferImpl.cpp.

◆ SourceDestBufferImpl() [2/2]

SourceDestBufferImpl::SourceDestBufferImpl ( ImageFileImplWeakPtr  destImageFile,
const ustring pathName,
StringList b 
)

don't checkImageFileOpen, checkState_ will do it

Set capacity_ after testing that b is OK

Note that capacity_ is set to the size() of the vector<>, not its capacity(). The size() of *ustrings_ will not be changed as strings are stored in it.

Definition at line 107 of file SourceDestBufferImpl.cpp.

References e57::E57_ERROR_BAD_BUFFER, E57_EXCEPTION2, and pathName().

Member Function Documentation

◆ base()

void* e57::SourceDestBufferImpl::base ( ) const
inline

Definition at line 59 of file SourceDestBufferImpl.h.

Referenced by setTypeInfo().

◆ capacity()

size_t e57::SourceDestBufferImpl::capacity ( ) const
inline

Definition at line 79 of file SourceDestBufferImpl.h.

◆ checkCompatible()

void SourceDestBufferImpl::checkCompatible ( const std::shared_ptr< SourceDestBufferImpl > &  newBuf) const

◆ destImageFile()

ImageFileImplWeakPtr e57::SourceDestBufferImpl::destImageFile ( ) const
inline

Definition at line 46 of file SourceDestBufferImpl.h.

◆ doConversion()

bool e57::SourceDestBufferImpl::doConversion ( ) const
inline

Definition at line 67 of file SourceDestBufferImpl.h.

◆ doScaling()

bool e57::SourceDestBufferImpl::doScaling ( ) const
inline

Definition at line 71 of file SourceDestBufferImpl.h.

◆ dump()

void SourceDestBufferImpl::dump ( int  indent = 0,
std::ostream &  os = std::cout 
)

◆ getNextDouble()

double SourceDestBufferImpl::getNextDouble ( )

don't checkImageFileOpen

Verify index is within bounds

Fetch value from source buffer. Convert from other formats to floating point if requested

Convert bool to 0/1, all non-zero values map to 1.0

Definition at line 602 of file SourceDestBufferImpl.cpp.

References e57::E57_BOOL, e57::E57_ERROR_CONVERSION_REQUIRED, e57::E57_ERROR_EXPECTING_NUMERIC, e57::E57_ERROR_INTERNAL, E57_EXCEPTION2, e57::E57_INT16, e57::E57_INT32, e57::E57_INT64, e57::E57_INT8, e57::E57_REAL32, e57::E57_REAL64, e57::E57_UINT16, e57::E57_UINT32, e57::E57_UINT8, and e57::E57_USTRING.

◆ getNextFloat()

float SourceDestBufferImpl::getNextFloat ( )

don't checkImageFileOpen

Verify index is within bounds

Fetch value from source buffer. Convert from other formats to floating point if requested

Convert bool to 0/1, all non-zero values map to 1.0

Check that exponent of user's value is not too large for single precision number in file.

??? silently limit here?

Definition at line 502 of file SourceDestBufferImpl.cpp.

References e57::E57_BOOL, e57::E57_ERROR_CONVERSION_REQUIRED, e57::E57_ERROR_EXPECTING_NUMERIC, e57::E57_ERROR_INTERNAL, e57::E57_ERROR_REAL64_TOO_LARGE, E57_EXCEPTION2, e57::E57_INT16, e57::E57_INT32, e57::E57_INT64, e57::E57_INT8, e57::E57_REAL32, e57::E57_REAL64, e57::E57_UINT16, e57::E57_UINT32, e57::E57_UINT8, e57::E57_USTRING, and e57::toString().

◆ getNextInt64() [1/2]

int64_t SourceDestBufferImpl::getNextInt64 ( )

don't checkImageFileOpen

Verify index is within bounds

Fetch value from source buffer. Convert from non-integer formats if requested.

Convert bool to 0/1, all non-zero values map to 1.0

Definition at line 313 of file SourceDestBufferImpl.cpp.

References e57::E57_BOOL, e57::E57_ERROR_CONVERSION_REQUIRED, e57::E57_ERROR_EXPECTING_NUMERIC, e57::E57_ERROR_INTERNAL, E57_EXCEPTION2, e57::E57_INT16, e57::E57_INT32, e57::E57_INT64, e57::E57_INT8, e57::E57_REAL32, e57::E57_REAL64, e57::E57_UINT16, e57::E57_UINT32, e57::E57_UINT8, and e57::E57_USTRING.

Referenced by getNextInt64().

◆ getNextInt64() [2/2]

int64_t SourceDestBufferImpl::getNextInt64 ( double  scale,
double  offset 
)

don't checkImageFileOpen

Reverse scale (undo scaling) of a user's number to get raw value to put in file.

Encorporating the scale is optional (requested by user when constructing the sdbuf). If the user did not request scaling, then we get raw values from user's buffer.

Just return raw value.

Double check non-zero scale. Going to divide by it below.

Verify index is within bounds

Fetch value from source buffer. Convert from non-integer formats if requested

Calc (x-offset)/scale rounded to nearest integer, but keep in floating point until sure is in bounds

Calc (x-offset)/scale rounded to nearest integer, but keep in floating point until sure is in bounds

Calc (x-offset)/scale rounded to nearest integer, but keep in floating point until sure is in bounds

Calc (x-offset)/scale rounded to nearest integer, but keep in floating point until sure is in bounds

Calc (x-offset)/scale rounded to nearest integer, but keep in floating point until sure is in bounds

Calc (x-offset)/scale rounded to nearest integer, but keep in floating point until sure is in bounds

Calc (x-offset)/scale rounded to nearest integer, but keep in floating point until sure is in bounds

Calc (x-offset)/scale rounded to nearest integer, but keep in floating point until sure is in bounds

Calc (x-offset)/scale rounded to nearest integer, but keep in floating point until sure is in bounds

Make sure that value is representable in an int64_t

Definition at line 383 of file SourceDestBufferImpl.cpp.

References e57::E57_BOOL, e57::E57_ERROR_CONVERSION_REQUIRED, e57::E57_ERROR_EXPECTING_NUMERIC, e57::E57_ERROR_INTERNAL, e57::E57_ERROR_SCALED_VALUE_NOT_REPRESENTABLE, E57_EXCEPTION2, e57::E57_INT16, e57::E57_INT32, e57::E57_INT64, e57::E57_INT8, e57::E57_REAL32, e57::E57_REAL64, e57::E57_UINT16, e57::E57_UINT32, e57::E57_UINT8, e57::E57_USTRING, cloudViewer::utility::floor(), getNextInt64(), offset, and e57::toString().

◆ getNextString()

ustring SourceDestBufferImpl::getNextString ( )

don't checkImageFileOpen

Check have correct type buffer

Verify index is within bounds

Get ustring from vector

Definition at line 690 of file SourceDestBufferImpl.cpp.

References e57::E57_ERROR_EXPECTING_USTRING, e57::E57_ERROR_INTERNAL, E57_EXCEPTION2, and e57::E57_USTRING.

◆ memoryRepresentation()

MemoryRepresentation e57::SourceDestBufferImpl::memoryRepresentation ( ) const
inline

Definition at line 55 of file SourceDestBufferImpl.h.

◆ nextIndex()

unsigned e57::SourceDestBufferImpl::nextIndex ( ) const
inline

Definition at line 83 of file SourceDestBufferImpl.h.

◆ pathName()

ustring e57::SourceDestBufferImpl::pathName ( ) const
inline

Definition at line 51 of file SourceDestBufferImpl.h.

Referenced by SourceDestBufferImpl().

◆ rewind()

void e57::SourceDestBufferImpl::rewind ( )
inline

Definition at line 87 of file SourceDestBufferImpl.h.

◆ setNextDouble()

void SourceDestBufferImpl::setNextDouble ( double  value)

Definition at line 934 of file SourceDestBufferImpl.cpp.

◆ setNextFloat()

void SourceDestBufferImpl::setNextFloat ( float  value)

Definition at line 929 of file SourceDestBufferImpl.cpp.

◆ setNextInt64() [1/2]

void SourceDestBufferImpl::setNextInt64 ( int64_t  value)

◆ setNextInt64() [2/2]

void SourceDestBufferImpl::setNextInt64 ( int64_t  value,
double  scale,
double  offset 
)

don't checkImageFileOpen

Apply a scale and offset to numbers from file before puting in user's buffer.

Encorporating the scale is optional (requested by user when constructing the sdbuf). If the user did not request scaling, then we send raw values to user's buffer.

Use raw value routine, then bail out.

Verify have room

Calc start of memory location, index into buffer using stride_ (the distance between elements).

Calc x*scale+offset

Value will be stored in some floating point rep in user's buffer, so keep full resolution here.

Value will represented as some integer in user's buffer, so round to nearest integer here. But keep in floating point rep until we know that the value is representable in the user's buffer.

Check that exponent of result is not too big for single precision float

Definition at line 802 of file SourceDestBufferImpl.cpp.

References e57::E57_BOOL, e57::E57_ERROR_CONVERSION_REQUIRED, e57::E57_ERROR_EXPECTING_NUMERIC, e57::E57_ERROR_INTERNAL, e57::E57_ERROR_SCALED_VALUE_NOT_REPRESENTABLE, E57_EXCEPTION2, e57::E57_INT16, e57::E57_INT32, e57::E57_INT64, e57::E57_INT8, e57::E57_REAL32, e57::E57_REAL64, e57::E57_UINT16, e57::E57_UINT32, e57::E57_UINT8, e57::E57_USTRING, cloudViewer::utility::floor(), offset, setNextInt64(), and e57::toString().

◆ setNextString()

void SourceDestBufferImpl::setNextString ( const ustring value)

don't checkImageFileOpen

Verify have room.

Assign to already initialized element in vector

Definition at line 939 of file SourceDestBufferImpl.cpp.

References e57::E57_ERROR_EXPECTING_USTRING, e57::E57_ERROR_INTERNAL, E57_EXCEPTION2, and e57::E57_USTRING.

◆ setTypeInfo()

template<typename T >
template void SourceDestBufferImpl::setTypeInfo< double > ( T *  base,
size_t  stride = sizeof(T) 
)

◆ stride()

size_t e57::SourceDestBufferImpl::stride ( ) const
inline

Definition at line 75 of file SourceDestBufferImpl.h.

Referenced by setTypeInfo().

◆ ustrings()

StringList* e57::SourceDestBufferImpl::ustrings ( ) const
inline

Definition at line 63 of file SourceDestBufferImpl.h.


The documentation for this class was generated from the following files: