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

Represents a single HIPO record containing multiple events. More...

#include <record.h>

Public Member Functions

 record ()
 Construct an empty record. More...
 
 ~record ()
 Destructor. More...
 
void read (hipo::bank &b, int event)
 Read a specific bank from a given event in this record. More...
 
void readRecord (std::ifstream &stream, long position, int dataOffset)
 Read a record from a file stream at the specified position. More...
 
void readRecord__ (std::ifstream &stream, long position, long recordLength)
 Read a record using its total length (internal variant). More...
 
bool readRecord (std::ifstream &stream, long position, int dataOffset, long inputSize)
 Read a record with an explicit input-size boundary check. More...
 
int getEventCount ()
 Return the number of events stored in this record. More...
 
int getRecordSizeCompressed ()
 Return the compressed size of this record in bytes. More...
 
void getColumn (hipo::data &data, int column, hipo::bank &bank, int event)
 Extract a single column from a bank for a given event. More...
 
void getColumn (hipo::data &data, const char *column, hipo::bank &bank, int event)
 Extract a single column by name from a bank for a given event. More...
 
void readEvent (std::vector< char > &vec, int index)
 Read raw event bytes into a vector. More...
 
void readHipoEvent (hipo::event &event, int index)
 Read an event and populate a hipo::event object. More...
 
void getData (hipo::data &data, int index)
 Get a lightweight data handle for a specific event. More...
 
void getEventsMap (std::vector< std::pair< int, int >> &emap)
 Build a map of event positions (offset, length pairs). More...
 
hipo::benchmarkgetReadBenchmark ()
 Return a reference to the read-operation benchmark. More...
 
hipo::benchmarkgetUnzipBenchmark ()
 Return a reference to the decompression benchmark. More...
 
hipo::benchmarkgetIndexBenchmark ()
 Return a reference to the index-building benchmark. More...
 

Detailed Description

Represents a single HIPO record containing multiple events.

Handles reading a record from a file stream, decompressing its payload, and providing access to individual events stored within it.

Definition at line 196 of file record.h.

Constructor & Destructor Documentation

◆ record()

hipo::record::record ( )
default

Construct an empty record.

◆ ~record()

hipo::record::~record ( )
default

Destructor.

Member Function Documentation

◆ getColumn() [1/2]

void hipo::record::getColumn ( hipo::data data,
const char *  column,
hipo::bank bank,
int  event 
)

Extract a single column by name from a bank for a given event.

Parameters
dataOutput data object to populate.
columnColumn name.
bankBank from which to extract the column.
eventZero-based event index.

Definition at line 430 of file record.cpp.

◆ getColumn() [2/2]

void hipo::record::getColumn ( hipo::data data,
int  column,
hipo::bank bank,
int  event 
)

Extract a single column from a bank for a given event.

Parameters
dataOutput data object to populate.
columnZero-based column index.
bankBank from which to extract the column.
eventZero-based event index.

Definition at line 435 of file record.cpp.

◆ getData()

void hipo::record::getData ( hipo::data data,
int  index 
)

Get a lightweight data handle for a specific event.

Parameters
dataOutput data object pointing into the record buffer.
indexZero-based event index within the record.

returns a data object that points to the event inside of the record. For given index the data object will be filled with the pointer to the position in the buffer where the event starts and with the size indicating length of the event.

Definition at line 411 of file record.cpp.

◆ getEventCount()

int hipo::record::getEventCount ( )

Return the number of events stored in this record.

returns number of events in the record.

Definition at line 393 of file record.cpp.

◆ getEventsMap()

void hipo::record::getEventsMap ( std::vector< std::pair< int, int >> &  emap)

Build a map of event positions (offset, length pairs).

Parameters
emapOutput vector of (offset, length) pairs for each event.

Definition at line 463 of file record.cpp.

◆ getIndexBenchmark()

hipo::benchmark& hipo::record::getIndexBenchmark ( )
inline

Return a reference to the index-building benchmark.

Definition at line 305 of file record.h.

◆ getReadBenchmark()

hipo::benchmark& hipo::record::getReadBenchmark ( )
inline

Return a reference to the read-operation benchmark.

Definition at line 301 of file record.h.

◆ getRecordSizeCompressed()

int hipo::record::getRecordSizeCompressed ( )

Return the compressed size of this record in bytes.

Definition at line 279 of file record.cpp.

◆ getUnzipBenchmark()

hipo::benchmark& hipo::record::getUnzipBenchmark ( )
inline

Return a reference to the decompression benchmark.

Definition at line 303 of file record.h.

◆ read()

void hipo::record::read ( hipo::bank b,
int  event 
)

Read a specific bank from a given event in this record.

Parameters
bBank to populate with the read data.
eventZero-based event index within the record.

Definition at line 424 of file record.cpp.

◆ readEvent()

void hipo::record::readEvent ( std::vector< char > &  vec,
int  index 
)

Read raw event bytes into a vector.

Parameters
vecOutput vector to fill with event data.
indexZero-based event index within the record.

reads content of the event with given index into a vector vector will be resized to fit the data. The resulting size of the vector can be used to veryfy the successfull read.

Definition at line 401 of file record.cpp.

◆ readHipoEvent()

void hipo::record::readHipoEvent ( hipo::event event,
int  index 
)

Read an event and populate a hipo::event object.

Parameters
eventOutput event to populate.
indexZero-based event index within the record.

Definition at line 485 of file record.cpp.

◆ readRecord() [1/2]

void hipo::record::readRecord ( std::ifstream &  stream,
long  position,
int  dataOffset 
)

Read a record from a file stream at the specified position.

Parameters
streamInput file stream.
positionByte offset in the file where the record starts.
dataOffsetOffset to the data section within the record.

Read

converting index array from lengths of each buffer in the record to relative positions in the record stream.

Definition at line 61 of file record.cpp.

◆ readRecord() [2/2]

bool hipo::record::readRecord ( std::ifstream &  stream,
long  position,
int  dataOffset,
long  inputSize 
)

Read a record with an explicit input-size boundary check.

Parameters
streamInput file stream.
positionByte offset in the file.
dataOffsetOffset to the data section within the record.
inputSizeMaximum number of bytes available for reading.
Returns
true if the record was read successfully, false otherwise.

converting index array from lengths of each buffer in the record to relative positions in the record stream.

Definition at line 164 of file record.cpp.

◆ readRecord__()

void hipo::record::readRecord__ ( std::ifstream &  stream,
long  position,
long  recordLength 
)

Read a record using its total length (internal variant).

Parameters
streamInput file stream.
positionByte offset in the file.
recordLengthTotal length of the record in bytes.

converting index array from lengths of each buffer in the record to relative positions in the record stream.

Definition at line 283 of file record.cpp.


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