#include <RingFormatHelper.h> class CRingFormatHelper { public: CRingFormatHelper(); virtual ~CRingFormatHelper(); CRingFormatHelper(const CRingFormatHelper&); CRingFormatHelper& operator=(const CRingFormatHelper&); int operator==(const CRingFormatHelper&) const; int operator!=(const CRingFormatHelper&) const; public: virtual bool hasBodyHeader(void* pItem) const = 0; virtual void* getBodyPointer(void* pItem) = 0; virtual void* getBodyHeaderPointer(void* pItem) = 0; virtual std::string getTitle(void* pItem) = 0; virtual unsigned getRunNumber( void* pItem, BufferTranslator* pTranslator) = 0; virtual unsigned getStringCount( void* pItem, BufferTranslator* pTranslator) = 0; virtual unsigned getScalerCount( void* pItem, BufferTranslator* pTranslator) = 0; virtual uint64_t getTriggerCount( void* pItem, BufferTranslator* pTranslator) = 0; uint16_t itemType(void* pItem); }; #include <RingFormatHelper10.h> class CRingFormatHelper10; #include <RingFormatHelper11.h> class CRingFormatHelper11;
Ring buffer data comes in more than one format, depending on the actual version of NSCLDAQ that emitted it. Ring format helpers are classes that know how to untangle data from specific versions of NSCL Ring buffer data acquisition systems.
CRingFormatHelper
is an abstract base class
that provides the interface that the
CRingBufferDecoder
class expects these helpers
to implement.
SpecTcl provides two concrete implementations of this class:
CRingFormatHelper10
which
helps the Ring buffer decoder handle NSCLDAQ10 data (data)
that has no provision for body headers.
CRingFormatHelper11
which
helps with data from NSCLDAQ11, which does have a provision
for body headers that can assist the event builder.
These helper classes offer no additional public methods beyond those
specified by CRingFormatHelper
. Therefore
we will not document them further.
For brevity, only the non-canonicals are described here.
virtual const = 0 bool hasBodyHeader(void* pItem);
Determines if the ring item pointed to by
pItem
contains a body header.
Body headers contain additional fixed format data prior
to the body of the ring item but after the ring item header
itself.
For example in NSCLDAQ 11.x, body headers, if present, contain a timestamp for the item, the source id of the item and a barrier type. NSCLDAQ 11.x may also emit ring items without body headers.
Note that if the version of NSCLDAQ emitting this item does not support body headers, this always returns false
virtual = 0 void* getBodyPointer(void* pItem);
Returns a pointer to the ring item body for the
item pointed to by pItem
.
Note that
in the presence of body headers, this pointer will
point past the body header to the actual body data itself.
virtual = 0; void* getBodyHeaderPointer(void* pItem);
Returns a pointer to the body header of the
ring item:
pItem
.
If pItem
does not have a body
header (hasBodyHeader
returns
false), this will return a
nullptr.
virtual = 0 std::string getTitle(void* pItem);
If pItem
points to a state
transition item, the title is returned from that item.
If pItem
does not point to
a state transition item, a
std::string exception is thrown containing
an appropriate error message.
virtual = 0 unsigned getRunNumber(void* pItem, BufferTranslator* pTranslator);
If pItem
points to a
state transition ring item, this method returns
the run number from that item. If not a
std::string exception
is thrown. The contents of that string are
a human readable error message.
pTranslator
points to the
appropriate buffer translator and is used to transform
the run number in the byte ordering of the producing
system to that of the system running SpecTcl.
virtual = 0 unsigned getStringCount(void* pItem, BufferTranslator* pTranslator);
If the ring item pointed to by
pItem
is a Text item
ring item, method returns the number of strings
this item has.
If the item is not a text ring item, a
std::string exception is thrown
containing a human readable error message.
pTranslator
is used to translate
any string count from the byte ordering of the
producing system to the byte order of the system
running SpecTcl.
virtual = 0 unsigned getScalerCount(void* pItem, BufferTranslator* pTranslator);
If pItem
points to a scaler item,
this method returns the number of counters in that
item. If
pItem
does not point to a
scaler item, a std::string exception is
thrown.
pTranslator
is used to transform
the count from the byte order of the producing system
to they byte order of the system that is running SpecTcl.
virtual = 0 uint64_t getTriggerCount(void* pItem, BufferTranslator* pTranslator);
If pItem
points to a physics
event count item, this method returns the number
of triggers accepted by the run so far. If
pItem
is not a physics event
count item, a std::string exception is
thrown.
pItem
is used to convert
the trigger count from the byte order of the
producing system to the byte order of the system
running SpecTcl.
uint16_t itemType(void* pItem);
Returns the ring item type for the ring item pointed
to by pItem
.