evio
6.0
|
Numerical values associated with endian byte order. More...
#include <ByteOrder.h>
Public Member Functions | |
std::string | getName () const |
Get the object name. More... | |
bool | isBigEndian () const |
Is this big endian? More... | |
bool | isLittleEndian () const |
Is this little endian? More... | |
bool | isLocalEndian () const |
Is this endian same as the local host? More... | |
ByteOrder | getOppositeEndian () const |
Get the oppposite endian (little if this is big and vice versa). More... | |
bool | operator== (const ByteOrder &rhs) const |
bool | operator!= (const ByteOrder &rhs) const |
Static Public Member Functions | |
static ByteOrder const & | getLocalByteOrder () |
Get the byte order of the local host. More... | |
static ByteOrder const & | nativeOrder () |
Get the byte order of the local host. More... | |
static bool | isLocalHostBigEndian () |
Is the local host big endian? More... | |
static bool | needToSwap (ByteOrder &order) |
Is the argument the opposite of the local host's endian? More... | |
template<typename T > | |
static void | byteSwapInPlace (T &var) |
Templated method to swap data in place. More... | |
template<typename T > | |
static void | byteSwapInPlace (T &var, size_t elements) |
Templated method to swap array data in place. More... | |
template<typename T > | |
static void | byteSwapInPlace (T *var, size_t elements) |
Templated method to swap array data in place. More... | |
static float | byteSwap (float var) |
Convenience method to return swapped float. More... | |
static double | byteSwap (double var) |
Convenience method to return swapped double. More... | |
static uint16_t * | byteSwap16 (uint16_t *src, size_t elements, uint16_t *dst) |
This method swaps an array of 2-byte data. More... | |
static uint32_t * | byteSwap32 (uint32_t *src, size_t elements, uint32_t *dst) |
This method swaps an array of 4-byte data. More... | |
static uint64_t * | byteSwap64 (uint64_t *src, size_t elements, uint64_t *dst) |
This method swaps an array of 8-byte data. More... | |
static void | byteNoSwap32 (const uint32_t *src, size_t elements, uint32_t *dst) |
This routine swaps nothing, it just copies the given number of 32 bit ints. More... | |
Static Public Attributes | |
static const ByteOrder | ENDIAN_LITTLE |
Little endian byte order. More... | |
static const ByteOrder | ENDIAN_BIG |
Big endian byte order. More... | |
static const ByteOrder | ENDIAN_UNKNOWN |
Unknown endian byte order. More... | |
static const ByteOrder | ENDIAN_LOCAL = ByteOrder::getLocalByteOrder() |
Local host's byte order. More... | |
Numerical values associated with endian byte order.
|
static |
This routine swaps nothing, it just copies the given number of 32 bit ints.
If source pointer is null, nothing is done.
src | pointer to data to be copied |
elements | number of 32 bit ints to be copied |
dst | pointer to where data is to be copied to. If null, nothing is done. |
Referenced by evio::EvioSwap::swapData().
|
static |
Convenience method to return swapped float.
var | float to swap |
Referenced by evio::ByteBuffer::getDouble(), evio::ByteBuffer::getFloat(), evio::ByteBuffer::putDouble(), and evio::ByteBuffer::putFloat().
|
static |
Convenience method to return swapped double.
var | double to swap |
|
static |
This method swaps an array of 2-byte data.
If source pointer is null, nothing is done. If destination pointer is null, src is swapped in place.
src | pointer to data source. |
elements | number of 2-byte elements to swap. |
dst | pointer to destination or nullptr if data is to be swapped in place. |
References SWAP_16.
Referenced by evio::EvioSwap::swapData(), evio::BaseStructure::updateShortData(), evio::BaseStructure::updateUShortData(), and evio::BaseStructure::write().
|
static |
This method swaps an array of 4-byte data.
If source pointer is null, nothing is done. If destination pointer is null, src is swapped in place.
src | pointer to data source. |
elements | number of 4-byte elements to swap. |
dst | pointer to destination or nullptr if data is to be swapped in place. |
References SWAP_32.
Referenced by evio::EvioSwap::swapBank(), evio::EvioSwap::swapData(), evio::EvioSwap::swapSegment(), evio::EvioSwap::swapTagsegment(), evio::BaseStructure::updateFloatData(), evio::BaseStructure::updateIntData(), evio::BaseStructure::updateUIntData(), and evio::BaseStructure::write().
|
static |
This method swaps an array of 8-byte data.
If source pointer is null, nothing is done. If destination pointer is null, src is swapped in place.
src | pointer to data source. |
elements | number of 8-byte elements to swap. |
dst | pointer to destination or nullptr if data is to be swapped in place. |
References SWAP_64.
Referenced by evio::EvioSwap::swapData(), evio::BaseStructure::updateDoubleData(), evio::BaseStructure::updateLongData(), evio::BaseStructure::updateULongData(), and evio::BaseStructure::write().
|
static |
Templated method to swap data in place.
T | type of data. |
var | reference to data to be swapped. |
|
static |
Templated method to swap array data in place.
T | data type. |
var | reference to data to be swapped. |
elements | number of data elements to be swapped. |
|
static |
Templated method to swap array data in place.
If source pointer is null, nothing is done.
T | data type. |
var | pointer to data to be swapped. |
elements | number of data elements to be swapped. |
|
inlinestatic |
Get the byte order of the local host.
References ENDIAN_BIG, ENDIAN_LITTLE, and isLocalHostBigEndian().
Referenced by nativeOrder(), and needToSwap().
|
inline |
|
inline |
Get the oppposite endian (little if this is big and vice versa).
References ENDIAN_BIG, ENDIAN_LITTLE, and isBigEndian().
Referenced by evio::EvioReaderV4::parseFirstHeader(), and evio::CompositeData::swapAll().
|
inline |
Is this big endian?
References ENDIAN_BIG.
Referenced by getOppositeEndian().
|
inline |
Is this little endian?
References ENDIAN_LITTLE.
Referenced by evio::ByteBuffer::ByteBuffer().
|
inline |
Is this endian same as the local host?
References ENDIAN_LOCAL.
Referenced by evio::CompactEventBuilder::addDoubleData(), evio::CompactEventBuilder::addFloatData(), evio::CompactEventBuilder::addIntData(), evio::CompactEventBuilder::addLongData(), evio::CompactEventBuilder::addShortData(), evio::CompositeData::swapAll(), and evio::BaseStructure::write().
|
inlinestatic |
Is the local host big endian?
Referenced by getLocalByteOrder().
|
inlinestatic |
Get the byte order of the local host.
References getLocalByteOrder().
|
inlinestatic |
Is the argument the opposite of the local host's endian?
order | byte order to compare to local host's. |
References getLocalByteOrder().
Referenced by evio::BaseStructure::updateDoubleData(), evio::BaseStructure::updateFloatData(), evio::BaseStructure::updateIntData(), evio::BaseStructure::updateLongData(), evio::BaseStructure::updateShortData(), evio::BaseStructure::updateUIntData(), evio::BaseStructure::updateULongData(), and evio::BaseStructure::updateUShortData().
bool evio::ByteOrder::operator!= | ( | const ByteOrder & | rhs | ) | const |
bool evio::ByteOrder::operator== | ( | const ByteOrder & | rhs | ) | const |
|
static |
Big endian byte order.
Referenced by evio::EvioCompactReaderV4::addStructure(), evio::Util::findEvioVersion(), getLocalByteOrder(), getOppositeEndian(), isBigEndian(), evio::CompactEventBuilder::openBank(), evio::CompactEventBuilder::openSegment(), evio::CompactEventBuilder::openTagSegment(), evio::FileHeader::readHeader(), evio::EvioCompactReaderV4::removeStructure(), evio::CompactEventBuilder::setTopLevelTag(), evio::CompositeData::swapData(), evio::Util::toBytes(), evio::Util::toInt(), evio::Util::toLong(), evio::EvioNode::updateLengths(), evio::EvioNode::updateNum(), and evio::EvioNode::updateTag().
|
static |
Little endian byte order.
Referenced by evio::Util::findEvioVersion(), getLocalByteOrder(), getOppositeEndian(), isLittleEndian(), evio::ByteBuffer::order(), evio::FileHeader::readHeader(), and evio::CompositeData::swapData().
|
static |
Local host's byte order.
Referenced by evio::Writer::close(), evio::WriterMT::close(), isLocalEndian(), evio::BaseStructure::needSwap(), evio::ByteBuffer::order(), and evio::CompositeData::swapAll().
|
static |
Unknown endian byte order.