evio
6.0
|
This pure, virtual class is meant to encapsulate the operation of reading both 2 differently formatted evio versions. More...
#include <IEvioReader.h>
Public Types | |
enum | ReadWriteStatus { SUCCESS = 0, END_OF_FILE, CANNOT_OPEN_FILE, EVIO_EXCEPTION, UNKNOWN_ERROR } |
This enum denotes the status of a read/write. More... | |
Public Member Functions | |
virtual void | setBuffer (std::shared_ptr< ByteBuffer > &buf)=0 |
This method can be used to avoid creating additional EvioReader 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 bool | checkBlockNumberSequence ()=0 |
Is this reader checking the block number sequence and throwing an exception if it's not sequential and starting with 1? 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 std::shared_ptr < EventParser > & | getParser ()=0 |
Get the file/buffer parser. More... | |
virtual void | setParser (std::shared_ptr< EventParser > &evParser)=0 |
Set the file/buffer parser. More... | |
virtual std::string | getDictionaryXML ()=0 |
Get the XML format dictionary if there is one. More... | |
virtual bool | hasDictionaryXML ()=0 |
Does this evio file have an associated XML dictionary? More... | |
virtual std::shared_ptr < EvioEvent > | getFirstEvent ()=0 |
Get the "first" event if there is one. More... | |
virtual bool | hasFirstEvent ()=0 |
Does this evio file have an associated first event? It's also called the Beginning-Of-Run event. More... | |
virtual size_t | getNumEventsRemaining ()=0 |
Get the number of events remaining in the file. More... | |
virtual std::shared_ptr < ByteBuffer > | getByteBuffer ()=0 |
Get the byte buffer being read. More... | |
virtual size_t | fileSize ()=0 |
Get the size of the file being read, in bytes. More... | |
virtual std::shared_ptr < IBlockHeader > | getFirstBlockHeader ()=0 |
This returns the FIRST block (record) header. More... | |
virtual std::shared_ptr < EvioEvent > | getEvent (size_t index)=0 |
Get the event in the file/buffer at a given index (starting at 1). More... | |
virtual std::shared_ptr < EvioEvent > | parseEvent (size_t index)=0 |
This is a workhorse method. More... | |
virtual std::shared_ptr < EvioEvent > | nextEvent ()=0 |
Get the next event in the file/buffer. More... | |
virtual std::shared_ptr < EvioEvent > | parseNextEvent ()=0 |
This is a workhorse method. More... | |
virtual void | parseEvent (std::shared_ptr< EvioEvent > evioEvent)=0 |
This will parse an event, SAX-like. More... | |
virtual uint32_t | getEventArray (size_t evNumber, std::vector< uint8_t > &vec)=0 |
Get an evio bank or event in vector-of-bytes form. More... | |
virtual uint32_t | getEventBuffer (size_t evNumber, ByteBuffer &buf)=0 |
Get an evio bank or event in ByteBuffer form. More... | |
virtual void | rewind ()=0 |
The equivalent of rewinding the file. More... | |
virtual ssize_t | position ()=0 |
This is equivalent to obtaining the current position in the file. More... | |
virtual void | close ()=0 |
This is closes the file, but for buffers it only sets the position to 0. More... | |
virtual std::shared_ptr < IBlockHeader > | getCurrentBlockHeader ()=0 |
This returns the current (active) block (physical record) header. More... | |
virtual std::shared_ptr < EvioEvent > | gotoEventNumber (size_t evNumber)=0 |
Go to a specific event in the file. More... | |
virtual size_t | getEventCount ()=0 |
This is the number of events in the file/buffer. More... | |
virtual size_t | getBlockCount ()=0 |
This is the number of blocks/records in the file/buffer including the empty block, record or trailer at the end. More... | |
This pure, virtual class is meant to encapsulate the operation of reading both 2 differently formatted evio versions.
One implementing class reads evio versions 1 - 4, and the other, version 6.
This enum
denotes the status of a read/write.
Used internally.
SUCCESS indicates a successful read.
END_OF_FILE indicates that we cannot read because an END_OF_FILE has occurred. Technically this means that whatever we are trying to read is larger than the buffer's unread bytes.
CANNOT_OPEN_FILE indicates that we cannot write because the destination file cannot be opened.
EVIO_EXCEPTION indicates that an EvioException was thrown during a read/write, possibly due to out of range values.
UNKNOWN_ERROR indicates that an unrecoverable error has occurred.
Enumerator | |
---|---|
SUCCESS | |
END_OF_FILE | |
CANNOT_OPEN_FILE | |
EVIO_EXCEPTION | |
UNKNOWN_ERROR |
|
pure virtual |
Is this reader checking the block number sequence and throwing an exception if it's not sequential and starting with 1?
true
if checking block number sequence, else false
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
This is closes the file, but for buffers it only sets the position to 0.
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
Get the size of the file being read, in bytes.
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
This is the number of blocks/records in the file/buffer including the empty block, record or trailer at the end.
EvioException | if object closed. |
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
Get the byte buffer being read.
Not useful when reading files.
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
Get the byte order of the file/buffer being read.
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
This returns the current (active) block (physical record) header.
Since most users have no interest in physical records, this method should not be used.
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
Get the XML format dictionary if there is one.
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
Get the event in the file/buffer at a given index (starting at 1).
As useful as this sounds, most applications will probably call parseNextEvent() or parseEvent(size_t) instead, since it combines combines getting an event with parsing it.
index | number of event desired, starting at 1, from beginning of file/buffer |
EvioException | if failed file access; if failed read due to bad file/buffer format; if index out of bounds; if object closed |
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
Get an evio bank or event in vector-of-bytes form.
evNumber | number of event of interest (starting at 1). |
vec | vector to contain bank's/event's bytes. |
EvioException | if failed file access; if eventNumber out of bounds (starts at 1); if the event number does not correspond to an existing event; if object closed |
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
Get an evio bank or event in ByteBuffer form.
evNumber | number of event of interest |
buf | buffer to contain bank's/event's bytes. |
EvioException | if failed file access; if eventNumber out of bounds (starts at 1); if the event number does not correspond to an existing event; if object closed |
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
This is the number of events in the file/buffer.
Any dictionary or first event are not included in the count.
EvioException | if read failure; if failed file access; if object closed |
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
Get the evio version number.
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
This returns the FIRST block (record) header.
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
Get the "first" event if there is one.
It's also called the Beginning-Of-Run event. This event is defined once but included in each of the related split files written out.
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
Get the number of events remaining in the file.
Useful only if doing a sequential read.
EvioException | if failed reading from file |
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
Get the file/buffer parser.
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
Get the path to the file.
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
Go to a specific event in the file.
The events are numbered 1..N. This number is transient–it is not part of the event as stored in the evio file. In versions 4 and up this is just a wrapper on getEvent(size_t).
evNumber | the event number in a 1..N counting sense, from the start of the file. |
EvioException | if object closed; if failed file access |
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
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::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
Does this evio file have an associated first event? It's also called the Beginning-Of-Run event.
This event is defined once but included in each of the related split files written out.
true
if this evio file has an associated first event, else false
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
Has close() been called (without reopening by calling setBuffer(std::shared_ptr<ByteBuffer> &))?
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
Get the next event in the file/buffer.
As useful as this sounds, most applications will probably call parseNextEvent() instead, since it combines getting the next event with parsing the next event.
Although this method can get events in versions 4+, it now delegates that to another method. No changes were made to this method from versions 1-3 in order to read the version 4 format as it is subset of versions 1-3 with variable block length.
null
. EvioException | if failed file access; if failed read due to bad buffer format; if object closed |
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
This is a workhorse method.
It retrieves the desired event from the file/buffer, and then parses it SAX-like. It will drill down and uncover all structures (banks, segments, and tagsegments) and notify any interested listeners.
index | number of event desired, starting at 1, from beginning of file/buffer |
EvioException | if failed file access; if failed read due to bad file/buffer format; if index out of bounds; if object closed |
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
This will parse an event, SAX-like.
It will drill down and uncover all structures (banks, segments, and tagsegments) and notify any interested listeners.
As useful as this sounds, most applications will probably call parseNextEvent() instead, since it combines combines getting the next event with parsing the next event.
This method is only called by synchronized methods and therefore is not synchronized.
evioEvent | the event to parse. |
EvioException | if bad format |
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
This is a workhorse method.
It retrieves the next event from the file/buffer, and then parses it SAX-like. It will drill down and uncover all structures (banks, segments, and tagsegments) and notify any interested listeners.
null
. EvioException | if failed file access; if read failure or bad format; if object closed |
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
This is equivalent to obtaining the current position in the file.
What it actually does is return the position of the buffer. Only meaningful to evio versions 1-3 and for sequential reading.
EvioException | if object closed; if error accessing file |
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
The equivalent of rewinding the file.
What it actually does is set the position of the file/buffer back to where it was after calling the constructor - after the first header.
EvioException | if object closed; if failed file access or buffer/file read |
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
This method can be used to avoid creating additional EvioReader objects by reusing this one with another buffer.
The method close() is called before anything else.
buf | ByteBuffer to be read. |
underflow_error | if not enough data in buffer. |
EvioException | if buf is null; buf not in proper format; if first record/block number != 1 when checkRecNumSeq arg is true. |
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.
|
pure virtual |
Set the file/buffer parser.
evParser | file/buffer parser. |
Implemented in evio::EvioReaderV4, evio::EvioReader, and evio::EvioReaderV6.