HIPO  4.3.0
High Performance Output data format for experimental physics
hipo::readerIndex Class Reference

#include <reader.h>

Public Member Functions

 readerIndex ()=default
 
 ~readerIndex ()=default
 
bool canAdvance ()
 Check if there are more events to read. More...
 
bool advance ()
 Advance to the next event, loading new records as needed. More...
 
bool canAdvanceInRecord ()
 Check if more events remain in the current record. More...
 
bool loadRecord (int irec)
 Load a specific record by index. More...
 
bool gotoEvent (int eventNumber)
 Jump to a specific event number. More...
 
bool gotoRecord (int irec)
 Jump to a specific record. More...
 
int getEventNumber ()
 
int getRecordNumber ()
 
int getRecordEventNumber ()
 
int getMaxEvents ()
 
void addSize (int size)
 Register a record with the given number of events. More...
 
void addPosition (long position)
 Register a record position. More...
 
long getPosition (int index)
 
int getNRecords () const
 
void show ()
 Print index information to stdout. More...
 
void rewind ()
 Reset the index to the beginning (before the first event). More...
 
void clear ()
 Remove all record entries from the index. More...
 
void reset ()
 Reset counters to the first event of the first record. More...
 

Detailed Description

READER index class is used to construct entire events sequence from all records, and provides ability to canAdvance through events where record number is automatically calculated and triggers reading of the next record when events in the current record are exhausted.

Definition at line 163 of file reader.h.

Constructor & Destructor Documentation

◆ readerIndex()

hipo::readerIndex::readerIndex ( )
default

◆ ~readerIndex()

hipo::readerIndex::~readerIndex ( )
default

Member Function Documentation

◆ addPosition()

void hipo::readerIndex::addPosition ( long  position)
inline

Register a record position.

Parameters
positionByte offset of the record in the file

Definition at line 209 of file reader.h.

◆ addSize()

void hipo::readerIndex::addSize ( int  size)

Register a record with the given number of events.

Parameters
sizeNumber of events in the record

Adds record size (number of events) to the list of records.

Definition at line 462 of file reader.cpp.

◆ advance()

bool hipo::readerIndex::advance ( )

Advance to the next event, loading new records as needed.

Advances the event pointer to next. If the next event is in a different record the record number is updated and events number in the record is updated.

Returns
true - if the the next event is available, false - otherwise

Definition at line 484 of file reader.cpp.

◆ canAdvance()

bool hipo::readerIndex::canAdvance ( )

Check if there are more events to read.

Checks to determine if there are events left in the index buffer

Returns
true - if there are available events, false - otherwise

Definition at line 475 of file reader.cpp.

◆ canAdvanceInRecord()

bool hipo::readerIndex::canAdvanceInRecord ( )

Check if more events remain in the current record.

Checks to verify if the next event is in the same record as current one. Not sure why Derek needed it ;-), but may be it's useful

Returns
true - if the next event is in the same record, false - otherwise

Definition at line 581 of file reader.cpp.

◆ clear()

void hipo::readerIndex::clear ( )
inline

Remove all record entries from the index.

Definition at line 222 of file reader.h.

◆ getEventNumber()

int hipo::readerIndex::getEventNumber ( )
inline
Returns
The current global event number.

Definition at line 197 of file reader.h.

◆ getMaxEvents()

int hipo::readerIndex::getMaxEvents ( )
Returns
Total number of events across all records.

Returns maximum number of events available to read.

Returns
maximum number of events.

Definition at line 536 of file reader.cpp.

◆ getNRecords()

int hipo::readerIndex::getNRecords ( ) const
inline
Returns
Total number of records.

Definition at line 214 of file reader.h.

◆ getPosition()

long hipo::readerIndex::getPosition ( int  index)
inline
Returns
Byte position of the record at index.

Definition at line 211 of file reader.h.

◆ getRecordEventNumber()

int hipo::readerIndex::getRecordEventNumber ( )
inline
Returns
The event index within the current record.

Definition at line 201 of file reader.h.

◆ getRecordNumber()

int hipo::readerIndex::getRecordNumber ( )
inline
Returns
The current record number.

Definition at line 199 of file reader.h.

◆ gotoEvent()

bool hipo::readerIndex::gotoEvent ( int  eventNumber)

Jump to a specific event number.

Parameters
eventNumberGlobal event number

Definition at line 504 of file reader.cpp.

◆ gotoRecord()

bool hipo::readerIndex::gotoRecord ( int  irec)

Jump to a specific record.

Parameters
irecRecord index

Definition at line 545 of file reader.cpp.

◆ loadRecord()

bool hipo::readerIndex::loadRecord ( int  irec)

Load a specific record by index.

Parameters
irecRecord index

Implemented by Derek for clas12tool purposes (I think - therefore I am)

Definition at line 560 of file reader.cpp.

◆ reset()

void hipo::readerIndex::reset ( )
inline

Reset counters to the first event of the first record.

Definition at line 226 of file reader.h.

◆ rewind()

void hipo::readerIndex::rewind ( )
inline

Reset the index to the beginning (before the first event).

Definition at line 218 of file reader.h.

◆ show()

void hipo::readerIndex::show ( )

Print index information to stdout.

Definition at line 527 of file reader.cpp.


The documentation for this class was generated from the following files: