#include <RomHeader.h>
Inheritance diagram for DybDaq::RomHeader:
Public Types | |
typedef std::pair< const char *, unsigned int > | OutputBuffer |
typedef std::vector< OutputBuffer > | OutputBufferList |
typedef std::vector< ByteInspector * > | Bytes |
typedef std::vector< BitsInspector * > | Bits |
Public Member Functions | |
virtual | ~RomHeader () |
Destroy this instance of the class. | |
unsigned int | headerSize () const |
Returns the length of this head in the buffer in 4-byte words. | |
unsigned int | totalSize () const |
Returns the total size of the event in the buffer in 4-byte words. | |
unsigned int | site () const |
Returns the site of the fragment in the buffer. | |
unsigned int | detector () const |
Returns the detector of the fragment in the buffer. | |
unsigned int | moduleType () const |
Returns the module type of the fragment in the buffer. | |
unsigned int | slot () const |
Returns the slot of the fragment in the buffer. | |
virtual unsigned int | bufferSize () const |
Returns the size, in 4-bytes, of this ojbect's contents in the buffer. | |
const EventTraits & | eventTraits () const |
Returns the EventTraits instance used to parse this object's buffer. | |
bool | hasDaqTraits () const |
virtual const DaqTraits & | daqTraits () const |
virtual unsigned int | gather (OutputBufferList &outputBuffers) const |
virtual unsigned int | inspect (DaqBuffer::Bytes &inspectors) const |
Static Public Attributes | |
static const unsigned int | kBytesInInt |
static const unsigned int | kUndefinedFormatComponent |
Protected Member Functions | |
RomHeader (const unsigned int site, const unsigned int detector, const unsigned int moduleType, const unsigned int slot, const EventTraits &traits) | |
Create an instance of this class. | |
RomHeader (const ByteBuffer &byteBuffer, const EventTraits &traits) | |
Create an instance of this class. | |
virtual unsigned int | formatComponent () const |
Returns the component with the format of this buffer. | |
const char * | buffer () const |
char * | buffer () |
bool | hasByteBuffer () const |
const ByteBuffer & | byteBuffer () const |
unsigned int | fillInspectors (DaqBuffer::Bytes &inspectors, unsigned int component, unsigned int cursor) const |
virtual bool | readBool (const unsigned int field) const |
virtual int | readInt (const unsigned int field) const |
virtual unsigned char | readUnsignedChar (const unsigned int field) const |
virtual unsigned int | readUnsignedInt (const unsigned int field) const |
virtual void | writeField (const bool value, const unsigned int field) |
virtual void | writeField (const int value, const unsigned int field) |
virtual void | writeField (const unsigned int value, const unsigned int field) |
Private Member Functions | |
RomHeader () | |
Suppress default. | |
RomHeader (RomHeader &rhs) | |
Suppress default. | |
RomHeader & | operator= (RomHeader &rhs) |
Suppress default. | |
void | setHeaderSize (const unsigned int headerLength) |
Sets the length of this head in the buffer in 4-byte words. | |
void | setTotalSize (const unsigned int totalLength) |
Sets the total size of the event in the buffer in 4-byte words. | |
void | setSite (const unsigned int site) |
Sets the site of the fragment in the buffer. | |
void | setDetector (const unsigned int detector) |
Sets the detector of the fragment in the buffer. | |
void | setModuleType (const unsigned int moduleType) |
Sets the module type of the fragment in the buffer. | |
void | setSlot (const unsigned int slot) |
Sets the slot of the fragment in the buffer. | |
Friends | |
class | RomFragment |
Definition at line 21 of file RomHeader.h.
RomHeader::~RomHeader | ( | ) | [virtual] |
RomHeader::RomHeader | ( | const unsigned int | site, | |
const unsigned int | detector, | |||
const unsigned int | moduleType, | |||
const unsigned int | slot, | |||
const EventTraits & | traits | |||
) | [protected] |
Create an instance of this class.
Definition at line 19 of file RomHeader.cc.
00023 : 00024 EventBuffer(new char[traits.headerSize(EventTraits::kRomHeader) * kBytesInInt], 00025 traits) { 00026 traits.initializeHeader(EventTraits::kRomHeader, 00027 buffer()); 00028 setHeaderSize(traits.headerSize(EventTraits::kRomHeader)), 00029 setTotalSize(headerSize()); 00030 // TODO: Fix, for the dry run site & detector not set! 00031 setSite(0); 00032 setDetector(0); 00033 00034 setModuleType(moduleType); 00035 setSlot(slot); 00036 }
RomHeader::RomHeader | ( | const ByteBuffer & | byteBuffer, | |
const EventTraits & | traits | |||
) | [protected] |
Create an instance of this class.
Definition at line 38 of file RomHeader.cc.
00039 : 00040 EventBuffer(byteBuffer, 00041 traits) { 00042 byteBuffer.position(byteBuffer.position() + (headerSize() * kBytesInInt)); 00043 }
DybDaq::RomHeader::RomHeader | ( | ) | [private] |
Suppress default.
DybDaq::RomHeader::RomHeader | ( | RomHeader & | rhs | ) | [private] |
Suppress default.
unsigned int RomHeader::headerSize | ( | ) | const |
Returns the length of this head in the buffer in 4-byte words.
Definition at line 52 of file RomHeader.cc.
00052 { 00053 return readUnsignedInt(EventTraits::kRomHeaderSize); 00054 }
unsigned int RomHeader::totalSize | ( | ) | const |
Returns the total size of the event in the buffer in 4-byte words.
Definition at line 56 of file RomHeader.cc.
00056 { 00057 return readUnsignedInt(EventTraits::kRomTotalSize); 00058 }
unsigned int RomHeader::site | ( | ) | const |
Returns the site of the fragment in the buffer.
Definition at line 60 of file RomHeader.cc.
00060 { 00061 return readUnsignedInt(EventTraits::kRomSite); 00062 }
unsigned int RomHeader::detector | ( | ) | const |
Returns the detector of the fragment in the buffer.
Definition at line 64 of file RomHeader.cc.
00064 { 00065 return readUnsignedInt(EventTraits::kRomDetector); 00066 }
unsigned int RomHeader::moduleType | ( | ) | const |
Returns the module type of the fragment in the buffer.
Definition at line 68 of file RomHeader.cc.
00068 { 00069 return readUnsignedInt(EventTraits::kRomModuleType); 00070 }
unsigned int RomHeader::slot | ( | ) | const |
Returns the slot of the fragment in the buffer.
Definition at line 72 of file RomHeader.cc.
00072 { 00073 return readUnsignedInt(EventTraits::kRomSlot); 00074 }
unsigned int RomHeader::bufferSize | ( | ) | const [virtual] |
Returns the size, in 4-bytes, of this ojbect's contents in the buffer.
Implements DybDaq::DaqBuffer.
Definition at line 76 of file RomHeader.cc.
00076 { 00077 return headerSize(); 00078 }
unsigned int RomHeader::formatComponent | ( | ) | const [protected, virtual] |
Returns the component with the format of this buffer.
Reimplemented from DybDaq::DaqBuffer.
Definition at line 48 of file RomHeader.cc.
00048 { 00049 return EventTraits::kRomHeader; 00050 }
void RomHeader::setHeaderSize | ( | const unsigned int | headerLength | ) | [private] |
Sets the length of this head in the buffer in 4-byte words.
Definition at line 80 of file RomHeader.cc.
00080 { 00081 writeField(headerLength, 00082 EventTraits::kRomHeaderSize); 00083 }
void RomHeader::setTotalSize | ( | const unsigned int | totalLength | ) | [private] |
Sets the total size of the event in the buffer in 4-byte words.
Definition at line 85 of file RomHeader.cc.
00085 { 00086 writeField(totalLength, 00087 EventTraits::kRomTotalSize); 00088 }
void RomHeader::setSite | ( | const unsigned int | site | ) | [private] |
Sets the site of the fragment in the buffer.
Definition at line 90 of file RomHeader.cc.
00090 { 00091 writeField(site, 00092 EventTraits::kRomSite); 00093 }
void RomHeader::setDetector | ( | const unsigned int | detector | ) | [private] |
Sets the detector of the fragment in the buffer.
Definition at line 95 of file RomHeader.cc.
00095 { 00096 writeField(detector, 00097 EventTraits::kRomDetector); 00098 }
void RomHeader::setModuleType | ( | const unsigned int | moduleType | ) | [private] |
Sets the module type of the fragment in the buffer.
Definition at line 100 of file RomHeader.cc.
00100 { 00101 writeField(moduleType, 00102 EventTraits::kRomModuleType); 00103 }
void RomHeader::setSlot | ( | const unsigned int | slot | ) | [private] |
Sets the slot of the fragment in the buffer.
Definition at line 105 of file RomHeader.cc.
00105 { 00106 writeField(slot, 00107 EventTraits::kRomSlot); 00108 }
const EventTraits & EventBuffer::eventTraits | ( | ) | const [inherited] |
Returns the EventTraits instance used to parse this object's buffer.
Definition at line 35 of file EventBuffer.cc.
00035 { 00036 return dynamic_cast<const EventTraits&>(daqTraits()); 00037 }
friend class RomFragment [friend] |
Definition at line 25 of file RomHeader.h.