|
static void | swapArray32 (uint8_t *data, uint32_t dataLen) |
| Swap byte array in place assuming bytes are 32 bit ints. More...
|
|
static void | swapEvent (std::shared_ptr< ByteBuffer > &srcBuffer, std::shared_ptr< ByteBuffer > &destBuffer, std::vector< std::shared_ptr< EvioNode >> &nodeList, bool storeNodes=false, bool swapData=true, size_t srcPos=0, size_t destPos=0) |
| This method swaps the byte order of an entire evio event or bank. More...
|
|
static void | swapBankHeader (std::shared_ptr< EvioNode > &node, std::shared_ptr< ByteBuffer > &srcBuffer, std::shared_ptr< ByteBuffer > &destBuffer, size_t srcPos=0, size_t destPos=0) |
|
static void | swapSegmentHeader (std::shared_ptr< EvioNode > &node, std::shared_ptr< ByteBuffer > &srcBuffer, std::shared_ptr< ByteBuffer > &destBuffer, size_t srcPos=0, size_t destPos=0) |
|
static void | swapTagSegmentHeader (std::shared_ptr< EvioNode > &node, std::shared_ptr< ByteBuffer > &srcBuffer, std::shared_ptr< ByteBuffer > &destBuffer, size_t srcPos=0, size_t destPos=0) |
|
static void | swapData (DataType const &type, std::shared_ptr< ByteBuffer > &srcBuffer, std::shared_ptr< ByteBuffer > &destBuffer, uint32_t len, bool inPlace=false, size_t srcPos=0, size_t destPos=0) |
| This method swaps the data of an evio leaf structure. More...
|
|
static void | swapStructure (std::shared_ptr< EvioNode > &node, std::shared_ptr< ByteBuffer > &srcBuffer, std::shared_ptr< ByteBuffer > &destBuffer, std::vector< std::shared_ptr< EvioNode >> &nodeList, bool storeNodes=false, bool swapData=true, bool inPlace=false, size_t srcPos=0, size_t destPos=0) |
| Swap an evio structure. More...
|
|
static void | swapEvent (uint32_t *buf, int tolocal, uint32_t *dest) |
| Method to swap the endianness of an evio event (bank). More...
|
|
static void | swapEvent (ByteBuffer &buf, ByteBuffer &dest) |
| Method to swap the endianness of an evio event (bank). More...
|
|
static void | swapEvent (std::shared_ptr< ByteBuffer > &buf, std::shared_ptr< ByteBuffer > &dest) |
| Method to swap the endianness of an evio event (bank). More...
|
|
static void | swapBank (uint32_t *buf, bool toLocal, uint32_t *dest) |
| Routine to swap the endianness of an evio bank. More...
|
|
static void | swapSegment (uint32_t *buf, bool toLocal, uint32_t *dest) |
| Routine to swap the endianness of an evio segment. More...
|
|
static void | swapTagsegment (uint32_t *buf, bool toLocal, uint32_t *dest) |
| Routine to swap the endianness of an evio tagsegment. More...
|
|
static void | swapLeafData (DataType const &type, std::shared_ptr< ByteBuffer > &srcBuf, std::shared_ptr< ByteBuffer > &destBuf, size_t srcPos, size_t destPos, size_t len) |
| This method swaps the data of an evio leaf structure. More...
|
|
static void | swapLeafData (DataType const &type, ByteBuffer &srcBuf, ByteBuffer &destBuf, size_t srcPos, size_t destPos, size_t len) |
| This method swaps the data of an evio leaf structure. More...
|
|
static void | swapData (uint32_t *src, uint32_t type, uint32_t length, bool toLocal, uint32_t *dst) |
| Routine to swap any type of evio data. More...
|
|
static void | swapData (std::shared_ptr< BaseStructure > strc) |
| Routine to swap the endianness of an evio structure's (bank, seg, tagseg) data in place, including descendants' data. More...
|
|
Class to hold static methods used to swap evio data.
- Date
- 7/17/2020
- Author
- timmer
static void evio::EvioSwap::swapData |
( |
DataType const & |
type, |
|
|
std::shared_ptr< ByteBuffer > & |
srcBuffer, |
|
|
std::shared_ptr< ByteBuffer > & |
destBuffer, |
|
|
uint32_t |
len, |
|
|
bool |
inPlace = false , |
|
|
size_t |
srcPos = 0 , |
|
|
size_t |
destPos = 0 |
|
) |
| |
|
inlinestatic |
This method swaps the data of an evio leaf structure.
In other words the structure being swapped does not contain evio structures.
- Parameters
-
type | type of data being swapped |
srcBuffer | buffer containing data to be swapped |
destBuffer | buffer in which to place swapped data |
srcPos | position in srcBuffer to start reading data |
destPos | position in destBuffer to start writing swapped data |
len | length of data in 32 bit words |
inPlace | if true, data is swapped in srcBuffer |
- Exceptions
-
EvioException | if srcBuffer not in evio format; if destBuffer too small; if bad values for srcPos and/or destPos; |
References evio::DataType::CHAR8, evio::DataType::CHARSTAR8, evio::DataType::COMPOSITE, evio::DataType::DOUBLE64, evio::DataType::FLOAT32, evio::DataType::INT32, evio::DataType::LONG64, evio::DataType::SHORT16, evio::CompositeData::swapAll(), evio::DataType::UCHAR8, evio::DataType::UINT32, evio::DataType::ULONG64, evio::DataType::UNKNOWN32, and evio::DataType::USHORT16.
Referenced by swapBank(), swapData(), swapEvent(), swapSegment(), swapStructure(), and swapTagsegment().
static void evio::EvioSwap::swapData |
( |
std::shared_ptr< BaseStructure > |
strc | ) |
|
|
inlinestatic |
Routine to swap the endianness of an evio structure's (bank, seg, tagseg) data in place, including descendants' data.
The endianness of the given structure, obtained through BaseStructure#getByteOrder(), does NOT change. The caller must explicitly call BaseStructure#setByteOrder() to do that.
If this structure contains Composite data, and since it is stored as a vector of shared pointers to CompositeData objects, it is only serialized into bytes when written out. Thus the only way to switch it's endianness is for the user to call BaseStructure#setByteOrder() before writing it out as bytes. In other words, this method does NOT swap Composite data.
- Parameters
-
strc | evio structure in which to swap all data. |
- Author
- : Carl Timmer, 7/28/2020
References evio::ByteOrder::byteSwap16(), evio::ByteOrder::byteSwap32(), evio::ByteOrder::byteSwap64(), evio::DataType::DOUBLE64, evio::DataType::FLOAT32, evio::DataType::INT32, evio::DataType::LONG64, evio::DataType::SHORT16, swapData(), evio::DataType::UINT32, evio::DataType::ULONG64, and evio::DataType::USHORT16.
static void evio::EvioSwap::swapEvent |
( |
std::shared_ptr< ByteBuffer > & |
srcBuffer, |
|
|
std::shared_ptr< ByteBuffer > & |
destBuffer, |
|
|
std::vector< std::shared_ptr< EvioNode >> & |
nodeList, |
|
|
bool |
storeNodes = false , |
|
|
bool |
swapData = true , |
|
|
size_t |
srcPos = 0 , |
|
|
size_t |
destPos = 0 |
|
) |
| |
|
inlinestatic |
This method swaps the byte order of an entire evio event or bank.
The byte order of the swapped buffer will be opposite to the byte order of the source buffer argument. If the swap is done in place, the byte order of the source buffer will be switched upon completion and the destPos arg will be set equal to the srcPos arg. The positions of the source and destination buffers are not changed. A ByteBuffer's current byte order can be found by calling java.nio.ByteBuffer#order().
The data to be swapped must not be in the evio file format (with record headers). Data must only consist of bytes representing a single event/bank. Position and limit of neither buffer is changed.
- Parameters
-
srcBuffer | buffer containing event to swap. |
destBuffer | buffer in which to place the swapped event. If null, or identical to srcBuffer, the data is swapped in place. |
nodeList | if not null, generate and store node objects here - one for each swapped evio structure in destBuffer. |
storeNodes | if true, store generated EvioNodes in nodeList. |
swapData | if false, do NOT swap data, else swap data too. |
srcPos | position in srcBuffer to start reading event. |
destPos | position in destBuffer to start writing swapped event. |
- Exceptions
-
EvioException | if srcBuffer arg is null; if any buffer position is not zero |
References evio::DataType::BANK, evio::EvioNode::createEvioNode(), evio::ByteOrder::getOppositeEndian(), evio::DataType::getValue(), swapBankHeader(), swapData(), and swapStructure().
static void evio::EvioSwap::swapStructure |
( |
std::shared_ptr< EvioNode > & |
node, |
|
|
std::shared_ptr< ByteBuffer > & |
srcBuffer, |
|
|
std::shared_ptr< ByteBuffer > & |
destBuffer, |
|
|
std::vector< std::shared_ptr< EvioNode >> & |
nodeList, |
|
|
bool |
storeNodes = false , |
|
|
bool |
swapData = true , |
|
|
bool |
inPlace = false , |
|
|
size_t |
srcPos = 0 , |
|
|
size_t |
destPos = 0 |
|
) |
| |
|
inlinestatic |
Swap an evio structure.
If it is a structure of structures, such as a bank of banks, swap recursively.
- Parameters
-
node | info from parsed header |
srcBuffer | buffer containing structure to swap. |
destBuffer | buffer in which to place the swapped structure. |
nodeList | if not null, store all node objects here - one for each swapped evio structure in destBuffer. |
storeNodes | if true, store generated EvioNodes in nodeList. |
swapData | if false, do NOT swap data, else swap data too. |
inPlace | if true, data is swapped in srcBuffer |
srcPos | position in srcBuffer to start reading structure |
destPos | position in destBuffer to start writing swapped structure |
- Exceptions
-
EvioException | if args are null; IF srcBuffer not in evio format; if destBuffer too small; if bad values for srcPos and/or destPos; |
References evio::DataType::BANK, evio::EvioNode::createEvioNode(), evio::DataType::getValue(), evio::DataType::isBank(), evio::DataType::isSegment(), evio::DataType::isStructure(), evio::DataType::isTagSegment(), evio::DataType::SEGMENT, swapBankHeader(), swapData(), swapSegmentHeader(), swapTagSegmentHeader(), and evio::DataType::TAGSEGMENT.
Referenced by swapEvent().