e57::SourceDestBufferImpl Class Reference

#include <SourceDestBufferImpl.h>

Public Member Functions

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

Constructor & Destructor Documentation

◆ SourceDestBufferImpl() [1/2]

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

◆ 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.

References e57::E57_ERROR_BAD_BUFFER, and pathName().

Member Function Documentation

◆ base()

◆ capacity()

size_t e57::SourceDestBufferImpl::capacity ( ) const

◆ checkCompatible()

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

◆ destImageFile()

ImageFileImplWeakPtr e57::SourceDestBufferImpl::destImageFile ( ) const

◆ doConversion()

bool e57::SourceDestBufferImpl::doConversion ( ) const

◆ doScaling()

bool e57::SourceDestBufferImpl::doScaling ( ) const

◆ 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

References e57::E57_BOOL, e57::E57_ERROR_CONVERSION_REQUIRED, e57::E57_ERROR_EXPECTING_NUMERIC, e57::E57_ERROR_INTERNAL, 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?

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::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

References e57::E57_BOOL, e57::E57_ERROR_CONVERSION_REQUIRED, e57::E57_ERROR_EXPECTING_NUMERIC, e57::E57_ERROR_INTERNAL, 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.

Incorporating 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

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::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, getNextInt64(), and e57::toString().

◆ getNextString()

ustring SourceDestBufferImpl::getNextString ( )

don't checkImageFileOpen

Check have correct type buffer

Verify index is within bounds

Get ustring from vector

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

◆ memoryRepresentation()

MemoryRepresentation e57::SourceDestBufferImpl::memoryRepresentation ( ) const

◆ nextIndex()

unsigned e57::SourceDestBufferImpl::nextIndex ( ) const

◆ pathName()

ustring e57::SourceDestBufferImpl::pathName ( ) const

Referenced by SourceDestBufferImpl().

◆ rewind()

void e57::SourceDestBufferImpl::rewind ( )

◆ setNextDouble()

void SourceDestBufferImpl::setNextDouble ( double  value)

◆ setNextFloat()

void SourceDestBufferImpl::setNextFloat ( float  value)

◆ 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 putting in user's buffer.

Incorporating 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

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::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, draftfunctions.offset::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

References e57::E57_ERROR_EXPECTING_USTRING, e57::E57_ERROR_INTERNAL, 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

Referenced by setTypeInfo().

◆ ustrings()

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

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