|
HIPO
4.3.0
High Performance Output data format for experimental physics
|
Builds HIPO records by accumulating events and compressing them. More...
#include <recordbuilder.h>
Public Member Functions | |
| recordbuilder (int maxEvents, int maxLength) | |
| Constructs a record builder with specified capacity. More... | |
| recordbuilder () | |
| Default constructor with default capacity. More... | |
| virtual | ~recordbuilder () |
| Virtual destructor. More... | |
| bool | addEvent (std::vector< char > &vec, int start, int length) |
| Adds an event from a raw byte vector. More... | |
| bool | addEvent (hipo::event &evnt) |
| Adds an event object to the record. More... | |
| long | getUserWordOne () |
| Returns the first user-defined word stored in the record header. More... | |
| long | getUserWordTwo () |
| Returns the second user-defined word stored in the record header. More... | |
| void | setUserWordOne (long userWordOne) |
| Sets the first user-defined word in the record header. More... | |
| void | setUserWordTwo (long userWordTwo) |
| Sets the second user-defined word in the record header. More... | |
| int | getRecordSize () |
| Returns the total size of the built record in bytes. More... | |
| int | getEntries () |
| Returns the number of events currently in the record. More... | |
| std::vector< char > & | getRecordBuffer () |
| Returns a reference to the internal record buffer. More... | |
| void | reset () |
| Resets the builder, clearing all accumulated events. More... | |
| void | build () |
| Compresses accumulated events and builds the final record. More... | |
Builds HIPO records by accumulating events and compressing them.
Events are added sequentially into internal buffers. Once all desired events have been added, build() compresses them into a single record that can be written to a HIPO file.
Definition at line 45 of file recordbuilder.h.
| hipo::recordbuilder::recordbuilder | ( | int | maxEvents, |
| int | maxLength | ||
| ) |
Constructs a record builder with specified capacity.
| maxEvents | Maximum number of events the record can hold. |
| maxLength | Maximum total byte length of event data. |
Constructor with custom max event size and maximum record size provided by user.
Definition at line 36 of file recordbuilder.cpp.
| hipo::recordbuilder::recordbuilder | ( | ) |
Default constructor with default capacity.
Default constructor sets number of max events to 100000 and the buffer size to 8MB.
Definition at line 24 of file recordbuilder.cpp.
|
inlinevirtual |
Virtual destructor.
Definition at line 77 of file recordbuilder.h.
| bool hipo::recordbuilder::addEvent | ( | hipo::event & | evnt | ) |
Adds an event object to the record.
| evnt | The HIPO event to add. |
add event object to the record builder buffer.
Definition at line 48 of file recordbuilder.cpp.
| bool hipo::recordbuilder::addEvent | ( | std::vector< char > & | vec, |
| int | start, | ||
| int | length | ||
| ) |
Adds an event from a raw byte vector.
| vec | Source byte vector containing event data. |
| start | Starting offset within the vector. |
| length | Number of bytes to copy. |
add a content of a vector to the record builder buffer. offset in the buffer and number of bytes to add provided by user.
Definition at line 56 of file recordbuilder.cpp.
| void hipo::recordbuilder::build | ( | ) |
Compresses accumulated events and builds the final record.
Definition at line 117 of file recordbuilder.cpp.
| int hipo::recordbuilder::getEntries | ( | ) |
Returns the number of events currently in the record.
Returns number of events in the record.
Definition at line 87 of file recordbuilder.cpp.
|
inline |
Returns a reference to the internal record buffer.
Definition at line 117 of file recordbuilder.h.
| int hipo::recordbuilder::getRecordSize | ( | ) |
Returns the total size of the built record in bytes.
returns the size of the record.
Definition at line 94 of file recordbuilder.cpp.
| long hipo::recordbuilder::getUserWordOne | ( | ) |
Returns the first user-defined word stored in the record header.
Definition at line 99 of file recordbuilder.cpp.
| long hipo::recordbuilder::getUserWordTwo | ( | ) |
Returns the second user-defined word stored in the record header.
Definition at line 104 of file recordbuilder.cpp.
| void hipo::recordbuilder::reset | ( | ) |
Resets the builder, clearing all accumulated events.
Resets the counters for number of events and sets the position for writing new events to the begining of the event buffer.
Definition at line 70 of file recordbuilder.cpp.
| void hipo::recordbuilder::setUserWordOne | ( | long | userWordOne | ) |
Sets the first user-defined word in the record header.
| userWordOne | The value to set. |
Definition at line 109 of file recordbuilder.cpp.
| void hipo::recordbuilder::setUserWordTwo | ( | long | userWordTwo | ) |
Sets the second user-defined word in the record header.
| userWordTwo | The value to set. |
Definition at line 113 of file recordbuilder.cpp.