HIPO4 C++ Library 4.4.1
Columnar I/O library for CLAS12 physics data
Loading...
Searching...
No Matches
hipo::reader Class Reference

#include <reader.h>

Public Member Functions

 reader ()
 The constructor for reader, printWarning routine will printout a warning message if the library was not compiled with compression libraries LZ4 or GZIP.
 
 reader (const char *file)
 
 reader (const char *file, std::vector< int > tags)
 
 reader (const reader &r)
 
 ~reader ()
 Default destructor.
 
void about ()
 
void rewind ()
 
void readDictionary (hipo::dictionary &dict)
 Reads the dictionary for the file.
 
void getStructure (hipo::structure &structure, int group, int item)
 Reads the structure from the current event without copying the event buffer.
 
void getStructureNoCopy (hipo::structure &structure, int group, int item)
 Reads the structure from the current event without copying the event buffer and without copying the structure buffer.
 
void readUserConfig (std::map< std::string, std::string > &mapConfig)
 
void open (const char *filename)
 Open file, if file stream is open, it is closed first.
 
bool is_open ()
 
void setTags (int tag)
 
void setTags (std::vector< long > tags)
 
void setVerbose (short level=1)
 
bool hasNext ()
 Checks if there are more events in the file to advance to.
 
bool next ()
 Advances the event pointer to the next event.
 
bool gotoEvent (int eventNumber)
 Moves the pointer of the event to the event number provided.
 
bool gotoRecord (int irec)
 Moves the current event pointer to the new record # irec.
 
bool next (hipo::event &dataevent)
 Reads next event from the file, the event pointer is automatically advanced to the next event.
 
bool next (std::vector< hipo::bank > &list)
 
std::vector< hipo::bankgetBanks (std::vector< std::string > names)
 
void read (hipo::event &dataevent)
 Reads current event from the record without advancing the current event position.
 
void printWarning ()
 Prints out warning if the LZ4 library was not linked to the compiled library.
 
int getNRecords () const
 
bool nextInRecord ()
 
bool loadRecord (int irec)
 
bool loadRecord (hipo::record &record, int irec)
 
int getEntries ()
 
std::vector< int > getInt (const char *bank, const char *column, int max=-1)
 
std::vector< float > getFloat (const char *bank, const char *column, int max=-1)
 

Constructor & Destructor Documentation

◆ reader() [1/4]

hipo::reader::reader ( )

The constructor for reader, printWarning routine will printout a warning message if the library was not compiled with compression libraries LZ4 or GZIP.

◆ reader() [2/4]

hipo::reader::reader ( const char *  file)
inline

◆ reader() [3/4]

hipo::reader::reader ( const char *  file,
std::vector< int >  tags 
)
inline

◆ reader() [4/4]

hipo::reader::reader ( const reader r)
inline

◆ ~reader()

hipo::reader::~reader ( )

Default destructor.

Does nothing

Member Function Documentation

◆ about()

void hipo::reader::about ( )

◆ rewind()

void hipo::reader::rewind ( )
inline

◆ readDictionary()

void hipo::reader::readDictionary ( hipo::dictionary dict)

Reads the dictionary for the file.

C++ API is reading packed dictionary format from node (120,2), parses each schema and creates schema dictionary.

Parameters
dict- reference to dictionary object.

◆ getStructure()

void hipo::reader::getStructure ( hipo::structure structure,
int  group,
int  item 
)

Reads the structure from the current event without copying the event buffer.

Parameters
structure- reference to the stucture object
group- the group is for the structure.
item- item id for the structure.

◆ getStructureNoCopy()

void hipo::reader::getStructureNoCopy ( hipo::structure structure,
int  group,
int  item 
)

Reads the structure from the current event without copying the event buffer and without copying the structure buffer.

This should be used very carefully, since it sets the pointer of the structure directly to the buffer owned by the record. If new record is loaded this structure will be pointing to the wrong part of the buffer.

Parameters
structure- reference to the stucture object
group- the group is for the structure.
item- item id for the structure.

◆ readUserConfig()

void hipo::reader::readUserConfig ( std::map< std::string, std::string > &  mapConfig)

◆ open()

void hipo::reader::open ( const char *  filename)

Open file, if file stream is open, it is closed first.

At open time verification of file structure is performed. If the signature does not match EVIO/HIPO template, the file will be closed and warning message is printed.

Parameters
filename- name of the file to open

◆ is_open()

bool hipo::reader::is_open ( )
inline

◆ setTags() [1/2]

void hipo::reader::setTags ( int  tag)
inline

◆ setTags() [2/2]

void hipo::reader::setTags ( std::vector< long >  tags)
inline

◆ setVerbose()

void hipo::reader::setVerbose ( short  level = 1)
inline

◆ hasNext()

bool hipo::reader::hasNext ( )

Checks if there are more events in the file to advance to.

Returns
true if there are events left to read, false - otherwise

◆ next() [1/3]

bool hipo::reader::next ( )

Advances the event pointer to the next event.

This does not read an event, but if the event goes beyond boundary of the record the next record is loaded into the memody.

Returns
returns true - if the are events available in the file, false - otherwise

◆ gotoEvent()

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

Moves the pointer of the event to the event number provided.

If the event number is within the same record no reading is done, otherwise the appropriate record is loaded and event indicies are updated.

Parameters
eventNumber- number of event to jump to
Returns
true if event is available, false - otherwise

◆ gotoRecord()

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

Moves the current event pointer to the new record # irec.

The readerIndex is updated so current event is the first event in loaded record.

Parameters
irec- record number to jump to
Returns
true - if the record exists, false - otherwise

◆ next() [2/3]

bool hipo::reader::next ( hipo::event dataevent)

Reads next event from the file, the event pointer is automatically advanced to the next event.

Parameters
referenceto the event object to be filled from the record.
Returns
true if the event was successfully read, and false otherwise

◆ next() [3/3]

bool hipo::reader::next ( std::vector< hipo::bank > &  list)

◆ getBanks()

std::vector< hipo::bank > hipo::reader::getBanks ( std::vector< std::string >  names)

◆ read()

void hipo::reader::read ( hipo::event dataevent)

Reads current event from the record without advancing the current event position.

Multiple reads can be performed on the same event.

Parameters
referenceto the event object to be read

◆ printWarning()

void hipo::reader::printWarning ( )

Prints out warning if the LZ4 library was not linked to the compiled library.

In that case only uncompressed files can be read and written.

◆ getNRecords()

int hipo::reader::getNRecords ( ) const
inline

◆ nextInRecord()

bool hipo::reader::nextInRecord ( )

◆ loadRecord() [1/2]

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

◆ loadRecord() [2/2]

bool hipo::reader::loadRecord ( hipo::record record,
int  irec 
)

◆ getEntries()

int hipo::reader::getEntries ( )
inline

◆ getInt()

std::vector< int > hipo::reader::getInt ( const char *  bank,
const char *  column,
int  max = -1 
)

◆ getFloat()

std::vector< float > hipo::reader::getFloat ( const char *  bank,
const char *  column,
int  max = -1 
)

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