nidas v1.2.3
|
Virtual base class declaring methods for converting numeric values between little-endian and big-endian representations, and for determining the endian represenation of the host system. More...
#include <EndianConverter.h>
Public Types | |
enum | endianness { EC_UNKNOWN_ENDIAN , EC_BIG_ENDIAN , EC_LITTLE_ENDIAN } |
Public Member Functions | |
virtual | ~EndianConverter () |
virtual double | doubleValue (const void *) const =0 |
Get 8 byte double at address, do endian conversion. | |
virtual double | doubleValue (const double &) const =0 |
virtual float | floatValue (const void *) const =0 |
Get 4 byte float at address, do endian conversion. | |
virtual float | floatValue (const float &) const =0 |
virtual int32_t | int32Value (const void *) const =0 |
Get 4 byte int32 at address, do endian conversion. | |
virtual int32_t | int32Value (const int32_t &) const =0 |
virtual int64_t | int64Value (const void *) const =0 |
Get 8 byte int64_t at address, do endian conversion. | |
virtual int64_t | int64Value (const int64_t &) const =0 |
virtual uint32_t | uint32Value (const void *) const =0 |
Get 4 byte unsigned int32_t at address, do endian conversion. | |
virtual uint32_t | uint32Value (const uint32_t &) const =0 |
virtual int16_t | int16Value (const void *) const =0 |
virtual int16_t | int16Value (const int16_t &) const =0 |
virtual uint16_t | uint16Value (const void *) const =0 |
virtual uint16_t | uint16Value (const uint16_t &) const =0 |
virtual void | doubleCopy (const double &, void *) const =0 |
Copy 8 byte double to the given address, doing endian conversion. | |
virtual void | floatCopy (const float &, void *) const =0 |
Copy 4 byte float to the given address, doing endian conversion. | |
virtual void | int32Copy (const int32_t &, void *) const =0 |
Copy 4 byte int to the given address, doing endian conversion. | |
virtual void | int64Copy (const int64_t &, void *) const =0 |
Copy 8 byte int64_t to the given address, doing endian conversion. | |
virtual void | uint32Copy (const uint32_t &, void *) const =0 |
Copy 4 byte unsigned int to the given address, doing endian conversion. | |
virtual void | int16Copy (const int16_t &, void *) const =0 |
virtual void | uint16Copy (const uint16_t &, void *) const =0 |
Static Public Member Functions | |
static endianness | getHostEndianness () |
Return endianness value for this host. | |
static const EndianConverter * | getConverter (endianness input, endianness output) |
Return an EndianConverter for converting from one endian to another. | |
static const EndianConverter * | getConverter (endianness input) |
Return an EndianConverter for converting from an endian represenation to the endian representation of th host. | |
Static Public Attributes | |
static endianness | hostEndianness = EndianConverter::EC_UNKNOWN_ENDIAN |
Static Private Member Functions | |
static endianness | privGetHostEndianness () |
Static Private Attributes | |
static EndianConverter * | flipConverter = 0 |
static EndianConverter * | noflipConverter = 0 |
static Mutex | staticInitMutex = Mutex() |
Virtual base class declaring methods for converting numeric values between little-endian and big-endian representations, and for determining the endian represenation of the host system.
Implementations of this class are meant for serializing/de-serializing binary data. The methods read from an address or write to an address. The addresses do not have to be aligned correctly for the data value type.
|
inlinevirtual |
|
pure virtual |
Copy 8 byte double to the given address, doing endian conversion.
Pointer to address does not need to be 8-byte aligned.
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
pure virtual |
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
pure virtual |
Get 8 byte double at address, do endian conversion.
Pointer to address does not need to be 8-byte aligned.
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
pure virtual |
Copy 4 byte float to the given address, doing endian conversion.
Pointer to address does not need to be 4-byte aligned.
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
pure virtual |
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
pure virtual |
Get 4 byte float at address, do endian conversion.
Pointer to address does not need to be 4-byte aligned.
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
static |
Return an EndianConverter for converting from an endian represenation to the endian representation of th host.
If both are the same, then the converter that is returned just does memcpy's and does not change the representation. It is a const pointer since all its methods are const, and the pointer is owned by EndianConverter.
References getConverter(), and getHostEndianness().
|
static |
Return an EndianConverter for converting from one endian to another.
If both are the same, then the converter that is returned just does memcpy's and does not change the representation. It is a const pointer since all its methods are const, and the pointer is owned by EndianConverter.
References flipConverter, noflipConverter, and staticInitMutex.
Referenced by getConverter().
|
static |
Return endianness value for this host.
References EC_UNKNOWN_ENDIAN, hostEndianness, privGetHostEndianness(), and staticInitMutex.
Referenced by getConverter().
|
pure virtual |
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
pure virtual |
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
pure virtual |
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
pure virtual |
Copy 4 byte int to the given address, doing endian conversion.
Pointer to address does not need to be 4-byte aligned.
Implemented in nidas::util::FlipConverter.
|
pure virtual |
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
pure virtual |
Get 4 byte int32 at address, do endian conversion.
Pointer to address does not need to be 4-byte aligned.
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
pure virtual |
Copy 8 byte int64_t to the given address, doing endian conversion.
Pointer to address does not need to be 8-byte aligned.
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
pure virtual |
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
pure virtual |
Get 8 byte int64_t at address, do endian conversion.
Pointer to address does not need to be 8-byte aligned.
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
staticprivate |
References EC_BIG_ENDIAN, EC_LITTLE_ENDIAN, and VLOG.
Referenced by getHostEndianness().
|
pure virtual |
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
pure virtual |
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
pure virtual |
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
pure virtual |
Copy 4 byte unsigned int to the given address, doing endian conversion.
Pointer to address does not need to be 4-byte aligned.
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
pure virtual |
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
pure virtual |
Get 4 byte unsigned int32_t at address, do endian conversion.
Pointer to address does not need to be 4-byte aligned.
Implemented in nidas::util::FlipConverter, and nidas::util::NoFlipConverter.
|
staticprivate |
Referenced by getConverter().
|
static |
Referenced by getHostEndianness().
|
staticprivate |
Referenced by getConverter().
Referenced by getConverter(), and getHostEndianness().