gdata
Loading...
Searching...
No Matches
GFrameDataCollection Class Reference

#include <gFrameDataCollection.h>

Public Member Functions

 GFrameDataCollection (GFrameHeader *header, std::shared_ptr< GLogger > logger)
 Construct a frame data collection.
 
 ~GFrameDataCollection ()
 Destructor.
 
void addIntegralPayload (std::vector< int > payload) const
 Add one integral payload to this frame.
 
void addEvent (int evn)
 Placeholder for adding event-level information into the frame.
 
bool shouldWriteFrame () const
 Placeholder decision hook: should this frame be emitted/written?
 
const GFrameHeadergetHeader () const
 Get the owned frame header (read-only).
 
const std::vector< GIntegralPayload * > * getIntegralPayload () const
 Get the stored payload pointers (read-only).
 
long int getFrameID () const
 Convenience getter for frame ID.
 

Detailed Description

Definition at line 32 of file gFrameDataCollection.h.

Constructor & Destructor Documentation

◆ GFrameDataCollection()

GFrameDataCollection::GFrameDataCollection ( GFrameHeader * header,
std::shared_ptr< GLogger > logger )
inline

Ownership:

  • header is adopted by this object and deleted in the destructor.

Internal storage:

  • The payload pointer vector is allocated on the heap for historical reasons.
Parameters
headerFrame header pointer. Ownership is transferred to this object.
loggerLogger instance used for diagnostics.

Definition at line 48 of file gFrameDataCollection.h.

◆ ~GFrameDataCollection()

GFrameDataCollection::~GFrameDataCollection ( )
inline

Deletes in the following order:

  • the owned frame header
  • all owned payload pointers
  • the payload vector container
Warning
Any pointers previously returned by getHeader() or getIntegralPayload() become invalid after destruction.

Definition at line 67 of file gFrameDataCollection.h.

Member Function Documentation

◆ addEvent()

void GFrameDataCollection::addEvent ( int evn)

Intended usage (future):

  • accept an event number (or event object)
  • integrate it into this frame's payload list (collect channels hit during the frame window)
Parameters
evnEvent number.

◆ addIntegralPayload()

void GFrameDataCollection::addIntegralPayload ( std::vector< int > payload) const
inline

The payload is passed as a vector to support a generic "packed" interface, typically used when data come from external buffers or electronics emulators.

Expected layout (size must be exactly 5):

  • payload[0] = crate
  • payload[1] = slot
  • payload[2] = channel
  • payload[3] = charge
  • payload[4] = time

On success:

On failure:

Parameters
payloadPacked payload vector (must have size 5).

Definition at line 97 of file gFrameDataCollection.h.

◆ getFrameID()

long int GFrameDataCollection::getFrameID ( ) const
inline

Equivalent to calling getFrameID() on the owned header.

Returns
Frame ID as stored in the header.

Definition at line 171 of file gFrameDataCollection.h.

◆ getHeader()

const GFrameHeader * GFrameDataCollection::getHeader ( ) const
inline

The returned pointer remains valid as long as this GFrameDataCollection exists. The header is owned by this object and must not be deleted by the caller.

Returns
Pointer to the frame header (owned by this object).

Definition at line 148 of file gFrameDataCollection.h.

◆ getIntegralPayload()

const std::vector< GIntegralPayload * > * GFrameDataCollection::getIntegralPayload ( ) const
inline

The returned pointers:

  • are owned by this object
  • remain valid only as long as the collection exists
  • must not be deleted by the caller
Returns
Pointer to the internal payload vector.

Definition at line 161 of file gFrameDataCollection.h.

◆ shouldWriteFrame()

bool GFrameDataCollection::shouldWriteFrame ( ) const

Intended usage (future):

  • decide whether enough data has accumulated (or time window has elapsed)
  • trigger writing this frame to an output stream
Returns
True if frame should be written.

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