11 #ifndef EVIO_6_0_EVIONODE_H
12 #define EVIO_6_0_EVIONODE_H
41 class EvioNode :
public std::enable_shared_from_this<EvioNode> {
68 uint32_t dataType = 0;
75 std::vector<uint32_t> data;
82 bool obsolete =
false;
85 std::shared_ptr<ByteBuffer> buffer =
nullptr;
88 std::vector<std::shared_ptr<EvioNode>> childNodes;
107 bool scanned =
false;
120 std::vector<std::shared_ptr<EvioNode>> allNodes;
127 std::shared_ptr<EvioNode> eventNode =
nullptr;
130 std::shared_ptr<EvioNode> parentNode =
nullptr;
147 void copyParentForScan(std::shared_ptr<EvioNode> & parent);
148 void addChild(std::shared_ptr<EvioNode> & node);
149 void addToAllNodes(std::shared_ptr<EvioNode> & node);
150 void removeFromAllNodes(std::shared_ptr<EvioNode> & node);
151 void removeChild(std::shared_ptr<EvioNode> & node);
157 explicit EvioNode(std::shared_ptr<EvioNode> & firstNode,
int dummy);
158 std::shared_ptr<EvioNode>
getThis() {
return shared_from_this();}
164 explicit EvioNode(
const std::shared_ptr<EvioNode> & src);
167 EvioNode(
size_t pos, uint32_t place,
size_t recordPos, std::shared_ptr<
ByteBuffer> & buffer);
168 EvioNode(uint16_t tag, uint8_t num,
size_t pos,
size_t dataPos,
179 size_t position, uint32_t place);
182 size_t position, uint32_t place);
185 bool operator==(const
EvioNode& src) const;
197 void setData(
size_t position, uint32_t plc,
size_t recPos, std::shared_ptr<
ByteBuffer> & buf);
240 void getIntData(std::vector<uint32_t> & intData);
241 void getLongData(std::vector<uint64_t> & longData);
249 #endif //EVIO_6_0_EVIONODE_H
This class is copied from one of the same name in the Java programming language.
Definition: ByteBuffer.h:42
void getShortData(std::vector< uint16_t > &shortData)
Get the data associated with this node as an 16-bit integer vector.
Definition: EvioNode.cpp:1216
static uint32_t staticId
Static id for testing.
Definition: EvioNode.h:142
ByteBuffer & getStructureBuffer(ByteBuffer &dest, bool copy)
Get this node's entire evio structure in ByteBuffer form.
Definition: EvioNode.cpp:1237
static std::shared_ptr< EvioNode > & extractNode(std::shared_ptr< EvioNode > &bankNode, size_t position)
This method populates an EvioNode object that will represent an evio bank from that same node contain...
Definition: EvioNode.cpp:453
void getAllDescendants(std::vector< std::shared_ptr< EvioNode >> &descendants)
Get the list of all descendant nodes that this node contains - not only the immediate children...
Definition: EvioNode.cpp:815
bool getScanned() const
Has this object been scanned (i.e.
Definition: EvioNode.cpp:983
void clear()
Clear all data in this object.
Definition: EvioNode.cpp:297
std::shared_ptr< EvioNode > getThis()
Definition: EvioNode.h:158
Class containing static methods of general purpose.
Definition: Util.h:41
bool isEvent() const
Does this object represent an event?
Definition: EvioNode.cpp:974
size_t getDataPosition() const
Get the file/buffer byte position of this evio structure's data.
Definition: EvioNode.cpp:924
std::vector< uint32_t > & getIntData()
Get the data associated with this node as an 32-bit integer vector.
Definition: EvioNode.cpp:1165
ByteBuffer & getByteData(ByteBuffer &dest, bool copy)
Get the data associated with this node in ByteBuffer form.
Definition: EvioNode.cpp:1091
This class is used to store relevant info about an evio record (or block) along with its position in ...
Definition: RecordNode.h:30
std::shared_ptr< EvioNode > getChildAt(uint32_t index)
Get the child node at the given index (starts at 0).
Definition: EvioNode.cpp:833
uint32_t getDataType() const
Get the evio type of the data this evio structure contains.
Definition: EvioNode.cpp:932
This class is used to read an evio format version 4 formatted file or buffer and extract specific evi...
Definition: EvioCompactReaderV4.h:54
uint32_t getTotalBytes() const
Get the length of this evio structure including entire header in bytes.
Definition: EvioNode.cpp:870
static void scanStructure(std::shared_ptr< EvioNode > &node)
This method recursively stores, in the given list, all the information about an evio structure's chil...
Definition: EvioNode.cpp:504
uint32_t getPad() const
Get the padding of this evio structure.
Definition: EvioNode.cpp:890
DataType getTypeObj() const
Get the evio type of this evio structure as an object.
Definition: EvioNode.cpp:910
EvioNode & shift(int deltaPos)
Shift the positions (pos, dataPos, and recordPos) of this node and its children by a fixed amount...
Definition: EvioNode.cpp:226
DataType getDataTypeObj() const
Get the evio type of the data this evio structure contains as an object.
Definition: EvioNode.cpp:938
void setBuffer(std::shared_ptr< ByteBuffer > &buf)
Set the buffer.
Definition: EvioNode.cpp:330
void clearLists()
Clear childNodes.
Definition: EvioNode.cpp:282
void setObsolete(bool ob)
Set whether this node & descendants are now obsolete because the data they represent in the buffer ha...
Definition: EvioNode.cpp:769
size_t getPosition() const
Get the file/buffer byte position of this evio structure.
Definition: EvioNode.cpp:896
void updateLengths(uint32_t deltaLen)
Update the length of this node in the buffer and all its parent nodes as well.
Definition: EvioNode.cpp:991
This class is used to store relevant info about an evio container (bank, segment, or tag segment)...
Definition: EvioNode.h:41
void getLongData(std::vector< uint64_t > &longData)
Get the data associated with this node as an 64-bit integer vector.
Definition: EvioNode.cpp:1200
std::shared_ptr< EvioNode > getParentNode()
Get this node's parent node.
Definition: EvioNode.cpp:958
void clearIntArray()
Only clear the data vector.
Definition: EvioNode.cpp:318
uint32_t getChildCount() const
Get the number all children that this node contains.
Definition: EvioNode.cpp:847
bool isObsolete() const
Has the data this node represents in the buffer been removed?
Definition: EvioNode.cpp:759
Numerical values associated with evio data types.
Definition: DataType.h:32
size_t getRecordPosition() const
Get the file/buffer byte position of the record containing this node.
Definition: EvioNode.cpp:945
uint32_t getType() const
Get the evio type of this evio structure, not what it contains.
Definition: EvioNode.cpp:904
void updateTag(uint16_t newTag)
Update, in the buffer, the tag of the structure header this object represents.
Definition: EvioNode.cpp:1024
uint8_t getNum() const
Get the num of this evio structure.
Definition: EvioNode.cpp:883
uint32_t getPlace() const
Get the place of containing event in file/buffer.
Definition: EvioNode.cpp:952
void updateNum(uint8_t newNum)
Update, in the buffer, the num of the bank header this object represents.
Definition: EvioNode.cpp:1063
uint32_t id
Local id for testing.
Definition: EvioNode.h:139
EvioNode()
Constructor when fancy features not needed.
Definition: EvioNode.cpp:22
std::string toString()
Get a string representation of this object.
Definition: EvioNode.cpp:243
void setData(size_t position, uint32_t plc, std::shared_ptr< ByteBuffer > &buf, RecordNode &recNode)
Once this node is cleared, it may be reused and then re-initialized with this method.
Definition: EvioNode.cpp:342
static std::shared_ptr< EvioNode > extractEventNode(std::shared_ptr< ByteBuffer > &buffer, RecordNode &recNode, size_t position, uint32_t place)
This method extracts an EvioNode object representing an evio event (top level evio bank) from a given...
Definition: EvioNode.cpp:394
std::vector< std::shared_ptr< EvioNode > > & getAllNodes()
Get the vector of all nodes that this node contains, always including itself.
Definition: EvioNode.cpp:786
This class is used to read an evio format version 6 formatted file or buffer.
Definition: EvioCompactReaderV6.h:52
uint32_t getDataLength() const
Get the length of this evio structure's data only (no header words) in 32-bit words.
Definition: EvioNode.cpp:918
std::vector< std::shared_ptr< EvioNode > > & getChildNodes()
Get the vector of all child nodes that this node contains.
Definition: EvioNode.cpp:804
uint32_t getEventNumber() const
If this object represents an event (top-level, evio bank), then returns its number (place in file or ...
Definition: EvioNode.cpp:966
uint32_t getLength() const
Get the length of this evio structure (not including length word itself) in 32-bit words...
Definition: EvioNode.cpp:863
std::shared_ptr< ByteBuffer > getBuffer()
Get the object containing the buffer that this node is associated with.
Definition: EvioNode.cpp:854
void clearObjects()
Empty all lists and remove all other objects from this object.
Definition: EvioNode.cpp:305
uint16_t getTag() const
Get the tag of this evio structure.
Definition: EvioNode.cpp:876