evio
6.0
|
Class used to handle event indexes in the context of a file (or buffer) and having to change records. More...
#include <FileEventIndex.h>
Public Member Functions | |
FileEventIndex ()=default | |
Constructor. More... | |
void | clear () |
Clear the entire object. More... | |
void | resetIndex () |
Resets the current index to 0. More... | |
void | show () |
Prints the content of the event index array on the screen. More... | |
void | addEventSize (uint32_t size) |
Adds the number of events in the next record to the index of records. More... | |
uint32_t | getEventNumber () const |
Gets the current event number which is set by advance(), retreat() or setEvent(uint32_t) (which also sets the record number that the event belongs to). More... | |
uint32_t | getRecordNumber () const |
Gets the current record number which is set by setEvent(uint32_t), or by using advance() or retreat() (which set the event number to the next available or previous available respectively). More... | |
uint32_t | getRecordEventNumber () const |
Gets the event number inside the record that corresponds to the current global event number from the file. More... | |
uint32_t | getMaxEvents () const |
Gets the total number of events in file. More... | |
bool | canAdvance () const |
Checks to see if the event counter reached the end. More... | |
bool | canRetreat () const |
Checks if the event index can retreat (decrease). More... | |
bool | advance () |
Advances the current event number by one. More... | |
bool | retreat () |
Reduces current event number by one. More... | |
bool | setEvent (uint32_t event) |
Set the current event to the desired position. More... | |
std::string | toString () |
Get a string representation of this object. More... | |
int | main (int argc, char **argv) |
Class used to handle event indexes in the context of a file (or buffer) and having to change records.
|
default |
Constructor.
void evio::FileEventIndex::addEventSize | ( | uint32_t | size | ) |
Adds the number of events in the next record to the index of records.
Internally, what is stored is the total number of events in the file up to and including the record of this entry.
size | number of events in the next record. |
Referenced by evio::Reader::forceScanFile(), main(), evio::Reader::scanBuffer(), evio::Reader::scanFile(), and evio::Reader::scanUncompressedBuffer().
bool evio::FileEventIndex::advance | ( | ) |
Advances the current event number by one.
If the event is not from current record, the record number will also be changed. If calling this would advance the current event number beyond its maximum limit, nothing is done.
Referenced by main().
bool evio::FileEventIndex::canAdvance | ( | ) | const |
Checks to see if the event counter reached the end.
References getMaxEvents().
Referenced by evio::Reader::hasNext().
bool evio::FileEventIndex::canRetreat | ( | ) | const |
Checks if the event index can retreat (decrease).
Convenience function.
Referenced by evio::Reader::hasPrev().
void evio::FileEventIndex::clear | ( | ) |
Clear the entire object.
Referenced by evio::Reader::forceScanFile(), evio::Reader::scanBuffer(), evio::Reader::scanFile(), evio::Reader::scanUncompressedBuffer(), and evio::Reader::setBuffer().
uint32_t evio::FileEventIndex::getEventNumber | ( | ) | const |
Gets the current event number which is set by advance(), retreat() or setEvent(uint32_t) (which also sets the record number that the event belongs to).
uint32_t evio::FileEventIndex::getMaxEvents | ( | ) | const |
Gets the total number of events in file.
Referenced by canAdvance(), evio::Reader::getEvent(), evio::Reader::getEventCount(), evio::Reader::getEventLength(), evio::Reader::getEventNode(), evio::Reader::getNextEventNode(), evio::Reader::getNumEventsRemaining(), setEvent(), show(), and toString().
uint32_t evio::FileEventIndex::getRecordEventNumber | ( | ) | const |
Gets the event number inside the record that corresponds to the current global event number from the file.
Referenced by evio::Reader::getEvent(), and evio::Reader::getEventLength().
uint32_t evio::FileEventIndex::getRecordNumber | ( | ) | const |
Gets the current record number which is set by setEvent(uint32_t), or by using advance() or retreat() (which set the event number to the next available or previous available respectively).
Referenced by evio::Reader::getEvent(), and evio::Reader::getEventLength().
int evio::FileEventIndex::main | ( | int | argc, |
char ** | argv | ||
) |
References addEventSize(), advance(), retreat(), setEvent(), show(), and toString().
void evio::FileEventIndex::resetIndex | ( | ) |
Resets the current index to 0.
The corresponding record number is recalculated by calling the setEvent(uint32_t) method.
References setEvent().
bool evio::FileEventIndex::retreat | ( | ) |
Reduces current event number by one.
If the record number changes, it returns true.
Referenced by main().
bool evio::FileEventIndex::setEvent | ( | uint32_t | event | ) |
Set the current event to the desired position.
The current record and event offset inside of the record are updated as well.
event | event number in the stream, must be 0 to getMaxEvents()-1. |
References getMaxEvents().
Referenced by evio::Reader::getEvent(), evio::Reader::getEventLength(), main(), and resetIndex().
void evio::FileEventIndex::show | ( | ) |
Prints the content of the event index array on the screen.
References getMaxEvents().
Referenced by main().
std::string evio::FileEventIndex::toString | ( | ) |
Get a string representation of this object.
References getMaxEvents().
Referenced by main().