#include <CRingFragmentItem.h>
class CRingFragmentItem : public CRingItem {
}
CRingFragmentItem(uint64_t timestamp, uint32_t source, uint32_t payloadSize, const void* pBody, uint32_t barrier = 0);
CRingFragmentItem(const CRingItem& rhs) throws std::bad_cast;
CRingFragmentItem(const CRingFragmentItem& rhs);
virtual ~CRingFragmentItem();
CRingFragmentItem& operator=(const CRingFragmentItem& rhs);
const int operator==(const CRingFragmentItem& rhs);
const int operator!=(const CRingFragmentItem& rhs);
// accessors.const uint64_t timestamp();
const uint32_t source();
const size_t payloadSize();
const const void* payloadPointer();
const uint32_t barrierType();
virtual const std::string typeName();
virtual const std::string toString();
};
Objects of this class encapsulate a EVB_FRAGMENT ring item. These items are intended to be strung together into events by an event builder. Placing them in a ring allows for a test point.
Since this class is derived from
CRingItem,
you can create ring items and then commit them to an existing
ring via calls to
CRingItem
::commitToRing
.
Similarly calls to
CRingItem
::getFromRing
.
allow you to get a ring item and then, when you determine from the
item type this is an event fragment, construct a
CRingFragmentItem
from that item.
For a full description of the methods available, see both CRingItem's manpage, and the METHODS section below.
CRingFragmentItem(uint64_t timestamp, uint32_t source, uint32_t payloadSize, const void* pBody, uint32_t barrier = 0);
Construct an event fragment ring item. This constructor
is normally used prior to inserting fragment item
into a ring buffer via
CRingItem
::commitToRing
.
The parameters are pretty much self explanatory.
The default on the barrier
parameter is correct for fragments that are not part
of barrier synchronization.
The timestamp
parameter is the
timestamp that will be associated with the fragment.
The source
parameter identifies
the source of the fragment. The payloadSize
parameter is the number of bytes of payload data that
will be copied into the ring item from
pBody
. barrier
is non-zero for barrier fragments and zero if
'normal' non-barrier fragments.
CRingFragmentItem(const CRingItem& rhs)
throws std::bad_cast;
Constructs a fragment ring item from a
CRingItem
. This is normally
used after a call from
CRingItem
::getFromRing
that returned a CRingItem
object
whose type is EVB_FRAGMENT.
The construction then allows your software to get the values of fields of the fragment ring item via the accessor methods described later in this ssection.
CRingFragmentItem(const CRingFragmentItem& rhs);
Copy constructor for ring fragment items. If you find
yourself doing a lot of copy construction, you should
re-think your code and possibly have
CRingFragmentItem
objects
passed by pointer or reference to your functions/methods.
virtual ~CRingFragmentItem();
Destroys a CRingFragmentItem
and frees any dynamic storage that's associated with
it.
CRingFragmentItem& operator=(const CRingFragmentItem& rhs);
Assigns the rhs
to
*this
. Any dynamic storage associated
with this
prior to the assignment
is disposed of and it is possible that additional dynamic
storage will be allocated to satisfy the needs of the
assignment.
const int operator==(const CRingFragmentItem& rhs);
Tests for equality. The payload is not included in the test. If the timestamp, event source barrier type and payload size are equal the ring items are assumed to be equal. This is because there are real problems with an experimental setup that allows more than one fragment to have the same timestamp (except for barriers and non timestamped other items).
const int operator!=(const CRingFragmentItem& rhs);
Returns true if
operator==
returns
false and vica versa.
const uint64_t timestamp();
Accessor method that returns the value of the item's timestamp.
const uint32_t source();
Accessor method that returns the value of the item's source id.
const size_t payloadSize();
Accessor mehthod that returns the size of the item's
payload. Using this and payloadPointer
allows complete access to the object's payload.
const const void* payloadPointer();
Accessor method that returns a pointer to the item's
payload. With this method and
payloadSize
you can access the
contents of the payload.
const uint32_t barrierType();
Accessor method that returns the barrier type field of the item.
virtual const std::string typeName();
Returns a stringified version of the ring item type. This is Event fragment
virtual const std::string toString();
Returns a stringified version of the event fragment. This includes inormation in the body h eader and a formatted dump of the payload. If the payload is recognizable as a ring item it is dumped as a formatted ring item, otherwise a straight byte by byte hex dump of the payload is performed.