evio
6.0
|
This is an interface for a compact reader of evio format files and buffers. More...
#include <IEvioCompactReader.h>
Public Member Functions | |
virtual bool | isFile ()=0 |
Is this reader reading a file? More... | |
virtual bool | isCompressed ()=0 |
Is the data in the file/buffer compressed? More... | |
virtual void | setBuffer (std::shared_ptr< ByteBuffer > &buf)=0 |
This method can be used to avoid creating additional EvioCompactReader objects by reusing this one with another buffer. More... | |
virtual bool | isClosed ()=0 |
Has close() been called (without reopening by calling setBuffer(std::shared_ptr<ByteBuffer> &))? More... | |
virtual ByteOrder | getByteOrder ()=0 |
Get the byte order of the file/buffer being read. More... | |
virtual uint32_t | getEvioVersion ()=0 |
Get the evio version number. More... | |
virtual std::string | getPath ()=0 |
Get the path to the file. More... | |
virtual ByteOrder | getFileByteOrder ()=0 |
When reading a file, this method's return value is the byte order of the evio data in the file. More... | |
virtual std::string | getDictionaryXML ()=0 |
Get the XML format dictionary is there is one. More... | |
virtual std::shared_ptr < EvioXMLDictionary > | getDictionary ()=0 |
Get the evio dictionary if is there is one. More... | |
virtual bool | hasDictionary ()=0 |
Does this evio file have an associated XML dictionary? More... | |
virtual std::shared_ptr < ByteBuffer > | getByteBuffer ()=0 |
Get the byte buffer being read directly or corresponding to the event file. More... | |
virtual size_t | fileSize ()=0 |
Get the size of the file being read, in bytes. More... | |
virtual std::shared_ptr< EvioNode > | getEvent (size_t eventNumber)=0 |
Get the EvioNode object associated with a particular event number. More... | |
virtual std::shared_ptr< EvioNode > | getScannedEvent (size_t eventNumber)=0 |
Get the EvioNode object associated with a particular event number which has been scanned so all substructures are contained in the node.allNodes list. More... | |
virtual std::shared_ptr < IBlockHeader > | getFirstBlockHeader ()=0 |
This returns the FIRST block (or record) header. More... | |
virtual void | searchEvent (size_t eventNumber, uint16_t tag, uint8_t num, std::vector< std::shared_ptr< EvioNode >> &vec)=0 |
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. More... | |
virtual void | searchEvent (size_t eventNumber, std::string const &dictName, std::shared_ptr< EvioXMLDictionary > &dictionary, std::vector< std::shared_ptr< EvioNode >> &vec)=0 |
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. More... | |
virtual std::shared_ptr < ByteBuffer > | removeEvent (size_t eventNumber)=0 |
This method removes the data of the given event from the buffer. More... | |
virtual std::shared_ptr < ByteBuffer > | removeStructure (std::shared_ptr< EvioNode > &removeNode)=0 |
This method removes the data, represented by the given node, from the buffer. More... | |
virtual std::shared_ptr < ByteBuffer > | addStructure (size_t eventNumber, ByteBuffer &addBuffer)=0 |
This method adds an evio container (bank, segment, or tag segment) as the last structure contained in an event. More... | |
virtual std::shared_ptr < ByteBuffer > | getData (std::shared_ptr< EvioNode > &node)=0 |
Get the data associated with an evio structure in ByteBuffer form. More... | |
virtual std::shared_ptr < ByteBuffer > | getData (std::shared_ptr< EvioNode > &node, bool copy)=0 |
Get the data associated with an evio structure in ByteBuffer form. More... | |
virtual std::shared_ptr < ByteBuffer > | getData (std::shared_ptr< EvioNode > &node, std::shared_ptr< ByteBuffer > &buf)=0 |
Get the data associated with an evio structure in ByteBuffer form. More... | |
virtual std::shared_ptr < ByteBuffer > | getData (std::shared_ptr< EvioNode > &node, std::shared_ptr< ByteBuffer > &buf, bool copy)=0 |
Get the data associated with an evio structure in ByteBuffer form. More... | |
virtual std::shared_ptr < ByteBuffer > | getEventBuffer (size_t eventNumber)=0 |
Get an evio bank or event in ByteBuffer form. More... | |
virtual std::shared_ptr < ByteBuffer > | getEventBuffer (size_t eventNumber, bool copy)=0 |
Get an evio bank or event in ByteBuffer form. More... | |
virtual std::shared_ptr < ByteBuffer > | getStructureBuffer (std::shared_ptr< EvioNode > &node)=0 |
Get an evio structure (bank, seg, or tagseg) in ByteBuffer form. More... | |
virtual std::shared_ptr < ByteBuffer > | getStructureBuffer (std::shared_ptr< EvioNode > &node, bool copy)=0 |
Get an evio structure (bank, seg, or tagseg) in ByteBuffer form. More... | |
virtual void | close ()=0 |
This sets the position to its initial value and marks reader as closed. More... | |
virtual uint32_t | getEventCount ()=0 |
This is the number of events in the file/buffer. More... | |
virtual uint32_t | getBlockCount ()=0 |
This is the number of blocks in the file/buffer including the empty block at the end. More... | |
virtual void | toFile (std::string const &fileName)=0 |
Save the internal byte buffer to the given file (overwrites existing file). More... | |
This is an interface for a compact reader of evio format files and buffers.
The word "compact" refers to using the EvioNode class as a compact or lightweight means to refer to an evio event or structure in a buffer. Compact readers do not use EvioEvent, EvioBank, EvioSegment or EvioTagSegment classes which require a full parsing of each event and the creation of a large number of objects.
|
pure virtual |
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.
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) |
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 |
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReaderV6, and evio::EvioCompactReader.
|
pure virtual |
This sets the position to its initial value and marks reader as closed.
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReaderV6, and evio::EvioCompactReader.
|
pure virtual |
Get the size of the file being read, in bytes.
For small files, obtain the file size using the memory mapped buffer's capacity.
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReader, and evio::EvioCompactReaderV6.
|
pure virtual |
This is the number of blocks in the file/buffer including the empty block at the end.
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReaderV6, and evio::EvioCompactReader.
|
pure virtual |
Get the byte buffer being read directly or corresponding to the event file.
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReader, and evio::EvioCompactReaderV6.
|
pure virtual |
Get the byte order of the file/buffer being read.
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReader, and evio::EvioCompactReaderV6.
|
pure virtual |
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.
node | evio structure whose data is to be retrieved |
EvioException | if object closed or node arg is null. |
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReaderV6, and evio::EvioCompactReader.
|
pure virtual |
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.
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. |
EvioException | if object closed |
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReaderV6, and evio::EvioCompactReader.
|
pure virtual |
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.
node | evio structure whose data is to be retrieved |
buf | user-supplied ByteBuffer to be filled with data. |
EvioException | if object closed or node arg is null. |
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReaderV6, and evio::EvioCompactReader.
|
pure virtual |
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.
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. |
EvioException | if object closed |
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReaderV6, and evio::EvioCompactReader.
|
pure virtual |
Get the evio dictionary if is there is one.
EvioException | if object closed and dictionary still unread |
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReader, and evio::EvioCompactReaderV6.
|
pure virtual |
Get the XML format dictionary is there is one.
EvioException | if object closed and dictionary still unread |
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReader, and evio::EvioCompactReaderV6.
|
pure virtual |
Get the EvioNode object associated with a particular event number.
eventNumber | number of event (place in file/buffer) starting at 1. |
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReader, and evio::EvioCompactReaderV6.
|
pure virtual |
Get an evio bank or event in ByteBuffer form.
The returned buffer is a view into the data of this reader's buffer.
eventNumber | number of event of interest |
EvioException | if evNumber < 1; if the event number does not correspond to an existing event; if object closed |
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReaderV6, and evio::EvioCompactReader.
|
pure virtual |
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.
eventNumber | number of event of interest |
copy | if true , then return a copy as opposed to a view into this reader object's buffer. |
EvioException | if evNumber < 1; if the event number does not correspond to an existing event; if object closed |
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReaderV6, and evio::EvioCompactReader.
|
pure virtual |
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.
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReaderV6, and evio::EvioCompactReader.
|
pure virtual |
Get the evio version number.
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReader, and evio::EvioCompactReaderV6.
|
pure virtual |
When reading a file, this method's return value is the byte order of the evio data in the file.
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReader, and evio::EvioCompactReaderV6.
|
pure virtual |
This returns the FIRST block (or record) header.
(Not the file header of evio version 6+ files).
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReader, and evio::EvioCompactReaderV6.
|
pure virtual |
Get the path to the file.
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReader, and evio::EvioCompactReaderV6.
|
pure virtual |
Get the EvioNode object associated with a particular event number which has been scanned so all substructures are contained in the node.allNodes list.
eventNumber | number of event (place in file/buffer) starting at 1. |
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReader, and evio::EvioCompactReaderV6.
|
pure virtual |
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.
node | node object representing evio structure of interest |
EvioException | if node is null; if object closed |
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReaderV6, and evio::EvioCompactReader.
|
pure virtual |
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.
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. |
EvioException | if node is null; if object closed |
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReaderV6, and evio::EvioCompactReader.
|
pure virtual |
Does this evio file have an associated XML dictionary?
true
if this evio file has an associated XML dictionary, else false
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReader, and evio::EvioCompactReaderV6.
|
pure virtual |
Has close() been called (without reopening by calling setBuffer(std::shared_ptr<ByteBuffer> &))?
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReader, and evio::EvioCompactReaderV6.
|
pure virtual |
Is the data in the file/buffer compressed?
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReader, and evio::EvioCompactReaderV6.
|
pure virtual |
Is this reader reading a file?
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReader, and evio::EvioCompactReaderV6.
|
pure virtual |
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.
eventNumber | number of event to remove from buffer |
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 |
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReaderV6, and evio::EvioCompactReader.
|
pure virtual |
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.
removeNode | evio structure to remove from buffer |
EvioException | if object closed; if node was not found in any event; if internal programming error |
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReaderV6, and evio::EvioCompactReader.
|
pure virtual |
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.
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). |
EvioException | if bad arg value(s); if object closed |
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReaderV6, and evio::EvioCompactReader.
|
pure virtual |
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.
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). |
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 |
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReaderV6, and evio::EvioCompactReader.
|
pure virtual |
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.
buf | ByteBuffer to be read |
EvioException | if arg is null; if failure to read first block header; if buffer not in evio format. |
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReader, and evio::EvioCompactReaderV6.
|
pure virtual |
Save the internal byte buffer to the given file (overwrites existing file).
fileName | name of file to write |
IOException | if error writing to file |
EvioException | if fileName arg is null; if object closed |
Implemented in evio::EvioCompactReaderV4, evio::EvioCompactReaderV6, and evio::EvioCompactReader.