#include <LtbReadout.h>
Inheritance diagram for DybDaq::LtbReadout:
Public Types | |
typedef std::vector< const LtbFrame * > | LtbFramePtrList |
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 | |
LtbReadout (const unsigned int localTriggerNumber, const unsigned int rawTriggerTotal, const unsigned int ltbStatus, const bool clockError, const LtbTraits &traits) | |
Create an instance of this class. | |
LtbReadout (const ByteBuffer &byteBuffer, const unsigned int bufferSize) | |
Create an instance of this class. | |
virtual | ~LtbReadout () |
Destroy this instance of the class. | |
virtual const DaqTraits & | daqTraits () const |
Returns the DaqTraits instance used to parse this object's buffer. | |
const LtbHead & | head () const |
const LtbFramePtrList & | ltbFrames () const |
const LtbFoot & | foot () const |
virtual unsigned int | romSize () const |
Returns the total size, in 4-bytes, of all the buffers for this object's components. | |
virtual unsigned int | gatherRom (DaqBuffer::OutputBufferList &outputBuffers) const |
Adds to the supplied line the OutputBuffers that contain the DAQ format of this objects content returning the total number of bytes in the added buffers. | |
virtual unsigned int | inspectRom (DaqBuffer::Bytes &inspectors) const |
Adds to the supplied list the DaqBuffer::Bytes that contains inspections of this object's objects. | |
virtual unsigned int | bufferSize () const |
Returns the size, in 4-bytes, of this ojbect's contents in the buffer. | |
const LtbFrame & | addFrame (const unsigned int readoutType, const unsigned int triggerMask, const LtbTraits::LtbDateTime &dateTime, const unsigned int halfNanoseconds, const int accumulation, const unsigned int hitSum, const bool totalEsum, const bool highEsum, const bool lowEsum, const unsigned int energySum, const unsigned int crossTriggerSource, const bool accumulationStatus, const bool validGps, const bool usingUtc, const bool validClockSystem, const bool feeBufferFull, const bool ltbBufferFull, const unsigned int blockedTriggerCount) |
Creates a new LtbFrame in this readout using the supplied values. | |
const LtbFrame & | addFrame (const LtbFrame *frame) |
Adds the supplied LtbFrame to this object,. | |
virtual unsigned int | gather (OutputBufferList &outputBuffers) const |
virtual unsigned int | gather (OutputBufferList &outputBuffers) const |
virtual unsigned int | inspect (DaqBuffer::Bytes &inspectors) const |
bool | hasDaqTraits () const |
Static Public Attributes | |
static const unsigned int | kBytesInInt |
static const unsigned int | kUndefinedFormatComponent |
Protected Member Functions | |
virtual unsigned int | gatherComponents (OutputBufferList &outputBuffers) const |
Gathers the DAQ formatted bytes for this object's components. | |
virtual unsigned int | inspectComponents (DaqBuffer::Bytes &inspectors) const |
Inspects the DAQ formatted bytes for this object's components. | |
virtual void | expanded (const unsigned int size) |
Tells this object that its contents has expanded by the specified number of bytes. | |
virtual bool | setRomExpandable (DaqExpandable &expandable) |
Associates the supplied DaqExpanable with this object if it is not already associated with one. | |
unsigned int | begin () const |
unsigned int | containerSize () const |
virtual unsigned int | gatherComponents (OutputBufferList &outputBuffers) const =0 |
bool | setExpandable (DaqExpandable &expandable) |
void | notifyExpandable (const unsigned int size) |
bool | expandedByRomData (const RomData *romData) |
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) |
virtual unsigned int | formatComponent () const |
Private Member Functions | |
LtbReadout () | |
Suppress default. | |
LtbReadout (LtbReadout &rhs) | |
Suppress default. | |
LtbReadout & | operator= (LtbReadout &rhs) |
Suppress default. | |
LtbFoot & | foot () |
Private Attributes | |
LtbHead * | m_head |
The LtbHead for this fragment. | |
LtbFramePtrList * | m_frames |
The list of RomFragments in this object. | |
LtbFoot * | m_foot |
The LtbFoot for this fragment. | |
Friends | |
friend class | DaqContainer |
Definition at line 29 of file LtbReadout.h.
typedef std::vector<const LtbFrame*> DybDaq::LtbReadout::LtbFramePtrList |
Definition at line 33 of file LtbReadout.h.
LtbReadout::LtbReadout | ( | const unsigned int | localTriggerNumber, | |
const unsigned int | rawTriggerTotal, | |||
const unsigned int | ltbStatus, | |||
const bool | clockError, | |||
const LtbTraits & | traits | |||
) |
Create an instance of this class.
Definition at line 29 of file LtbReadout.cc.
00033 : 00034 DaqContainer(), 00035 m_head(new LtbHead(localTriggerNumber, 00036 rawTriggerTotal, 00037 ltbStatus, 00038 clockError, 00039 traits)), 00040 m_frames(0), 00041 m_foot(0) { 00042 }
LtbReadout::LtbReadout | ( | const ByteBuffer & | byteBuffer, | |
const unsigned int | bufferSize | |||
) |
Create an instance of this class.
Definition at line 44 of file LtbReadout.cc.
00045 : 00046 DaqContainer(byteBuffer, 00047 bufferSize), 00048 m_head(0), 00049 m_frames(0), 00050 m_foot(0) { 00051 byteBuffer.position(byteBuffer.position() + (bufferSize * kBytesInInt)); 00052 }
LtbReadout::~LtbReadout | ( | ) | [virtual] |
Destroy this instance of the class.
Definition at line 54 of file LtbReadout.cc.
00054 { 00055 if (0 != m_foot) { 00056 delete m_foot; 00057 } 00058 if (0 != m_frames) { 00059 LtbFramePtrList::iterator iterator; 00060 for (iterator = m_frames->begin(); 00061 iterator != m_frames->end(); 00062 ++iterator) { 00063 delete const_cast<LtbFrame*>(*iterator); 00064 } 00065 delete m_frames; 00066 } 00067 if (0 != m_head) { 00068 delete m_head; 00069 } 00070 }
DybDaq::LtbReadout::LtbReadout | ( | ) | [private] |
Suppress default.
DybDaq::LtbReadout::LtbReadout | ( | LtbReadout & | rhs | ) | [private] |
Suppress default.
const DaqTraits & LtbReadout::daqTraits | ( | ) | const [virtual] |
Returns the DaqTraits instance used to parse this object's buffer.
Reimplemented from DybDaq::DaqContainer.
Definition at line 72 of file LtbReadout.cc.
const LtbHead & LtbReadout::head | ( | ) | const |
Definition at line 76 of file LtbReadout.cc.
00076 { 00077 if (0 == m_head && hasByteBuffer()) { 00078 const ByteBuffer& buffer = byteBuffer(); 00079 const unsigned int originalPosition = buffer.position(); 00080 buffer.position(begin()); 00081 m_head = new LtbHead(buffer); 00082 buffer.position(originalPosition); 00083 } 00084 return *m_head; 00085 }
const LtbReadout::LtbFramePtrList & LtbReadout::ltbFrames | ( | ) | const |
Definition at line 87 of file LtbReadout.cc.
00087 { 00088 if (0 == m_frames) { 00089 m_frames = new LtbFramePtrList(); 00090 if (hasByteBuffer()) { 00091 const LtbTraits& traits = head().ltbTraits(); 00092 const ByteBuffer& buffer = byteBuffer(); 00093 00094 const unsigned int originalPosition = buffer.position(); 00095 buffer.position(begin() + (traits.headSize() * kBytesInInt)); 00096 const unsigned int finished = (containerSize() - (traits.headSize() + traits.footSize())) / traits.frameSize(); 00097 for (unsigned int count = 0; 00098 count != finished; 00099 ++count) { 00100 const LtbFrame* frame = new LtbFrame(buffer, 00101 traits); 00102 m_frames->push_back(frame); 00103 } 00104 buffer.position(originalPosition); 00105 } 00106 } 00107 return *m_frames; 00108 }
const LtbFoot & LtbReadout::foot | ( | ) | const |
Definition at line 110 of file LtbReadout.cc.
00110 { 00111 if (0 == m_foot && hasByteBuffer()) { 00112 const LtbTraits& traits = head().ltbTraits(); 00113 const ByteBuffer& buffer = byteBuffer(); 00114 00115 const unsigned int originalPosition = buffer.position(); 00116 buffer.position(begin() + ((containerSize() - traits.footSize()) * kBytesInInt)); 00117 m_foot = new LtbFoot(buffer, 00118 head().ltbTraits()); 00119 buffer.position(originalPosition); 00120 00121 } 00122 return *m_foot; 00123 }
unsigned int LtbReadout::romSize | ( | ) | const [virtual] |
Returns the total size, in 4-bytes, of all the buffers for this object's components.
Implements DybDaq::RomData.
Definition at line 133 of file LtbReadout.cc.
00133 { 00134 return bufferSize(); 00135 }
unsigned int LtbReadout::gatherRom | ( | DaqBuffer::OutputBufferList & | outputBuffers | ) | const [virtual] |
Adds to the supplied line the OutputBuffers that contain the DAQ format of this objects content returning the total number of bytes in the added buffers.
Implements DybDaq::RomData.
Definition at line 125 of file LtbReadout.cc.
00125 { 00126 return gather(outputBuffers); 00127 }
unsigned int LtbReadout::inspectRom | ( | DaqBuffer::Bytes & | inspectors | ) | const [virtual] |
Adds to the supplied list the DaqBuffer::Bytes that contains inspections of this object's objects.
Implements DybDaq::RomData.
Definition at line 129 of file LtbReadout.cc.
00129 { 00130 return inspect(inspectors); 00131 }
unsigned int LtbReadout::bufferSize | ( | ) | const [virtual] |
Returns the size, in 4-bytes, of this ojbect's contents in the buffer.
Implements DybDaq::DaqContainer.
Definition at line 165 of file LtbReadout.cc.
00165 { 00166 unsigned int result = head().bufferSize(); 00167 const LtbFramePtrList& frames = ltbFrames(); 00168 LtbFramePtrList::const_iterator frame; 00169 for (frame = frames.begin(); 00170 frame != frames.end(); 00171 ++frame) { 00172 result += (*frame)->bufferSize(); 00173 } 00174 result += foot().bufferSize(); 00175 return result; 00176 }
const LtbFrame & LtbReadout::addFrame | ( | const unsigned int | readoutType, | |
const unsigned int | triggerMask, | |||
const LtbTraits::LtbDateTime & | dateTime, | |||
const unsigned int | halfNanoseconds, | |||
const int | accumulation, | |||
const unsigned int | hitSum, | |||
const bool | totalEsum, | |||
const bool | highEsum, | |||
const bool | lowEsum, | |||
const unsigned int | energySum, | |||
const unsigned int | crossTriggerSource, | |||
const bool | accumulationStatus, | |||
const bool | validGps, | |||
const bool | usingUtc, | |||
const bool | validClockSystem, | |||
const bool | feeBufferFull, | |||
const bool | ltbBufferFull, | |||
const unsigned int | blockedTriggerCount | |||
) |
Creates a new LtbFrame in this readout using the supplied values.
Definition at line 188 of file LtbReadout.cc.
00205 { 00206 LtbFrame* result = new LtbFrame(readoutType, 00207 triggerMask, 00208 dateTime, 00209 halfNanoseconds, 00210 accumulation, 00211 hitSum, 00212 totalEsum, 00213 highEsum, 00214 lowEsum, 00215 energySum, 00216 crossTriggerSource, 00217 accumulationStatus, 00218 validGps, 00219 usingUtc, 00220 validClockSystem, 00221 feeBufferFull, 00222 ltbBufferFull, 00223 blockedTriggerCount, 00224 head().ltbTraits()); 00225 return addFrame(result); 00226 }
Adds the supplied LtbFrame to this object,.
Definition at line 228 of file LtbReadout.cc.
00228 { 00229 if (0 == m_frames) { 00230 m_frames = new LtbFramePtrList(); 00231 } 00232 (const_cast<LtbFrame*>(frame))->setFrameNumber(m_frames->size()); 00233 m_frames->push_back(frame); 00234 m_head->setRawTriggersSaved(m_frames->size()); 00235 expanded(frame->bufferSize()); 00236 return *frame; 00237 }
unsigned int LtbReadout::gatherComponents | ( | OutputBufferList & | outputBuffers | ) | const [protected, virtual] |
Gathers the DAQ formatted bytes for this object's components.
Definition at line 137 of file LtbReadout.cc.
00137 { 00138 unsigned int result = head().gather(outputBuffers); 00139 const LtbFramePtrList& frames = ltbFrames(); 00140 LtbFramePtrList::const_iterator frame; 00141 for (frame = frames.begin(); 00142 frame != frames.end(); 00143 ++frame) { 00144 result += (*frame)->gather(outputBuffers); 00145 } 00146 00147 result += foot().gather(outputBuffers); 00148 return result; 00149 }
unsigned int LtbReadout::inspectComponents | ( | DaqBuffer::Bytes & | inspectors | ) | const [protected, virtual] |
Inspects the DAQ formatted bytes for this object's components.
Implements DybDaq::DaqContainer.
Definition at line 151 of file LtbReadout.cc.
00151 { 00152 unsigned int result = head().inspect(inspectors); 00153 const LtbFramePtrList& frames = ltbFrames(); 00154 LtbFramePtrList::const_iterator frame; 00155 for (frame = frames.begin(); 00156 frame != frames.end(); 00157 ++frame) { 00158 result += (*frame)->inspect(inspectors); 00159 } 00160 00161 result += foot().inspect(inspectors); 00162 return result; 00163 }
void LtbReadout::expanded | ( | const unsigned int | size | ) | [protected, virtual] |
Tells this object that its contents has expanded by the specified number of bytes.
Implements DybDaq::DaqContainer.
Definition at line 178 of file LtbReadout.cc.
00178 { 00179 LtbFoot& footToUse = foot(); 00180 footToUse.setDataLength(footToUse.dataLength() + (size * kBytesInInt)); 00181 notifyExpandable(size); 00182 }
bool LtbReadout::setRomExpandable | ( | DaqExpandable & | expandable | ) | [protected, virtual] |
Associates the supplied DaqExpanable with this object if it is not already associated with one.
It returns true if the association is successful, false otherwise.
Implements DybDaq::RomData.
Definition at line 184 of file LtbReadout.cc.
00184 { 00185 return setExpandable(expandable); 00186 }
LtbReadout& DybDaq::LtbReadout::operator= | ( | LtbReadout & | rhs | ) | [private] |
Suppress default.
LtbFoot & LtbReadout::foot | ( | ) | [private] |
LtbHead* DybDaq::LtbReadout::m_head [mutable, private] |
LtbFramePtrList* DybDaq::LtbReadout::m_frames [mutable, private] |
LtbFoot* DybDaq::LtbReadout::m_foot [mutable, private] |