#include <RomFragment.h>
Inheritance diagram for DybDaq::RomFragment:
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 | ~RomFragment () |
Destroy this instance of the class. | |
const RomHeader & | header () const |
const RomData & | data () const |
const RomData & | unwrappedData () const |
virtual unsigned int | bufferSize () const |
Returns the size, in 4-bytes, of this ojbect's contents in the buffer. | |
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 |
virtual const DaqTraits & | daqTraits () const |
Static Public Attributes | |
static const unsigned int | kBytesInInt |
static const unsigned int | kUndefinedFormatComponent |
Protected Member Functions | |
RomFragment (const unsigned int site, const unsigned int detector, const unsigned int moduleType, const unsigned int slot, const RomData *data, const EventTraits &traits, const bool cbltWrapping, DaqExpandable &expandable) | |
Create an instance of this class. | |
RomFragment (const ByteBuffer &byteBuffer, const EventTraits &traits, const bool cbltWrapping) | |
Create an instance of this class. | |
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. | |
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 | |
RomFragment () | |
Create an instance of this class. | |
RomFragment (RomFragment &rhs) | |
Suppress default. | |
RomFragment & | operator= (RomFragment &rhs) |
Suppress default. | |
Private Attributes | |
RomHeader * | m_header |
The RomHeader for this fragment. | |
const RomData * | m_data |
The RomData for this event. | |
bool | m_cbltWrapping |
True if the current contents are wrapped with CBLT long words. | |
Friends | |
class | EventReadout |
Definition at line 27 of file RomFragment.h.
RomFragment::~RomFragment | ( | ) | [virtual] |
RomFragment::RomFragment | ( | const unsigned int | site, | |
const unsigned int | detector, | |||
const unsigned int | moduleType, | |||
const unsigned int | slot, | |||
const RomData * | data, | |||
const EventTraits & | traits, | |||
const bool | cbltWrapping, | |||
DaqExpandable & | expandable | |||
) | [protected] |
Create an instance of this class.
Definition at line 35 of file RomFragment.cc.
00042 : 00043 DaqContainer(expandable), 00044 m_header(new RomHeader(site, 00045 detector, 00046 moduleType, 00047 slot, 00048 traits)), 00049 m_data(data), 00050 m_cbltWrapping(cbltWrapping) { 00051 expandedByRomData(data); 00052 m_header->setTotalSize(m_header->headerSize() + data->romSize()); 00053 }
RomFragment::RomFragment | ( | const ByteBuffer & | byteBuffer, | |
const EventTraits & | traits, | |||
const bool | cbltWrapping | |||
) | [protected] |
Create an instance of this class.
Definition at line 56 of file RomFragment.cc.
00058 : 00059 DaqContainer(byteBuffer, 00060 traits, 00061 0), 00062 m_header(0), 00063 m_data(0), 00064 m_cbltWrapping(cbltWrapping) { 00065 byteBuffer.position(byteBuffer.position() + (header().totalSize() * kBytesInInt)); 00066 }
DybDaq::RomFragment::RomFragment | ( | ) | [private] |
Create an instance of this class.
DybDaq::RomFragment::RomFragment | ( | RomFragment & | rhs | ) | [private] |
Suppress default.
const RomHeader & RomFragment::header | ( | ) | const |
Definition at line 77 of file RomFragment.cc.
00077 { 00078 if (0 == m_header && hasByteBuffer()) { 00079 const ByteBuffer& buffer = byteBuffer(); 00080 const unsigned int originalPosition = buffer.position(); 00081 buffer.position(begin()); 00082 m_header = new RomHeader(buffer, 00083 dynamic_cast<const EventTraits&>(daqTraits())); 00084 buffer.position(originalPosition); 00085 } 00086 return *m_header; 00087 }
const RomData & RomFragment::data | ( | ) | const |
Definition at line 89 of file RomFragment.cc.
00089 { 00090 if (0 == m_data && hasByteBuffer()) { 00091 const ByteBuffer& buffer = byteBuffer(); 00092 const unsigned int originalPosition = buffer.position(); 00093 const RomHeader& romHeader = header(); 00094 const unsigned int headerSize = romHeader.headerSize(); 00095 buffer.position(begin() + (headerSize * kBytesInInt)); 00096 unsigned dataSize = romHeader.totalSize() - headerSize; 00097 // Check whether data contains CBLT wrappings 00098 static const unsigned int cbltMask = 0xf0000000U; 00099 static const unsigned int cbltValue = 0x20000000U; 00100 const unsigned int peek = *((unsigned int*)(buffer.cursor())); 00101 // 00102 if (m_cbltWrapping || (cbltValue == (peek & cbltMask))) { 00103 m_data = new CbltReadout(buffer, 00104 dataSize); 00105 00106 } else { 00107 const EventTraits& traits = romHeader.eventTraits(); 00108 const unsigned int moduleType = romHeader.moduleType(); 00109 if (moduleType == traits.moduleType(EventTraits::kFadcModule)) { 00110 m_data = new FadcReadout(buffer, 00111 dataSize); 00112 } else if (moduleType == traits.moduleType(EventTraits::kFeeModule)) { 00113 m_data = new FeeReadout(buffer, 00114 dataSize); 00115 } else if (moduleType == traits.moduleType(EventTraits::kLtbModule)) { 00116 m_data = new LtbReadout(buffer, 00117 dataSize); 00118 } 00119 else if (moduleType == traits.moduleType(EventTraits::kRpcRomModule)) { 00120 m_data = new FecReadout(buffer, dataSize); 00121 } 00122 else if (moduleType == traits.moduleType(EventTraits::kRpcRtmModule)) { 00123 m_data = new RtmReadout(buffer, dataSize); 00124 } 00125 } 00126 buffer.position(originalPosition); 00127 } 00128 return *m_data; 00129 }
const RomData & RomFragment::unwrappedData | ( | ) | const |
Definition at line 131 of file RomFragment.cc.
00131 { 00132 // Make sure m_data is filled 00133 data(); 00134 const CbltReadout* cbltReadout = dynamic_cast<const CbltReadout*> (m_data); 00135 if (0 == cbltReadout) { 00136 return *m_data; 00137 } 00138 return cbltReadout->body().data(); 00139 }
unsigned int RomFragment::bufferSize | ( | ) | const [virtual] |
Returns the size, in 4-bytes, of this ojbect's contents in the buffer.
Implements DybDaq::DaqContainer.
Definition at line 142 of file RomFragment.cc.
virtual unsigned int DybDaq::RomFragment::gatherComponents | ( | OutputBufferList & | outputBuffers | ) | const [protected, virtual] |
Gathers the DAQ formatted bytes for this object's components.
unsigned int RomFragment::inspectComponents | ( | DaqBuffer::Bytes & | inspectors | ) | const [protected, virtual] |
Inspects the DAQ formatted bytes for this object's components.
Implements DybDaq::DaqContainer.
Definition at line 153 of file RomFragment.cc.
00153 { 00154 unsigned int result = header().inspect(inspectors); 00155 00156 result += data().inspectRom(inspectors); 00157 return result; 00158 }
void RomFragment::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 160 of file RomFragment.cc.
00160 { 00161 // If this is non-const, then header must already exist. 00162 m_header->setTotalSize(m_header->totalSize() + size); 00163 notifyExpandable(size); 00164 }
RomFragment& DybDaq::RomFragment::operator= | ( | RomFragment & | rhs | ) | [private] |
Suppress default.
friend class EventReadout [friend] |
Definition at line 31 of file RomFragment.h.
RomHeader* DybDaq::RomFragment::m_header [mutable, private] |
const RomData* DybDaq::RomFragment::m_data [mutable, private] |
bool DybDaq::RomFragment::m_cbltWrapping [private] |
True if the current contents are wrapped with CBLT long words.
Definition at line 124 of file RomFragment.h.