#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 |
StringList * | ustrings () const |
SourceDestBufferImpl::SourceDestBufferImpl | ( | ImageFileImplWeakPtr | destImageFile, |
const ustring & | pathName, | ||
const size_t | capacity, | ||
bool | doConversion = false , |
||
bool | doScaling = false |
||
) |
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().
void * e57::SourceDestBufferImpl::base | ( | ) | const |
Referenced by automotive_design.mechanism_base_placement::representation_relationship_rep_2(), setTypeInfo(), PathTests.TestPathStock.TestPathStock::test12(), automotive_design.alternate_product_relationship::wr1(), config_control_design.alternate_product_relationship::wr1(), automotive_design.assembly_component_usage_substitute::wr2(), and config_control_design.assembly_component_usage_substitute::wr2().
size_t e57::SourceDestBufferImpl::capacity | ( | ) | const |
void SourceDestBufferImpl::checkCompatible | ( | const std::shared_ptr< SourceDestBufferImpl > & | newBuf | ) | const |
References e57::E57_ERROR_BUFFERS_NOT_COMPATIBLE, and e57::toString().
ImageFileImplWeakPtr e57::SourceDestBufferImpl::destImageFile | ( | ) | const |
bool e57::SourceDestBufferImpl::doConversion | ( | ) | const |
bool e57::SourceDestBufferImpl::doScaling | ( | ) | const |
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.
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().
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().
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().
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 e57::SourceDestBufferImpl::memoryRepresentation | ( | ) | const |
unsigned e57::SourceDestBufferImpl::nextIndex | ( | ) | const |
ustring e57::SourceDestBufferImpl::pathName | ( | ) | const |
Referenced by SourceDestBufferImpl().
void e57::SourceDestBufferImpl::rewind | ( | ) |
Referenced by gzip_utf8.GzipFile::seek().
void SourceDestBufferImpl::setNextDouble | ( | double | value | ) |
void SourceDestBufferImpl::setNextFloat | ( | float | value | ) |
void SourceDestBufferImpl::setNextInt64 | ( | int64_t | value | ) |
don't checkImageFileOpen
Verify have room
Calc start of memory location, index into buffer using stride_ (the distance between elements).
References e57::E57_BOOL, e57::E57_ERROR_CONVERSION_REQUIRED, e57::E57_ERROR_EXPECTING_NUMERIC, e57::E57_ERROR_INTERNAL, e57::E57_ERROR_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, and e57::toString().
Referenced by setNextInt64().
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().
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.
template void SourceDestBufferImpl::setTypeInfo< double > | ( | T * | base, |
size_t | stride = sizeof(T) |
||
) |
size_t e57::SourceDestBufferImpl::stride | ( | ) | const |
Referenced by setTypeInfo().
StringList * e57::SourceDestBufferImpl::ustrings | ( | ) | const |