evio  6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
evio::StructureTransformer Class Reference

This class contains methods to transform structures from one type to another, for example, changing an EvioSegment into an EvioBank. More...

#include <StructureTransformer.h>

Static Public Member Functions

static std::shared_ptr< EvioBanktransform (std::shared_ptr< EvioSegment > const &segment, uint8_t num)
 Create an EvioBank object from an EvioSegment. More...
 
static void copy (std::shared_ptr< EvioBank > const &bank, std::shared_ptr< EvioSegment > const &segment, uint8_t num)
 Copy the data in an EvioSegment object into an existing EvioBank. More...
 
static std::shared_ptr< EvioBanktransform (std::shared_ptr< EvioTagSegment > const &tagsegment, uint8_t num)
 Create an EvioBank object from an EvioTagSegment. More...
 
static void copy (std::shared_ptr< EvioBank > const &bank, std::shared_ptr< EvioTagSegment > const &tagsegment, uint8_t num)
 Copy the data in an EvioTagSegment object into an existing EvioBank. More...
 
static std::shared_ptr
< EvioTagSegment
transform (std::shared_ptr< EvioSegment > const &segment)
 Create an EvioTagSegment object from an EvioSegment. More...
 
static void copy (std::shared_ptr< EvioTagSegment > const &tagsegment, std::shared_ptr< EvioSegment > const &segment)
 Copy the data in an EvioSegment object into an existing EvioTagSegment. More...
 
static std::shared_ptr
< EvioSegment
transform (std::shared_ptr< EvioTagSegment > const &tagsegment)
 Create an EvioSegment object from an EvioTagSegment. More...
 
static void copy (std::shared_ptr< EvioSegment > const &segment, std::shared_ptr< EvioSegment > const &tagsegment)
 Copy the data in an EvioTagSegment object into an existing EvioSegment. More...
 
static std::shared_ptr
< EvioSegment
transform (std::shared_ptr< EvioBank > const &bank)
 Create an EvioSegment object from an EvioBank. More...
 
static void copy (std::shared_ptr< EvioSegment > const &segment, std::shared_ptr< EvioBank > const &bank)
 Copy the data in an EvioBank object into an existing EvioSegment. More...
 
static std::shared_ptr
< EvioTagSegment
transform (std::shared_ptr< EvioBank > const &bank, int dummy)
 Create an EvioTagSegment object from an EvioBank. More...
 
static void copy (std::shared_ptr< EvioTagSegment > const &tagsegment, std::shared_ptr< EvioBank > const &bank)
 Copy the data in an EvioBank object into an existing EvioTagSegment. More...
 

Detailed Description

This class contains methods to transform structures from one type to another, for example, changing an EvioSegment into an EvioBank.

Author
timmer
Date
6/3/2020 (10/1/2010 original java)

Member Function Documentation

static void evio::StructureTransformer::copy ( std::shared_ptr< EvioBank > const &  bank,
std::shared_ptr< EvioSegment > const &  segment,
uint8_t  num 
)
inlinestatic

Copy the data in an EvioSegment object into an existing EvioBank.

Note, however, that the segment's children were are added (not deep cloned) to the bank. Because a segment has no num, the user supplies that as an arg.

Parameters
bankEvioBank object to copy into.
segmentEvioSegment object to copy.
numnum of the EvioBank.
static void evio::StructureTransformer::copy ( std::shared_ptr< EvioBank > const &  bank,
std::shared_ptr< EvioTagSegment > const &  tagsegment,
uint8_t  num 
)
inlinestatic

Copy the data in an EvioTagSegment object into an existing EvioBank.

Note, however, that the tagsegment's children were are added (not deep cloned) to the bank. Because a tagsegment has no num, the user supplies that as an arg.

NOTE: A tagsegment has no associated padding data. However, the bank.transform() method will calculate it and set it in the bank header.

Parameters
bankEvioBank object to copy into.
tagsegmentEvioTagSegment object to copy.
numnum of the EvioBank.
static void evio::StructureTransformer::copy ( std::shared_ptr< EvioTagSegment > const &  tagsegment,
std::shared_ptr< EvioSegment > const &  segment 
)
inlinestatic

Copy the data in an EvioSegment object into an existing EvioTagSegment.

Note, however, that the segment's children were are added (not deep cloned) to the tagsegment.

