CPhysicsEventItem (abstract)

Name

CPhysicsEventItem (abstract) -- Encapsulate the data from a physics trigger.

Synopsis


#include <CPHysicsEventItem.h>

class CPhysicsEventItem : public CRingItem
{
public:
    CPhysicsEventItem(size_t maxBody=8192);
  
    virtual std::string typeName() const;	// Textual type of item.
    virtual std::string toString() const; // Provide string dump of the item.
    
    virtual void* getBodyHeader() const;
    virtual void setBodyHeader(uint64_t timestamp, uint32_t sourceId,
                         uint32_t barrierType = 0);
  
};
                

DESCRIPTION

CPHysicsEventItem is a ring item that encapsulates data from a physics trigger. As such, the body of the ring item has no defined format but can be in whatever format best suits the data from the trigger.

Note that event built data has a defined format that describes how fragments appear in the event however, again, the fragment payloads do not have a defined format.

METHODS

CPhysicsEventItem(size_t maxBody = 8192);

Constructs an item for a single physics trigger. Note that the storage size is statically allocated with maxBody bytes of payload data. The ring item header type field is initialized to PHYSICS_EVENT.

Upon creating the item normally, if a body header is required, setBodyHeader is invoked. getBodyCursor is then used get a pointer into the object at where the physics data should be put. After incrementing this pointer by an appopriate amount, calls to setBodyCursor, folowed by updateSize are required to set the size field of the ring item header.

const virtual std::string typeName();

Returns a string that represents the ring item type: Event

const virtual std::string toString();

Returns a string that represents the contents of the event. This is used, e.g., by the dumper command to render human readable data.

const virtual void* getBodyHeader();

Returns a pointer to the body header for the event. If the event has no body header, nullptr is returned. Note that the base class hasBodyHeader can be called to determine if the ring item type has a body header.

virtual void setBodyHeader(uint64_t timestamp, uint32_t sourceId, uint32_t barrierType = 0);

Inserts a new or modifies an existing body header of the event.