Page History
...
The Xtc package defines several classes.
Class XtcFileIterator
An xtc file is a collection of datagrams (Dgram).
A datagram contains: Sequence, Env and Xtc.. This is an iterator to loop through all datagrams in a file.
Public Member Functions:
Code Block |
---|
// Constructor and destructor XtcFileIterator(int fd, size_t maxDgramSize); ~XtcFileIterator(); Dgram* next(); |
Class Dgram
Datagram - structure of a piece of information within the xtc file.
A datagram contains: Sequence, Env and Xtc.
Code Block |
---|
Dgram --- Dgram ----------------------------------------- | | | Sequence Env Xtc |
...
Public Member FunctionsAttributes:
Code Block |
---|
// Constructor and destructor XtcFileIterator(int fd, size_t maxDgramSize); ~XtcFileIterator(); Dgram* next(); |
Class Dgram
Datagram - structure of a piece of information within the xtc file.
PDS_DGRAM_STRUCT // #define PDS_DGRAM_STRUCT Sequence seq; Env env; Xtc xtc
|
Class Sequence
Defined in pdsdata/xtc/Sequence.hh
.
Public TypesPublic Attributes:
Code Block |
---|
enum PDS_DGRAM_STRUCT // #define PDS_DGRAM_STRUCT Sequence seq; Env env; Xtc 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:
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&) |
Code Block |
//Constructor used to create an empty, unlabeled Xtc() : damage(0), extent(0) {}; // Copy constructor, will copy everything, but NOT the payload.Type type() const; TransitionId::Value service() const; Xtcbool isExtended() const; Xtc& xtc bool isEvent() :const; const ClockTime& damageclock(xtc.damage), src(xtc.src), contains(xtc.contains), extent(sizeof(Xtc)) {} const {return _clock;} // const TimeStamp& stamp() Xtc(const TypeId& type) :{return _stamp;} Sequence& damage(0), contains(type), extent(sizeof(Xtc)) {} operator=(const Sequence&); |
Class Env
Defined in pdsdata/xtc/Env.hh
Public Member Functions
Code Block |
---|
// Constructors Env() {} XtcEnv(const TypeIdEnv& type,in) const Src& _src) :: _env(in._env) {} Env(uint32_t env); damage(0), src(_src), contains(type), extent(sizeof(Xtc)) {} uint32_t value() const; Xtc(const TypeIdEnv& _tag, operator=(const SrcEnv& that); |
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) {};_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 damage(void*0)p; } void* operator new(size_t size, Xtc* p) { return p->alloc(size); } , contains(type), extent(sizeof(Xtc)) {} Xtc(const TypeId& type, const Src& _src) : damage(0), src(_src), contains(type), extent(sizeof(Xtc)) {} 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) : damage(_damage), src(_src), contains(_tag), 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) { return (void*)p; }
void* operator new(size_t size, Xtc* p) { return p->alloc(size); }
|
Code Block |
---|
Code Block |
// Return 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 sizeofPayload() const { return extent - sizeof(Xtc); } // Return thea Xtcpointer which(of isunspecified immediately following an object oftype) to the payload associated with this class. Xtcchar* next payload() const { return (Xtcchar*)((char*)this+extent1); } // Return constthe Xtc*size next(in bytes) of the payload associated with the class. int sizeofPayload() const { return (const Xtc*)((char*)this+extentextent - sizeof(Xtc); } void*// Return the Xtc which is alloc(uint32_t size) { void* buffer = next(); extent += size; return buffer; } |
Public Attributes:
Code Block |
---|
Damage damage; Srcimmediately following an object of this class. Xtc* next() src; TypeId{ return (Xtc*)((char*)this+extent); } const Xtc* next() contains; const { return 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
(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 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 Level
Defined in pdsdata/xtc/Level.hh
Public Types:
Code Block |
---|
enum Type{Control, Source, Segment, Event, Recorder, Observer, Reporter,
NumberOfLevels};
|
Static Public Member Functions
Code Block |
---|
static const char* name(Type type);
|
Class TransitionId
Public Types:
Code Block |
---|
enum Value {
Unknown, Reset,
Map, Unmap,
Configure, Unconfigure,
BeginRun, EndRun,
BeginCalibCycle, EndCalibCycle,
Enable, Disable,
L1Accept,
NumberOf };
|
Static Public Member Functions:
Code Block |
---|
static const char* name(TransitionId::Value id |
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 |
---|
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: Decimal Binary int32_t value = 1 00000000000000000000000000000001 shifted left n bits: | Decimal |Binary int32_t value = |1 | DroppedContribution 00000000000000000000000000000001 00000000000000000000000000000010 OutOfOrder 00000000000000000001000000000000 OutOfSynch | | | 00000000000000000010000000000000| UserDefinedDroppedContribution 00000000000000000000000000000010 OutOfOrder 00000000000000000100000000000000 IncompleteContribution 00000000000000001000000000000000 ContainsIncomplete 00000000000000000001000000000000 OutOfSynch 00000000000000010000000000000000 |
Public Types:
Code Block |
---|
enum Value { DroppedContribution00000000000000000010000000000000 UserDefined = 1, OutOfOrder 00000000000000000100000000000000 IncompleteContribution = 12, OutOfSynch 00000000000000001000000000000000 ContainsIncomplete = 13, 00000000000000010000000000000000 |
Public Types:
Code Block |
---|
UserDefinedenum Value { DroppedContribution = 141, IncompleteContributionOutOfOrder = 15, ContainsIncomplete = 1612, }; OutOfSynch // reserve the top byte to augment user defined errors = enum {NotUserBitsMask=0x00FFFFFF, UserBitsShift = 24}; |
Public Member Functions:
Code Block |
---|
13, UserDefined // Constructor Damage(uint32_t v) : _damage(v) {} = 14, uint32_t IncompleteContribution value() const= 15, ContainsIncomplete = 16 { return _damage; }; // reserve voidthe top byte to augment user increase(Damage::Value v)defined errors { _damageenum |{NotUserBitsMask=0x00FFFFFF, UserBitsShift = 24}; |
Public Member Functions:
Code Block |
---|
((1<<v) & NotUserBitsMask); } void// Constructor increaseDamage(uint32_t v) {: _damage |= (v) & NotUserBitsMask; {} uint32_t bits value() const { return _damage &; NotUserBitsMask;} uint32_t userBits() const void increase(Damage::Value v) { return _damage >> UserBitsShift |= ((1<<v) & NotUserBitsMask); } void userBitsincrease(uint32_t v) { _damage &= NotUserBitsMask; { _damage |= (v << UserBitsShift); } |
Class Level
Defined in pdsdata/xtc/Level.hh
Public Types:
Code Block |
---|
enum Type{Control, Source, Segment, Event, Recorder, Observer, Reporter, & NotUserBitsMask; } uint32_t bits() const NumberOfLevels}; |
Static Public Member Functions
Code Block |
---|
static{ constreturn char* name(Type type); |
Class TimeStamp
Public Types:
Code Block |
---|
enum {NumFiducialBits = 17}; _damage & NotUserBitsMask;} uint32_t userBits() const enum {MaxFiducials = (1<<17)-32}; { return enum_damage {ErrFiducial>> = (1<<17)-1}; |
Public Member Functions:
Code Block |
---|
UserBitsShift; } void TimeStamp(); TimeStampuserBits(const TimeStamp&);uint32_t v) { TimeStamp(const TimeStamp&, unsigned control) _damage &= NotUserBitsMask; TimeStamp(unsigned ticks, unsigned fiducials, unsigned vector, unsigned control=0_damage |= (v << UserBitsShift); unsigned ticks} |
Class TimeStamp
Public Types:
Code Block |
---|
enum {NumFiducialBits ()= const17}; enum unsigned{MaxFiducials = fiducials(1<<17) const-32}; unsignedenum control{ErrFiducial = (1<<17)-1}; |
Public Member Functions:
Code Block |
---|
const; unsigned vector TimeStamp() const; TimeStamp& operator= (const TimeStamp&); bool operator==TimeStamp(const TimeStamp&, unsigned control) const; boolTimeStamp(unsigned ticks, unsigned fiducials, unsigned vector, unsigned operator>=(const TimeStamp&) constcontrol=0); boolunsigned ticks operator<=(const TimeStamp&) const; bool unsigned fiducials() const; unsigned control operator< (const TimeStamp&) const; boolunsigned vector () const; operator>TimeStamp& operator= (const TimeStamp&) const; |
Class TransitionId
Public Types:
Code Block |
---|
enumbool Value { Unknown, Reset,operator==(const TimeStamp&) const; bool Map, Unmap, Configure, Unconfigure,operator>=(const TimeStamp&) const; bool BeginRun, EndRun, operator<=(const BeginCalibCycle, EndCalibCycle, TimeStamp&) const; bool Enable, Disable, operator< (const L1Accept,TimeStamp&) const; bool NumberOf }; |
Static Public Member Functions:
Code Block |
---|
staticoperator> (const char* name(TransitionId::Value id)TimeStamp&) const; |
Class TypeId
Public Types:
...