| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

DybDaq::RomFragment Class Reference

#include <RomFragment.h>

Inheritance diagram for DybDaq::RomFragment:

[legend]
Collaboration diagram for DybDaq::RomFragment:
[legend]
List of all members.

Public Types

typedef std::pair< const char *,
unsigned int > 
OutputBuffer
typedef std::vector< OutputBufferOutputBufferList
typedef std::vector< ByteInspector * > Bytes
typedef std::vector< BitsInspector * > Bits

Public Member Functions

virtual ~RomFragment ()
 Destroy this instance of the class.
const RomHeaderheader () const
const RomDatadata () const
const RomDataunwrappedData () 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 DaqTraitsdaqTraits () 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 ByteBufferbyteBuffer () 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.
RomFragmentoperator= (RomFragment &rhs)
 Suppress default.

Private Attributes

RomHeaderm_header
 The RomHeader for this fragment.
const RomDatam_data
 The RomData for this event.
bool m_cbltWrapping
 True if the current contents are wrapped with CBLT long words.

Friends

class EventReadout

Detailed Description

Definition at line 27 of file RomFragment.h.


Constructor & Destructor Documentation

RomFragment::~RomFragment (  )  [virtual]

Destroy this instance of the class.

Definition at line 68 of file RomFragment.cc.

00068                           {
00069     if (0 != m_data) {
00070         delete m_data;
00071     }
00072     if (0 != m_header) {
00073         delete m_header;
00074     }
00075 }

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.


Member Function Documentation

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.

00142                                            {
00143     return header().totalSize();
00144 }

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.


Friends And Related Function Documentation

friend class EventReadout [friend]

Definition at line 31 of file RomFragment.h.


Member Data Documentation

RomHeader* DybDaq::RomFragment::m_header [mutable, private]

The RomHeader for this fragment.

Definition at line 114 of file RomFragment.h.

const RomData* DybDaq::RomFragment::m_data [mutable, private]

The RomData for this event.

Definition at line 119 of file RomFragment.h.

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.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:08:25 2011 for EventReadoutFormat by doxygen 1.4.7