NOTE: No data should be lost in this transformaton since even though the segment serializes 6 bits of data type when being written out while the tag segment serializes 4, only 4 bits are needed to contain the equivalent type data. And, the segment's tag is serialized into 8 bits while the tagsegment's tag uses 12 bits so no problem there.

Parameters
tagsegmentEvioTagSegment object to copy into.
segmentEvioSegment object to copy.

References evio::DataType::ALSOBANK, evio::DataType::ALSOSEGMENT, evio::DataType::BANK, evio::DataType::getDataType(), and evio::DataType::SEGMENT.

static void evio::StructureTransformer::copy ( std::shared_ptr< EvioSegment > const &  segment,
std::shared_ptr< EvioSegment > const &  tagsegment 
)
inlinestatic

Copy the data in an EvioTagSegment object into an existing EvioSegment.

Note, however, that the tagsegment's children were are added (not deep cloned) to the segment.

NOTE: A tagsegment has no associated padding data. However, the transform() method will calculate it and set it in the segment header. Tags are stored in a 16 bit int and so this transformation will never lose any tag data. Only when a segment's tag is written out or serialized into 8 bits will this become an issue since a tagsegment's tag is serialized as 12 bits.

Parameters
segmentEvioSegment object to copy into.
tagsegmentEvioTagSegment object to copy.
static void evio::StructureTransformer::copy ( std::shared_ptr< EvioSegment > const &  segment,
std::shared_ptr< EvioBank > const &  bank 
)
inlinestatic

Copy the data in an EvioBank object into an existing EvioSegment.

Note, however, that the banks's children were are added (not deep cloned) to the segment.

TAG: Tags are stored in a 16 bit int and so this transformation will never lose any tag data. Only when a segment's tag is written out or serialized into 8 bits will this become an issue since a bank's tag is serialized as 16 bits.

NUM: A segment has no num data and so the bank's num is lost. The bank's num is actually copied into segment header so in that sense it still exists, but will never be written out or serialized.

LENGTH: It is possible that the length of the bank (32 bits) is too big for the segment (16 bits). This condition will cause an exception.

Parameters
segmentEvioSegment object to copy into.
bankEvioBank object to copy.
Exceptions
EvioExceptionif the bank is too long to change into a segment
static void evio::StructureTransformer::copy ( std::shared_ptr< EvioTagSegment > const &  tagsegment,
std::shared_ptr< EvioBank > const &  bank 
)
inlinestatic

Copy the data in an EvioBank object into an existing EvioTagSegment.

Note, however, that the banks's children were are added (not deep cloned) to the tagsegment.

TAG: Tags are stored in a 16 bit int and so this transformation will never lose any tag data. Only when a tagsegment's tag is written out or serialized into 12 bits will this become an issue since a bank's tag is serialized as 16 bits.

NUM: A segment has no num data and so the bank's num is lost. The bank's num is actually copied into segment header so in that sense it still exists, but will never be written out or serialized.

LENGTH: It is possible that the length of the bank (32 bits) is too big for the segment (16 bits). This condition will cause an exception.

Parameters
tagsegmentEvioTagSegment object to copy into.
bankEvioBank object to copy.
Exceptions
EvioExceptionif the bank is too long to change into a segment

References evio::DataType::ALSOBANK, evio::DataType::ALSOSEGMENT, evio::DataType::BANK, evio::DataType::getDataType(), and evio::DataType::SEGMENT.

static std::shared_ptr<EvioBank> evio::StructureTransformer::transform ( std::shared_ptr< EvioSegment > const &  segment,
uint8_t  num 
)
inlinestatic

Create an EvioBank object from an EvioSegment.

The new object has all data copied over, except that the segment's children were are added (not deep cloned) to the bank. Because a segment has no num, the user supplies that as an arg.

Parameters
segmentEvioSegment object to transform.
numnum of the created EvioBank.
Returns
the created EvioBank.

References evio::EvioBank::getInstance().

static std::shared_ptr<EvioBank> evio::StructureTransformer::transform ( std::shared_ptr< EvioTagSegment > const &  tagsegment,
uint8_t  num 
)
inlinestatic

Create an EvioBank object from an EvioTagSegment.

The new object has all data copied over, except that the tagsegment's children were are added (not deep cloned) to the bank. Because a tagsegment has no num, the user supplies that as an arg.

NOTE: A tagsegment has no associated padding data. However, the bank.transform() method will calculate it and set it in the bank header.

