nidas v1.2.3
|
EndianConverter that flips bytes, used for conversion of little-to-big and big-to-little. More...
#include <EndianConverter.h>
Public Types | |
enum | endianness { EC_UNKNOWN_ENDIAN , EC_BIG_ENDIAN , EC_LITTLE_ENDIAN } |
Public Member Functions | |
virtual | ~FlipConverter () |
double | doubleValue (const void *p) const |
Get 8 byte double at address, do endian conversion. | |
double | doubleValue (const double &p) const |
float | floatValue (const void *p) const |
Get 4 byte float at address, do endian conversion. | |
float | floatValue (const float &p) const |
int64_t | int64Value (const void *p) const |
Get 8 byte int64_t at address, do endian conversion. | |
int64_t | int64Value (const int64_t &p) const |
int32_t | int32Value (const void *p) const |
Get 4 byte int32 at address, do endian conversion. | |
int32_t | int32Value (const int32_t &p) const |
uint32_t | uint32Value (const void *p) const |
Get 4 byte unsigned int32_t at address, do endian conversion. | |
uint32_t | uint32Value (const uint32_t &p) const |
int16_t | int16Value (const void *p) const |
int16_t | int16Value (const int16_t &p) const |
uint16_t | uint16Value (const void *p) const |
uint16_t | uint16Value (const uint16_t &p) const |
void | doubleCopy (const double &v, void *p) const |
Copy 8 byte double to the given address, doing endian conversion. | |
void | floatCopy (const float &v, void *p) const |
Copy 4 byte float to the given address, doing endian conversion. | |
void | int64Copy (const int64_t &v, void *p) const |
Copy 8 byte int64_t to the given address, doing endian conversion. | |
void | int32Copy (const int32_t &v, void *p) const |
Copy 4 byte int to the given address, doing endian conversion. | |
void | uint32Copy (const uint32_t &v, void *p) const |
Copy 4 byte unsigned int to the given address, doing endian conversion. | |
void | int16Copy (const int16_t &v, void *p) const |
void | uint16Copy (const uint16_t &v, void *p) const |
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() |
EndianConverter that flips bytes, used for conversion of little-to-big and big-to-little.
|
inherited |
|
inlinevirtual |
|
inlinevirtual |
Copy 8 byte double to the given address, doing endian conversion.
Pointer to address does not need to be 8-byte aligned.
Implements nidas::util::EndianConverter.
References nidas::util::flipDoubleOut().
|
inlinevirtual |
Implements nidas::util::EndianConverter.
References nidas::util::flipDouble().
|
inlinevirtual |
Get 8 byte double at address, do endian conversion.
Pointer to address does not need to be 8-byte aligned.
Implements nidas::util::EndianConverter.
References nidas::util::flipDoubleIn().
|
inlinevirtual |
Copy 4 byte float to the given address, doing endian conversion.
Pointer to address does not need to be 4-byte aligned.
Implements nidas::util::EndianConverter.
References nidas::util::flipFloatOut().
|
inlinevirtual |
Implements nidas::util::EndianConverter.
References nidas::util::flipFloat().
|
inlinevirtual |
Get 4 byte float at address, do endian conversion.
Pointer to address does not need to be 4-byte aligned.
Implements nidas::util::EndianConverter.
References nidas::util::flipFloatIn().
|
staticinherited |
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 nidas::util::EndianConverter::getConverter(), and nidas::util::EndianConverter::getHostEndianness().
|
staticinherited |
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 nidas::util::EndianConverter::flipConverter, nidas::util::EndianConverter::noflipConverter, and nidas::util::EndianConverter::staticInitMutex.
Referenced by nidas::util::EndianConverter::getConverter().
|
staticinherited |
Return endianness value for this host.
References nidas::util::EndianConverter::EC_UNKNOWN_ENDIAN, nidas::util::EndianConverter::hostEndianness, nidas::util::EndianConverter::privGetHostEndianness(), and nidas::util::EndianConverter::staticInitMutex.
Referenced by nidas::util::EndianConverter::getConverter().
|
inlinevirtual |
Implements nidas::util::EndianConverter.
References nidas::util::flipInt16Out().
|
inlinevirtual |
Implements nidas::util::EndianConverter.
References nidas::util::flipInt16().
|
inlinevirtual |
Implements nidas::util::EndianConverter.
References nidas::util::flipInt16In().
|
inlinevirtual |
Copy 4 byte int to the given address, doing endian conversion.
Pointer to address does not need to be 4-byte aligned.
Implements nidas::util::EndianConverter.
References nidas::util::flipInt32Out().
|
inlinevirtual |
Implements nidas::util::EndianConverter.
References nidas::util::flipInt32().
|
inlinevirtual |
Get 4 byte int32 at address, do endian conversion.
Pointer to address does not need to be 4-byte aligned.
Implements nidas::util::EndianConverter.
References nidas::util::flipInt32In().
|
inlinevirtual |
Copy 8 byte int64_t to the given address, doing endian conversion.
Pointer to address does not need to be 8-byte aligned.
Implements nidas::util::EndianConverter.
References nidas::util::flipInt64Out().
|
inlinevirtual |
Implements nidas::util::EndianConverter.
References nidas::util::flipInt64().
|
inlinevirtual |
Get 8 byte int64_t at address, do endian conversion.
Pointer to address does not need to be 8-byte aligned.
Implements nidas::util::EndianConverter.
References nidas::util::flipInt64In().
|
staticprivateinherited |
References nidas::util::EndianConverter::EC_BIG_ENDIAN, nidas::util::EndianConverter::EC_LITTLE_ENDIAN, and VLOG.
Referenced by nidas::util::EndianConverter::getHostEndianness().
|
inlinevirtual |
Implements nidas::util::EndianConverter.
References nidas::util::flipUint16Out().
|
inlinevirtual |
Implements nidas::util::EndianConverter.
References nidas::util::flipUint16().
|
inlinevirtual |
Implements nidas::util::EndianConverter.
References nidas::util::flipUint16In().
|
inlinevirtual |
Copy 4 byte unsigned int to the given address, doing endian conversion.
Pointer to address does not need to be 4-byte aligned.
Implements nidas::util::EndianConverter.
References nidas::util::flipUint32Out().
|
inlinevirtual |
Implements nidas::util::EndianConverter.
References nidas::util::flipUint32().
|
inlinevirtual |
Get 4 byte unsigned int32_t at address, do endian conversion.
Pointer to address does not need to be 4-byte aligned.
Implements nidas::util::EndianConverter.
References nidas::util::flipUint32In().
|
staticprivateinherited |
Referenced by nidas::util::EndianConverter::getConverter().
|
staticinherited |
Referenced by nidas::util::EndianConverter::getHostEndianness().
|
staticprivateinherited |
Referenced by nidas::util::EndianConverter::getConverter().