This class is used to read an evio format version 4 formatted file or buffer and extract specific evio containers (bank, seg, or tagseg) with actual data in them given a tag/num pair.
More...
|
| EvioCompactReaderV4 (std::string const &path) |
| Constructor for reading an event file. More...
|
|
| EvioCompactReaderV4 (std::shared_ptr< ByteBuffer > &byteBuffer) |
| Constructor for reading a buffer. More...
|
|
void | setBuffer (std::shared_ptr< ByteBuffer > &buf) override |
| This method can be used to avoid creating additional EvioCompactReader objects by reusing this one with another buffer.The method close() should be called before calling this.- Parameters
-
- Exceptions
-
EvioException | if arg is null; if failure to read first block header; if buffer not in evio format. |
More...
|
|
bool | isFile () override |
| Is this reader reading a file?- Returns
- true if reading file, false if reading buffer
More...
|
|
bool | isCompressed () override |
| Is the data in the file/buffer compressed?- Returns
- true if data is compressed.
More...
|
|
bool | isClosed () override |
| Has close() been called (without reopening by calling setBuffer(std::shared_ptr<ByteBuffer> &))?- Returns
- if this object closed, else .
More...
|
|
ByteOrder | getByteOrder () override |
| Get the byte order of the file/buffer being read.- Returns
- byte order of the file/buffer being read.
More...
|
|
uint32_t | getEvioVersion () override |
| Get the evio version number.- Returns
- evio version number.
More...
|
|
std::string | getPath () override |
| Get the path to the file.- Returns
- path to the file
More...
|
|
ByteOrder | getFileByteOrder () override |
| When reading a file, this method's return value is the byte order of the evio data in the file.- Returns
- byte order of the evio data in the file.
More...
|
|
std::string | getDictionaryXML () override |
| Get the XML format dictionary is there is one.- Exceptions
-
- Returns
- XML format dictionary, else null.
More...
|
|
std::shared_ptr
< EvioXMLDictionary > | getDictionary () override |
| Get the evio dictionary if is there is one.- Exceptions
-
- Returns
- evio dictionary if exists, else null.
More...
|
|
bool | hasDictionary () override |
| Does this evio file have an associated XML dictionary?- Returns
true if this evio file has an associated XML dictionary, else false
More...
|
|
std::shared_ptr< ByteBuffer > | getByteBuffer () override |
| Get the byte buffer being read directly or corresponding to the event file.- Returns
- the byte buffer being read directly or corresponding to the event file.
More...
|
|
size_t | fileSize () override |
| Get the size of the file being read, in bytes.For small files, obtain the file size using the memory mapped buffer's capacity.
- Returns
- the file size in bytes
More...
|
|
std::shared_ptr< EvioNode > | getEvent (size_t eventNumber) override |
| Get the EvioNode object associated with a particular event number.- Parameters
-
eventNumber | number of event (place in file/buffer) starting at 1. |
- Returns
- EvioNode object associated with a particular event number, or null if there is none.
More...
|
|
std::shared_ptr< EvioNode > | getScannedEvent (size_t eventNumber) override |
| Get the EvioNode object associated with a particular event number which has been scanned so all substructures are contained in the node.allNodes list.- Parameters
-
eventNumber | number of event (place in file/buffer) starting at 1. |
- Returns
- EvioNode object associated with a particular event number, or null if there is none.
More...
|
|
std::shared_ptr< IBlockHeader > | getFirstBlockHeader () override |
| This returns the FIRST block (or record) header.(Not the file header of evio version 6+ files).
- Returns
- the first block header.
More...
|
|
void | searchEvent (size_t eventNumber, uint16_t tag, uint8_t num, std::vector< std::shared_ptr< EvioNode >> &vec) override |
| This method searches the specified event in a file/buffer and returns a vector of objects each of which contain information about a single evio structure which matches the given tag and num.- Parameters
-
eventNumber | place of event in buffer (starting with 1) |
tag | tag to match. |
num | num to match. |
vec | vector to be filled with matching evio structures (empty if none found). |
- Exceptions
-
More...
|
|
void | searchEvent (size_t eventNumber, std::string const &dictName, std::shared_ptr< EvioXMLDictionary > &dictionary, std::vector< std::shared_ptr< EvioNode >> &vec) override |
| This method searches the specified event in a file/buffer and returns a vector of objects each of which contain information about a single evio structure which matches the given dictionary entry name.- Parameters
-
eventNumber | place of event in buffer (starting with 1) |
dictName | name of dictionary entry to search for |
dictionary | dictionary to use; if null, use dictionary with file/buffer |
vec | vector to be filled with matching evio structures (empty if none found). |
- Exceptions
-
EvioException | if dictName is null; if dictName is an invalid dictionary entry; if dictionary is null and none provided in file/buffer being read; if object closed |
More...
|
|
std::shared_ptr< ByteBuffer > | removeEvent (size_t eventNumber) override |
| This method removes the data of the given event from the buffer.It also marks any existing EvioNodes representing the event and its descendants as obsolete. They must not be used anymore.If the constructor of this reader read in data from a file, it will now switch to using a new, internal buffer which is returned by this method or can be retrieved by calling getByteBuffer(). It will not change the file originally used. A new file can be created by calling either the toFile(std::string const &) method.- Parameters
-
eventNumber | number of event to remove from buffer |
- Returns
- new ByteBuffer created and updated to reflect the event removal
- Exceptions
-
EvioException | if evNumber < 1; if event number does not correspond to existing event; if object closed; if node was not found in any event; if internal programming error |
More...
|
|
std::shared_ptr< ByteBuffer > | removeStructure (std::shared_ptr< EvioNode > &removeNode) override |
| This method removes the data, represented by the given node, from the buffer.It also marks the node and its descendants as obsolete. They must not be used anymore.If the constructor of this reader read in data from a file, it will now switch to using a new, internal buffer which is returned by this method or can be retrieved by calling getByteBuffer(). It will not change the file originally used. A new file can be created by calling either the toFile(std::string const &) method.- Parameters
-
removeNode | evio structure to remove from buffer |
- Returns
- new ByteBuffer (perhaps created) and updated to reflect the node removal
- Exceptions
-
EvioException | if object closed; if node was not found in any event; if internal programming error |
More...
|
|
std::shared_ptr< ByteBuffer > | addStructure (size_t eventNumber, ByteBuffer &addBuffer) override |
| This method adds an evio container (bank, segment, or tag segment) as the last structure contained in an event.It is the responsibility of the caller to make sure that the buffer argument contains valid evio data (only data representing the structure to be added - not in file format with block header and the like) which is compatible with the type of data stored in the given event.To produce such evio data use EvioBank#write(ByteBuffer &), EvioSegment#write(ByteBuffer &) or EvioTagSegment#write(ByteBuffer &) depending on whether a bank, seg, or tagseg is being added.A note about files here. If the constructor of this reader read in data from a file, it will now switch to using a new, internal buffer which is returned by this method or can be retrieved by calling getByteBuffer(). It will not expand the file originally used. A new file can be created by calling either the toFile(std::string const &) method.The given buffer argument must be ready to read with its position and limit defining the limits of the data to copy. This method is synchronized due to the bulk, relative puts.- Parameters
-
eventNumber | number of event to which addBuffer is to be added |
addBuffer | buffer containing evio data to add (not evio file format, i.e. no block headers) |
- Returns
- a new ByteBuffer object which is created and filled with all the data including what was just added.
- Exceptions
-
EvioException | if evNumber < 1; if addBuffer is null; if addBuffer arg is empty or has non-evio format; if addBuffer is opposite endian to current event buffer; if added data is not the proper length (i.e. multiple of 4 bytes); if the event number does not correspond to an existing event; if there is an internal programming error; if object closed |
More...
|
|
std::shared_ptr< ByteBuffer > | getData (std::shared_ptr< EvioNode > &node) override |
| Get the data associated with an evio structure in ByteBuffer form.The returned buffer is a view into this reader's buffer (no copy done). Changes in one will affect the other.- Parameters
-
node | evio structure whose data is to be retrieved |
- Exceptions
-
- Returns
- ByteBuffer filled with data.
More...
|
|
std::shared_ptr< ByteBuffer > | getData (std::shared_ptr< EvioNode > &node, bool copy) override |
| Get the data associated with an evio structure in ByteBuffer form.Depending on the copy argument, the given/returned buffer will either be a copy of or a view into the data of this reader's buffer.This method is synchronized due to the bulk, relative gets & puts.- Parameters
-
node | evio structure whose data is to be retrieved |
copy | if true , then return a copy as opposed to a view into this reader object's buffer. |
- Exceptions
-
- Returns
- ByteBuffer filled with data.
More...
|
|
std::shared_ptr< ByteBuffer > | getData (std::shared_ptr< EvioNode > &node, std::shared_ptr< ByteBuffer > &buf) override |
| Get the data associated with an evio structure in ByteBuffer form.The returned buffer is a view into this reader's buffer (no copy done). Changes in one will affect the other.- Parameters
-
node | evio structure whose data is to be retrieved |
buf | user-supplied ByteBuffer to be filled with data. |
- Exceptions
-
- Returns
- buf arg.
More...
|
|
std::shared_ptr< ByteBuffer > | getData (std::shared_ptr< EvioNode > &node, std::shared_ptr< ByteBuffer > &buf, bool copy) override |
| Get the data associated with an evio structure in ByteBuffer form.Depending on the copy argument, the given/returned buffer will either be a copy of or a view into the data of this reader's buffer.This method is synchronized due to the bulk, relative gets & puts.- Parameters
-
node | evio structure whose data is to be retrieved |
buf | user-supplied ByteBuffer to be filled with data. |
copy | if true , then return a copy as opposed to a view into this reader object's buffer. |
- Exceptions
-
- Returns
- buf arg.
More...
|
|
std::shared_ptr< ByteBuffer > | getEventBuffer (size_t eventNumber) override |
| Get an evio bank or event in ByteBuffer form.The returned buffer is a view into the data of this reader's buffer.- Parameters
-
eventNumber | number of event of interest |
- Returns
- ByteBuffer object containing bank's/event's bytes. Position and limit are set for reading.
- Exceptions
-
EvioException | if evNumber < 1; if the event number does not correspond to an existing event; if object closed |
More...
|
|
std::shared_ptr< ByteBuffer > | getEventBuffer (size_t eventNumber, bool copy) override |
| Get an evio bank or event in ByteBuffer form.Depending on the copy argument, the returned buffer will either be a copy of or a view into the data of this reader's buffer.- Parameters
-
eventNumber | number of event of interest |
copy | if true , then return a copy as opposed to a view into this reader object's buffer. |
- Returns
- ByteBuffer object containing bank's/event's bytes. Position and limit are set for reading.
- Exceptions
-
EvioException | if evNumber < 1; if the event number does not correspond to an existing event; if object closed |
More...
|
|
std::shared_ptr< ByteBuffer > | getStructureBuffer (std::shared_ptr< EvioNode > &node) override |
| Get an evio structure (bank, seg, or tagseg) in ByteBuffer form.The returned buffer is a view into the data of this reader's buffer.- Parameters
-
node | node object representing evio structure of interest |
- Returns
- ByteBuffer object containing bank's/event's bytes. Position and limit are set for reading.
- Exceptions
-
More...
|
|
std::shared_ptr< ByteBuffer > | getStructureBuffer (std::shared_ptr< EvioNode > &node, bool copy) override |
| Get an evio structure (bank, seg, or tagseg) in ByteBuffer form.Depending on the copy argument, the returned buffer will either be a copy of or a view into the data of this reader's buffer.- Parameters
-
node | node object representing evio structure of interest |
copy | if true , then return a copy as opposed to a view into this reader object's buffer. |
- Returns
- ByteBuffer object containing structure's bytes. Position and limit are set for reading.
- Exceptions
-
More...
|
|
void | close () override |
| This only sets the position to its initial value. More...
|
|
uint32_t | getEventCount () override |
| This is the number of events in the file/buffer.Any dictionary event is not included in the count. In versions 3 and earlier, it is not computed unless asked for, and if asked for it is computed and cached.- Returns
- the number of events in the file/buffer.
More...
|
|
uint32_t | getBlockCount () override |
| This is the number of blocks in the file/buffer including the empty block at the end.- Returns
- the number of blocks in the file/buffer (estimate for version 3 files)
More...
|
|
void | toFile (std::string const &fileName) override |
| Save the internal byte buffer to the given file (overwrites existing file).- Parameters
-
fileName | name of file to write |
- Exceptions
-
IOException | if error writing to file |
EvioException | if fileName arg is null; if object closed |
More...
|
|
This class is used to read an evio format version 4 formatted file or buffer and extract specific evio containers (bank, seg, or tagseg) with actual data in them given a tag/num pair.
- Date
- 07/01/2020
- Author
- timmer