Parameters
tagsegmentEvioTagSegment object to transform.
numnum of the created EvioBank.
Returns
the created EvioBank.

References evio::EvioBank::getInstance().

static std::shared_ptr<EvioTagSegment> evio::StructureTransformer::transform ( std::shared_ptr< EvioSegment > const &  segment)
inlinestatic

Create an EvioTagSegment object from an EvioSegment.

The new object has all data copied over, except that the segment's children were are added (not deep cloned) to the tagsegment.

NOTE: No data should be lost in this transformaton since even though the segment serializes 6 bits of data type when being written out while the tag segment serializes 4, only 4 bits are needed to contain the equivalent type data. And, the segment's tag is serialized into 8 bits while the tagsegment's tag uses 12 bits so no problem there.

Parameters
segmentEvioSegment object to transform.
Returns
the created EvioTagSegment.

References evio::DataType::ALSOBANK, evio::DataType::ALSOSEGMENT, evio::DataType::BANK, evio::DataType::getDataType(), evio::EvioTagSegment::getInstance(), and evio::DataType::SEGMENT.

static std::shared_ptr<EvioSegment> evio::StructureTransformer::transform ( std::shared_ptr< EvioTagSegment > const &  tagsegment)
inlinestatic

Create an EvioSegment object from an EvioTagSegment.

The new object has all data copied over, except that the tagsegment's children were are added (not deep cloned) to the segment.

NOTE: A tagsegment has no associated padding data. However, the transform() method will calculate it and set it in the segment header. Tags are stored in a 16 bit int and so this transformation will never lose any tag data. Only when a segment's tag is written out or serialized into 8 bits will this become an issue since a tagsegment's tag is serialized as 12 bits.

Parameters
tagsegmentEvioTagSegment object to transform.
Returns
the created EvioSegment.

References evio::EvioSegment::getInstance().

static std::shared_ptr<EvioSegment> evio::StructureTransformer::transform ( std::shared_ptr< EvioBank > const &  bank)
inlinestatic

Create an EvioSegment object from an EvioBank.

The new object has all data copied over, except that the bank's children were are added (not deep cloned) to the segment.

TAG: Tags are stored in a 16 bit int and so this transformation will never lose any tag data. Only when a segment's tag is written out or serialized into 8 bits will this become an issue since a bank's tag is serialized as 16 bits.

NUM: A segment has no num data and so the bank's num is lost. The bank's num is actually copied into segment header so in that sense it still exists, but will never be written out or serialized.

LENGTH: It is possible that the length of the bank (32 bits) is too big for the segment (16 bits). This condition will cause an exception.

Parameters
bankEvioBank object to transform.
Returns
the created EvioSegment.
Exceptions
EvioExceptionif the bank is too long to change into a segment

References evio::EvioSegment::getInstance().

static std::shared_ptr<EvioTagSegment> evio::StructureTransformer::transform ( std::shared_ptr< EvioBank > const &  bank,
int  dummy 
)
inlinestatic

Create an EvioTagSegment object from an EvioBank.

The new object has all data copied over, except that the bank's children were are added (not deep cloned) to the tagsegment.

TAG: Tags are stored in a 16 bit int and so this transformation will never lose any tag data. Only when a tagsegment's tag is written out or serialized into 12 bits will this become an issue since a bank's tag is serialized as 16 bits.

NUM: A tagsegment has no num data and so the bank's num is lost. The bank's num is actually copied into tagsegment header so in that sense it still exists, but will never be written out or serialized.

LENGTH: It is possible that the length of the bank (32 bits) is too big for the tagsegment (16 bits). This condition will cause an exception.

TYPE: No data should be lost in this transformaton since even though the bank serializes 6 bits of data type when being written out while the tagsegment serializes 4, only 4 bits are needed to contain the equivalent type data.

Parameters
bankEvioBank object to transform.
dummyonly used to distinguish this method from transform(std::shared_ptr<EvioBank> const &).
Returns
the created EvioTagSegment.
Exceptions
EvioExceptionif the bank is too long to change into a tagsegment

References evio::DataType::ALSOBANK, evio::DataType::ALSOSEGMENT, evio::DataType::BANK, evio::DataType::getDataType(), evio::EvioTagSegment::getInstance(), and evio::DataType::SEGMENT.


The documentation for this class was generated from the following file: