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

#include <bank.h>

+ Inheritance diagram for hipo::composite:

Public Member Functions

 composite ()
 Default constructor. More...
 
 composite (int size)
 
 composite (int group, int item, int size)
 
 composite (const char *format)
 
 composite (int group, int item, const char *format, int capacity)
 Construct a composite with group, item, format, and capacity. More...
 
void parse (std::string format)
 
void parse (int group, int item, std::string format, int maxrows)
 
virtual ~composite ()
 
int getRows () const noexcept
 
int getEntries () const noexcept
 
int getEntryType (int index) const noexcept
 
void setRows (int rows)
 
int getRowSize () const noexcept
 
int getInt (int element, int row) const noexcept
 
int64_t getLong (int element, int row) const noexcept
 
float getFloat (int element, int row) const noexcept
 
void putInt (int element, int row, int value)
 
void putLong (int element, int row, int64_t value)
 
void putFloat (int element, int row, float value)
 
virtual void notify ()
 Called when the composite is updated (e.g., after reading an event). More...
 
void print ()
 Print the composite contents to standard output. More...
 
void reset ()
 Reset the composite to an empty state. More...
 
- Public Member Functions inherited from hipo::node
 node ()
 Default constructor; allocates an 8-byte header. More...
 
 node (std::tuple< int, int, int, int > params)
 Construct a node from a parameter tuple. More...
 
 node (int size)
 Construct a node with a pre-allocated data region. More...
 
virtual ~node ()=default
 
void assign (std::tuple< int, int, int, int > params)
 Re-initialize this node from a parameter tuple. More...
 
bool allocate (int size)
 Ensure the internal buffer can hold at least size bytes. More...
 
int size () const noexcept
 
int capacity () const noexcept
 
int formatLength () const noexcept
 
void setFormatLength (int length)
 Set the format descriptor length. More...
 
void setDataLength (int length)
 Set the data payload length, preserving the format length. More...
 
int dataLength () const noexcept
 
int nodeLength ()
 
void setNodeLength (int size)
 Set the total node length in the header word. More...
 
int dataOffset () const noexcept
 
int group ()
 
int item ()
 
int type ()
 
const char * pointer ()
 
virtual void show ()
 Print a summary of this node to stdout. More...
 
void setSize (int size)
 Set the total size of the node. More...
 
int getIntAt (int index) const noexcept
 Read a 32-bit integer at the given byte offset within the data region. More...
 
int16_t getShortAt (int index) const noexcept
 Read a 16-bit integer at the given byte offset within the data region. More...
 
int8_t getByteAt (int index) const noexcept
 Read an 8-bit integer at the given byte offset within the data region. More...
 
float getFloatAt (int index) const noexcept
 Read a 32-bit float at the given byte offset within the data region. More...
 
double getDoubleAt (int index) const noexcept
 Read a 64-bit double at the given byte offset within the data region. More...
 
long getLongAt (int index) const noexcept
 Read a 64-bit integer at the given byte offset within the data region. More...
 
void putIntAt (int index, int value)
 Write a 32-bit integer at the given byte offset within the data region. More...
 
void putShortAt (int index, int16_t value)
 Write a 16-bit integer at the given byte offset within the data region. More...
 
void putByteAt (int index, int8_t value)
 Write an 8-bit integer at the given byte offset within the data region. More...
 
void putFloatAt (int index, float value)
 Write a 32-bit float at the given byte offset within the data region. More...
 
void putDoubleAt (int index, double value)
 Write a 64-bit double at the given byte offset within the data region. More...
 
void putLongAt (int index, int64_t value)
 Write a 64-bit integer at the given byte offset within the data region. More...
 

Additional Inherited Members

- Protected Member Functions inherited from hipo::node
void create (int group, int item, int type, int size)
 Create a node with the given header fields and allocate storage. More...
 
void init (const char *b, int length)
 Initialize the node by copying raw bytes into the internal buffer. More...
 
void initEmpty ()
 Initialize the node to an empty state. More...
 

Detailed Description

Definition at line 241 of file bank.h.

Constructor & Destructor Documentation

◆ composite() [1/5]

hipo::composite::composite ( )
inline

Default constructor.

Definition at line 260 of file bank.h.

◆ composite() [2/5]

hipo::composite::composite ( int  size)
inline

Construct a composite and allocate the given number of bytes.

Parameters
sizethe number of bytes to allocate

Definition at line 263 of file bank.h.

◆ composite() [3/5]

hipo::composite::composite ( int  group,
int  item,
int  size 
)
inline

Construct a composite with a group, item, and size.

Parameters
groupthe group identifier
itemthe item identifier
sizethe allocation size

Definition at line 268 of file bank.h.

◆ composite() [4/5]

hipo::composite::composite ( const char *  format)
inline

Construct a composite from a format string.

Parameters
formatthe format descriptor string

Definition at line 271 of file bank.h.

◆ composite() [5/5]

hipo::composite::composite ( int  group,
int  item,
const char *  format,
int  capacity 
)

Construct a composite with group, item, format, and capacity.

Parameters
groupthe group identifier
itemthe item identifier
formatthe format descriptor string
capacitythe maximum number of rows

Definition at line 157 of file bank.cpp.

◆ ~composite()

virtual hipo::composite::~composite ( )
inlinevirtual

Definition at line 290 of file bank.h.

Member Function Documentation

◆ getEntries()

int hipo::composite::getEntries ( ) const
inlinenoexcept
Returns
the number of entries (columns) per row.

Definition at line 298 of file bank.h.

◆ getEntryType()

int hipo::composite::getEntryType ( int  index) const
inlinenoexcept
Returns
the type code of the entry at the given index.
Parameters
indexthe entry index

Definition at line 301 of file bank.h.

◆ getFloat()

float hipo::composite::getFloat ( int  element,
int  row 
) const
noexcept
Returns
the float value at the given element and row.
Parameters
elementthe column index
rowthe row index

Definition at line 243 of file bank.cpp.

◆ getInt()

int hipo::composite::getInt ( int  element,
int  row 
) const
noexcept
Returns
the integer value at the given element and row.
Parameters
elementthe column index
rowthe row index

Definition at line 216 of file bank.cpp.

◆ getLong()

int64_t hipo::composite::getLong ( int  element,
int  row 
) const
noexcept
Returns
the 64-bit integer value at the given element and row.
Parameters
elementthe column index
rowthe row index

Definition at line 233 of file bank.cpp.

◆ getRows()

int hipo::composite::getRows ( ) const
inlinenoexcept
Returns
the number of bank rows. This is the number of all of the rows, not the reduced number if, e.g., hipo::bank::rowlist::filter was called; for the latter, use hipo::bank::getRowList().size().

Definition at line 295 of file bank.h.

◆ getRowSize()

int hipo::composite::getRowSize ( ) const
inlinenoexcept
Returns
the size of a single row in bytes.

Definition at line 307 of file bank.h.

◆ notify()

void hipo::composite::notify ( )
virtual

Called when the composite is updated (e.g., after reading an event).

Reimplemented from hipo::node.

Definition at line 284 of file bank.cpp.

◆ parse() [1/2]

void hipo::composite::parse ( int  group,
int  item,
std::string  format,
int  maxrows 
)

Parse and initialize with group, item, format, and maximum rows.

Parameters
groupthe group identifier
itemthe item identifier
formatthe format descriptor string
maxrowsthe maximum number of rows

Definition at line 175 of file bank.cpp.

◆ parse() [2/2]

void hipo::composite::parse ( std::string  format)

Parse a format string to determine entry types and offsets.

Parameters
formatthe format descriptor string

Definition at line 162 of file bank.cpp.

◆ print()

void hipo::composite::print ( )

Print the composite contents to standard output.

Definition at line 309 of file bank.cpp.

◆ putFloat()

void hipo::composite::putFloat ( int  element,
int  row,
float  value 
)

Store a float value at the given element and row.

Parameters
elementthe column index
rowthe row index
valuethe value to store

Definition at line 275 of file bank.cpp.

◆ putInt()

void hipo::composite::putInt ( int  element,
int  row,
int  value 
)

Store an integer value at the given element and row.

Parameters
elementthe column index
rowthe row index
valuethe value to store

Definition at line 253 of file bank.cpp.

◆ putLong()

void hipo::composite::putLong ( int  element,
int  row,
int64_t  value 
)

Store a 64-bit integer value at the given element and row.

Parameters
elementthe column index
rowthe row index
valuethe value to store

Definition at line 267 of file bank.cpp.

◆ reset()

void hipo::composite::reset ( )
virtual

Reset the composite to an empty state.

Reimplemented from hipo::node.

Definition at line 150 of file bank.cpp.

◆ setRows()

void hipo::composite::setRows ( int  rows)

Set the number of rows by adjusting the data length.

Parameters
rowsthe number of rows

Definition at line 166 of file bank.cpp.


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