Page History
...
The Xtc package defines several classes.
Class Xtc
This class defines a container for data stored in an An xtc file . An event is a collection of such containers. The size and location of the unspecified data contained are defined by the "sizeofPayload" and "payload" functions. To iterate over a set of such containers see "XtcIterator.hh".
Public Member Functions:
Constructors:
datagrams (Dgram).
A datagram contains: Sequence, Env and Xtc.
Code Block |
---|
//Constructor used to create an empty, unlabeled Xtc()Dgram : damage(0), extent(0) {}; // Copy constructor, will copy everything, but NOT the payload. Xtc(const Xtc& xtc) : -------------------------------------- | | damage(xtc.damage), src(xtc.src), contains(xtc.contains), extent(sizeof(Xtc)) {} // | Sequence Xtc(const TypeId& type) : Env damage(0), contains(type), extent(sizeof(Xtc)) {} Xtc(const TypeId& type, const Src& _src) : damage(0), src(_src), contains(type), extent(sizeof(Xtc |
Class Xtc
This class defines a container for data stored in an xtc file. An event is a collection of such containers. The size and location of the unspecified data contained are defined by the "sizeofPayload" and "payload" functions. To iterate over a set of such containers see "XtcIterator.hh".
Public Member Functions:
Constructors:
Code Block |
---|
//Constructor used to create an empty, unlabeled Xtc() : damage(0), extent(0) {};)) {} Xtc(const TypeId& _tag, const Src& _src, unsigned _damage) : damage(_damage), src(_src), contains(_tag), extent(sizeof(Xtc)) {} Xtc(const TypeId& _tag, const Src& _src, const Damage& _damage) : // Copy constructor, will copy everything, but NOT the payload. Xtc(const Xtc& xtc) : damage(_xtc.damage), src(_xtc.src), contains(_tagxtc.contains), extent(sizeof(Xtc)) {} |
Overloaded allocation operators to allow the insertion of a dummy "Xtc" within a datagram.
Code Block |
---|
void* operator new(size_t size, char* p) // Xtc(const TypeId& type) : { return (void*)p; } damage(0), contains(type), extent(sizeof(Xtc)) {} void* operator new(size_t size, Xtc* p) Xtc(const TypeId& type, const Src& _src) : { return p->alloc(size); } |
Code Block |
// Return a pointer (of unspecified type) to the payload associated with this classdamage(0), src(_src), contains(type), extent(sizeof(Xtc)) {} Xtc(const TypeId& _tag, const Src& _src, unsigned _damage) : char* damage(_damage), src(_src), payload() const { return (char*)(this+1); contains(_tag), extent(sizeof(Xtc)) {} // Return the size (in bytes) of the payload associated with the class.Xtc(const TypeId& _tag, const Src& _src, const Damage& _damage) : int damage(_damage), sizeofPayload() const { return extent - src(_src), contains(_tag), extent(sizeof(Xtc);) {} |
Overloaded allocation operators to allow the insertion of a dummy "Xtc" within a datagram.
Code Block |
---|
//void* Return the Xtc which is immediately following an object of this class.operator new(size_t size, char* p) { return (void*)p; } Xtcvoid* operator new(size_t size, next(Xtc* p) { return (Xtc*)((char*)this+extent)p->alloc(size); } |
Code Block |
---|
const// Xtc* next() const { return (const Xtc*)((char*)this+extent); } void* alloc(uint32_t size) { void* buffer = next(); extent += size; return buffer; } |
Public Attributes:
Code Block |
---|
Damage damage; SrcReturn a pointer (of unspecified type) to the payload associated with this class char* payload() const { return (char*)(this+1); } // Return the size (in bytes) of the payload associated with the class. int src; TypeId contains; sizeofPayload() const { return extent - sizeof(Xtc); } uint32_t extent; |
Class XtcIterator
This is an abstract class.
This class allows iteration over a collection of "Xtc" objects. An "event" generated from DataFlow consists of data described by a collection of "Xtc" objects. Therefore, this class is instrumental in the navigation of an event's data. The set of "Xtc"s is determined by passing (typically to the constructor) a root "Xtc" which describes the collection of "Xtc"s to process. This root, for example is provided by an event's datagram. As this is an Abstract-Base-Class, it is expected that an application will subclass from this class, providing an implementation of the "process" method. This method will be called back for each "Xtc" in the collection. Note that the "Xtc" to process is passed as an argument. If the "process" method wishes to abort the iteration a zero (0) value is returned. The iteration is initiated by calling the "iterate" member function.
Public Member Functions:
Constructors and destructor:
Code Block |
---|
XtcIterator(Xtc* root);
XtcIterator() {}
virtual ~XtcIterator() {}
|
The first constructor takes an argument the "Xtc" which defines the collection to iterate over.
Code Block |
---|
virtual int process(Xtc* xtc) = 0;
|
This function is pure virtual and must be implemented by all derived classes.
Code Block |
---|
void iterate();
|
This function commences iteration over the collection specified by the constructor.
Code Block |
---|
void iterate(Xtc*);
|
Iterate over the collection specifed as an argument to the function. For each "Xtc" found call back the "process" function. If the "process" function returns zero (0) the iteration is aborted and control is returned to the caller. Otherwise, control is returned when all elements of the collection have been scanned.
Code Block |
---|
const Xtc* root() const;
|
This function returns the collection specified by the constructor.
// Return the Xtc which is immediately following an object of this class.
Xtc* next() { return (Xtc*)((char*)this+extent); }
const Xtc* next() const { return (const Xtc*)((char*)this+extent); }
void* alloc(uint32_t size) { void* buffer = next(); extent += size; return buffer; }
|
Public Attributes:
Code Block |
---|
Damage damage;
Src src;
TypeId contains;
uint32_t extent;
|
Class XtcIterator
This is an abstract class.
This class allows iteration over a collection of "Xtc" objects. An "event" generated from DataFlow consists of data described by a collection of "Xtc" objects. Therefore, this class is instrumental in the navigation of an event's data. The set of "Xtc"s is determined by passing (typically to the constructor) a root "Xtc" which describes the collection of "Xtc"s to process. This root, for example is provided by an event's datagram. As this is an Abstract-Base-Class, it is expected that an application will subclass from this class, providing an implementation of the "process" method. This method will be called back for each "Xtc" in the collection. Note that the "Xtc" to process is passed as an argument. If the "process" method wishes to abort the iteration a zero (0) value is returned. The iteration is initiated by calling the "iterate" member function.
Public Member Functions:
Constructors and destructor:
Code Block |
---|
XtcIterator(Xtc* root);
XtcIterator() {}
virtual ~XtcIterator() {}
|
The first constructor takes an argument the "Xtc" which defines the collection to iterate over.
Code Block |
---|
virtual int process(Xtc* xtc) = 0;
|
This function is pure virtual and must be implemented by all derived classes.
Code Block |
---|
void iterate();
|
This function commences iteration over the collection specified by the constructor.
Code Block |
---|
void iterate(Xtc*);
|
Iterate over the collection specifed as an argument to the function. For each "Xtc" found call back the "process" function. If the "process" function returns zero (0) the iteration is aborted and control is returned to the caller. Otherwise, control is returned when all elements of the collection have been scanned.
Code Block |
---|
const Xtc* root() const;
|
This function returns the collection specified by the constructor.
Class Sequence
Defined in pdsdata/xtc/Sequence.hh
.
Public Types:
Code Block |
---|
enum Type {Event = 0, Occurrence = 1, Marker = 2};
enum {NumberOfTypes = 3};
|
Public Member Functions:
Code Block |
---|
// Constructors
Sequence() {}
Sequence(const Sequence&);
Sequence(const ClockTime& clock, const TimeStamp& stamp);
Sequence(Type, TransitionId::Value, const ClockTime&, const TimeStamp&);
Type type() const;
TransitionId::Value service() const;
bool isExtended() const;
bool isEvent() const;
const ClockTime& clock() const {return _clock;}
const TimeStamp& stamp() const {return _stamp;}
Sequence& operator=(const Sequence&);
|
Class Env
Defined in pdsdata/xtc/Env.hh
Public Member Functions
Code Block |
---|
// Constructors
Env() {}
Env(const Env& in) : _env(in._env) {}
Env(uint32_t env);
uint32_t value() const;
const Env& operator=(const Env& that);
|
Class Src
This is a base class for any source of information in the xtc file (e.g. Detector, Beamline, Process). Defined in pdsdata/xtc/Src.hh
...
Code Block |
---|
// Constructors DetInfo() {} DetInfo(uint32_t processId, // Detector det, // DetInfo(uint32_t processIddetId, // DetectorDevice detdev, // uint32_t detId, devId); // bool operator==(const DetInfo &) const; uint32_t processId() const; Detector detector() const; Device device() const; dev, uint32_t detId() const; uint32_t //devId() const; |
Static Public Member Functions
Code Block |
---|
static const char *name(Detector); static uint32_tconst devIdchar *name(Device); static const // bool operator==(const DetInfo &) const; uint32_t processId() constchar *name(const DetInfo &); |
Class ClockTime
Defined in pdsdata/xtc/ClockTime.hh
.
Public Member Functions:
- Constructors (ClockTime has no destructor)
Code Block ClockTime();
...
ClockTime(
...
const
...
...
ClockTime& t);
...
ClockTime(unsigned sec, unsigned nsec);
- Accessors:
Code Block
...
unsigned seconds
...
...
...
(
...
)
...
...
const
...
{return _high;}
...
unsigned
...
nanoseconds() const {return _low;}
- Operators
Class ClockTime
Defined in pdsdata/xtc/ClockTime.hh
.
Public Member Functions:
- Constructors (ClockTime has no destructor)
Code Block ClockTime& operator=(const ClockTime&); bool ClockTimeoperator> (const ClockTime&) t)const; ClockTime(unsigned sec, unsigned nsec);
- Accessors:
Code Block unsigned seconds () const {return _high;} unsigned nanoseconds() const {return _low;}
- Operators
Code Block ClockTime& operator=(const ClockTime&); bool operator> (const ClockTime&) const; bool operator==(const ClockTime&) const;
Class Damage
Defined in pdsdata/xtc/Damage.hh
, inline implementation.
Public Types:
bool operator==(const ClockTime&) const;
Class Damage
Defined in pdsdata/xtc/Damage.hh
, inline implementation.
Code Block |
---|
Bit Mask Name
-----------------------------------
1 0x00002 DroppedContribution
12 0x01000 OutOfOrder
13 0x02000 OutOfSynch
14 0x04000 UserDefined
15 0x08000 IncompleteContribution
16 0x10000 ContainsIncomplete
Bit = n means 1<<n, i.e. 1 shifted left n bits:
|
Code Block |
enum Value { DroppedContribution = 1, OutOfOrder Decimal = 12,Binary int32_t value = OutOfSynch 1 00000000000000000000000000000001 = 13, UserDefined = 14, IncompleteContribution = 15, | ContainsIncomplete | = 16 }; | // reserve the top byte| DroppedContribution to augment user defined errors enum {NotUserBitsMask=0x00FFFFFF, UserBitsShift = 24}; |
Public Member Functions:
Code Block |
---|
00000000000000000000000000000010 OutOfOrder // Constructor Damage(uint32_t v) : _damage(v) {} uint32_t value() const 00000000000000000001000000000000 OutOfSynch { return _damage; } void 00000000000000000010000000000000 UserDefined increase(Damage::Value v) { _damage |= ((1<<v) & NotUserBitsMask); } void increase(uint32_t v)00000000000000000100000000000000 IncompleteContribution { _damage |= v & NotUserBitsMask; } 00000000000000001000000000000000 ContainsIncomplete uint32_t bits() const 00000000000000010000000000000000 |
Public Types:
Code Block |
---|
enum Value { { returnDroppedContribution _damage & NotUserBitsMask;} = 1, uint32_t userBits() const OutOfOrder { return _damage >> UserBitsShift;= }12, void OutOfSynch userBits(uint32_t v) { _damage &= NotUserBitsMask;13, _damageUserDefined |= (v << UserBitsShift); } |
Class Dgram
Datagram - structure of a piece of information within the xtc file.
Public Attributes:
Code Block |
---|
PDS_DGRAM_STRUCT // #define PDS_DGRAM_STRUCT Sequence seq; Env env; Xtc xtc |
Class Sequence
Defined in pdsdata/xtc/Sequence.hh
.
Public Types:
Code Block |
---|
= 14, IncompleteContribution = 15, enum TypeContainsIncomplete {Event = 0, Occurrence = 1, Marker = 2}; enum 16 }; // reserve the top byte to augment user defined errors enum {NumberOfTypesNotUserBitsMask=0x00FFFFFF, UserBitsShift = 324}; |
Public Member Functions:
Code Block |
---|
// ConstructorsConstructor Damage(uint32_t v) : Sequence_damage(v) {} Sequence(const Sequence&); Sequence(const ClockTime& clock, const TimeStamp& stamp); uint32_t value() const { return _damage; } void Sequence(Type, TransitionIdincrease(Damage::Value, const ClockTime&, const TimeStamp&); v) { _damage |= ((1<<v) & NotUserBitsMask); } void Type typeincrease(uint32_t v) const; { TransitionId::Value service() const;_damage |= v & NotUserBitsMask; } booluint32_t isExtendedbits() const; bool isEvent() const; const ClockTime& clock() const { return _clockdamage & NotUserBitsMask;} const TimeStamp& stampuint32_t userBits() const {return _stamp;} Sequence& operator=(const Sequence&); |
Class Env
Defined in pdsdata/xtc/Env.hh
Public Member Functions
Code Block |
---|
{ return _damage >> UserBitsShift; } //void Constructors EnvuserBits(uint32_t v) {} Env(const Env& in) : _env(in._env) {} _damage &= NotUserBitsMask; _damage |= (v << UserBitsShift); Env(uint32_t env); } |
Class Dgram
Datagram - structure of a piece of information within the xtc file.
Public Attributes:
Code Block |
---|
uint32PDS_DGRAM_t value() const; const Env& operator=(const Env& that);STRUCT // #define PDS_DGRAM_STRUCT Sequence seq; Env env; Xtc xtc |
Class Level
Defined in pdsdata/xtc/Level.hh
...