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

In This Package:

DybDaq::EventReadout Class Reference

#include <EventReadout.h>

Inheritance diagram for DybDaq::EventReadout:

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

Public Types

typedef std::vector< const
RomFragment * > 
RomFragmentPtrList
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

 EventReadout (const EventReadout &rhs)
 Create an instance of this class.
 EventReadout (const unsigned int site, const unsigned int detector, const unsigned int run, const unsigned int event, const unsigned int dataType, const bool rawCblt, const bool triggerMismatch, const bool invalidData, const EventTraits &traits)
 Create an instance of this class.
 EventReadout (const unsigned int site, const unsigned int detector, const unsigned int run, const unsigned int event, const unsigned int dataType, const bool rawCblt, const bool triggerMismatch, const bool invalidData, const CbltTraits &cbltTraits, const EventTraits &traits)
 Create an instance of this class.
 EventReadout (const ByteBuffer &byteBuffer)
 Create an instance of this class.
virtual ~EventReadout ()
 Destroy this instance of the class.
virtual const DaqTraitsdaqTraits () const
 Returns the DaqTraits instance used to parse this object's buffer.
const EventHeaderheader () const
 Returns the EventHeader for this event.
const RomFragmentPtrListromFragments () const
 Returns the list of RomFragments in this event.
virtual unsigned int bufferSize () const
 Returns the size, in 4-bytes, of this ojbect's contents in the buffer.
void addReadout (const FadcReadout *readout, const unsigned int slot)
void addReadout (const FeeReadout *readout, const unsigned int slot)
void addReadout (const LtbReadout *readout, const unsigned int slot)
void addReadout (const FecReadout *readout, const unsigned int slot)
void addReadout (const RtmReadout *readout, const unsigned int slot)
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.
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

 EventReadout ()
 Create an instance of this class.
EventReadoutoperator= (const EventReadout &rhs)
 Suppress default.
void addReadout (const RomData *readout, const unsigned int slot, const unsigned int moduleType)
const RomFragmentadd (const RomFragment *fragment)
 Adds the supplied RomFragment to this object,.

Private Attributes

EventHeaderm_header
 The EventHeader for this object.
std::vector< const RomFragment * > * m_fragments
 The list of RomFragments in this object.
const CbltTraitsm_cbltTraits
 The CbltTraits, if any, to use when wrapping rom data.

Detailed Description

Definition at line 32 of file EventReadout.h.


Member Typedef Documentation

typedef std::vector<const RomFragment*> DybDaq::EventReadout::RomFragmentPtrList

Definition at line 36 of file EventReadout.h.


Constructor & Destructor Documentation

EventReadout::EventReadout ( const EventReadout rhs  ) 

Create an instance of this class.

Definition at line 39 of file EventReadout.cc.

00039                                                      :
00040 DaqContainer(readout),
00041 m_header(0),
00042 m_fragments(0),
00043 m_cbltTraits((CbltTraits*)0) {
00044     // Currently assumes a ByteBuffer based EventReadout is being copied.
00045 }

EventReadout::EventReadout ( const unsigned int  site,
const unsigned int  detector,
const unsigned int  run,
const unsigned int  event,
const unsigned int  dataType,
const bool  rawCblt,
const bool  triggerMismatch,
const bool  invalidData,
const EventTraits traits 
)

Create an instance of this class.

Definition at line 47 of file EventReadout.cc.

00055                                                       :
00056 DaqContainer(),
00057 m_header(new EventHeader(site,
00058                          detector,
00059                          run,
00060                          event,
00061                          dataType,
00062                          false,
00063                          rawCblt,
00064                          triggerMismatch,
00065                          invalidData,
00066                          traits)),
00067 m_fragments(0),
00068 m_cbltTraits((CbltTraits*)0) {
00069 }

EventReadout::EventReadout ( const unsigned int  site,
const unsigned int  detector,
const unsigned int  run,
const unsigned int  event,
const unsigned int  dataType,
const bool  rawCblt,
const bool  triggerMismatch,
const bool  invalidData,
const CbltTraits cbltTraits,
const EventTraits traits 
)

Create an instance of this class.

Definition at line 71 of file EventReadout.cc.

00080                                                       :
00081 DaqContainer(),
00082 m_header(new EventHeader(site,
00083                          detector,
00084                          run,
00085                          event,
00086                          dataType,
00087                          true,
00088                          rawCblt,
00089                          triggerMismatch,
00090                          invalidData,
00091                          traits)),
00092 m_fragments(0),
00093 m_cbltTraits(&cbltTraits) {
00094 }

EventReadout::EventReadout ( const ByteBuffer byteBuffer  ) 

Create an instance of this class.

Definition at line 96 of file EventReadout.cc.

00096                                                        :
00097 DaqContainer(byteBuffer,
00098              0),
00099 m_header(0),
00100 m_fragments(0),
00101 m_cbltTraits((CbltTraits*)0) {
00102     byteBuffer.position(byteBuffer.position() + (header().totalSize() * kBytesInInt));
00103 }

EventReadout::~EventReadout (  )  [virtual]

Destroy this instance of the class.

Definition at line 105 of file EventReadout.cc.

00105                             {
00106     if (0 != m_fragments) {
00107         RomFragmentPtrList::iterator fragment;
00108         for (fragment = m_fragments->begin();
00109              fragment != m_fragments->end();
00110              ++fragment) {
00111             delete const_cast<RomFragment*>(*fragment);
00112         }
00113         delete m_fragments;
00114     }
00115     if (0 != m_header) {
00116         delete m_header;
00117     }
00118 }

DybDaq::EventReadout::EventReadout (  )  [private]

Create an instance of this class.


Member Function Documentation

const DaqTraits & EventReadout::daqTraits (  )  const [virtual]

Returns the DaqTraits instance used to parse this object's buffer.

Reimplemented from DybDaq::DaqContainer.

Definition at line 120 of file EventReadout.cc.

00120                                                {
00121     return header().eventTraits();
00122 }

const EventHeader & EventReadout::header (  )  const

Returns the EventHeader for this event.

Definition at line 124 of file EventReadout.cc.

00124                                               {
00125     if (0 == m_header && hasByteBuffer()) {
00126         const ByteBuffer& buffer = byteBuffer();
00127         
00128         const unsigned int originalPosition = buffer.position();
00129         buffer.position(begin());
00130         m_header = new EventHeader(buffer);
00131         buffer.position(originalPosition);
00132     }
00133     return *m_header;
00134 }

const EventReadout::RomFragmentPtrList & EventReadout::romFragments (  )  const

Returns the list of RomFragments in this event.

Definition at line 136 of file EventReadout.cc.

00136                                                                        {
00137     if (0 == m_fragments) {
00138         m_fragments = new RomFragmentPtrList();
00139         if (hasByteBuffer()) {
00140             const ByteBuffer& buffer = byteBuffer();
00141             
00142             const unsigned int originalPosition = buffer.position();
00143             buffer.position(begin() + (header().headerSize() * kBytesInInt));
00144             const EventTraits& traits = header().eventTraits();
00145             const bool cbltWrapping = header().cbltWrapping();
00146             const unsigned int finished = begin() + (bufferSize() * kBytesInInt);
00147             while (buffer.position() != finished) {
00148                 const RomFragment* romFragment = new RomFragment(buffer,
00149                                                                  traits,
00150                                                                  cbltWrapping);
00151                 m_fragments->push_back(romFragment);
00152             }
00153             buffer.position(originalPosition);
00154         }
00155     }
00156         return *m_fragments;
00157 }

unsigned int EventReadout::bufferSize (  )  const [virtual]

Returns the size, in 4-bytes, of this ojbect's contents in the buffer.

Implements DybDaq::DaqContainer.

Definition at line 159 of file EventReadout.cc.

00159                                             {
00160     return header().totalSize();
00161 }

void EventReadout::addReadout ( const FadcReadout readout,
const unsigned int  slot 
)

Definition at line 193 of file EventReadout.cc.

00194                                                        {
00195     addReadout(readout,
00196                slot,
00197                header().eventTraits().moduleType(EventTraits::kFadcModule));
00198 }

void EventReadout::addReadout ( const FeeReadout readout,
const unsigned int  slot 
)

Definition at line 200 of file EventReadout.cc.

00201                                                        {
00202     addReadout(readout,
00203                slot,
00204                header().eventTraits().moduleType(EventTraits::kFeeModule));
00205 }

void EventReadout::addReadout ( const LtbReadout readout,
const unsigned int  slot 
)

Definition at line 207 of file EventReadout.cc.

00208                                                        {
00209     
00210     addReadout(readout,
00211                slot,
00212                header().eventTraits().moduleType(EventTraits::kLtbModule));
00213 }

void EventReadout::addReadout ( const FecReadout readout,
const unsigned int  slot 
)

Definition at line 215 of file EventReadout.cc.

00216                                                        {
00217     
00218     addReadout(readout,
00219                slot,
00220                header().eventTraits().moduleType(EventTraits::kRpcRomModule));
00221 }

void EventReadout::addReadout ( const RtmReadout readout,
const unsigned int  slot 
)

Definition at line 223 of file EventReadout.cc.

00224                                                        {
00225     
00226     addReadout(readout,
00227                slot,
00228                header().eventTraits().moduleType(EventTraits::kRpcRtmModule));
00229 }

unsigned int EventReadout::gatherComponents ( OutputBufferList outputBuffers  )  const [protected, virtual]

Gathers the DAQ formatted bytes for this object's components.

Definition at line 163 of file EventReadout.cc.

00163                                                                                  {
00164     unsigned int result = header().gather(outputBuffers);
00165     const RomFragmentPtrList& fragments = romFragments();
00166     RomFragmentPtrList::const_iterator fragment;
00167     for (fragment = fragments.begin();
00168          fragment != fragments.end();
00169          ++fragment) {
00170         result += (*fragment)->gather(outputBuffers);
00171     }
00172     return result;
00173 }

unsigned int EventReadout::inspectComponents ( DaqBuffer::Bytes inspectors  )  const [protected, virtual]

Inspects the DAQ formatted bytes for this object's components.

Implements DybDaq::DaqContainer.

Definition at line 175 of file EventReadout.cc.

00175                                                                              {
00176     unsigned int result = header().inspect(inspectors);
00177     const RomFragmentPtrList& fragments = romFragments();
00178     RomFragmentPtrList::const_iterator fragment;
00179     for (fragment = fragments.begin();
00180          fragment != fragments.end();
00181          ++fragment) {
00182         result += (*fragment)->inspect(inspectors);
00183     }
00184     return result;
00185 }

void EventReadout::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 187 of file EventReadout.cc.

00187                                                    {
00188     // If this is non-const, then header must already exist.
00189     m_header->setTotalSize(m_header->totalSize() + size);
00190     notifyExpandable(size);
00191 }

EventReadout& DybDaq::EventReadout::operator= ( const EventReadout rhs  )  [private]

Suppress default.

void EventReadout::addReadout ( const RomData readout,
const unsigned int  slot,
const unsigned int  moduleType 
) [private]

Definition at line 231 of file EventReadout.cc.

00233                                                              {
00234     RomFragment* result;
00235     if (header().cbltWrapping()) {
00236         CbltReadout* cbltReadout = new CbltReadout(slot,
00237                                                    moduleType,
00238                                                    readout,
00239                                                    *m_cbltTraits);
00240         result = new RomFragment(header().site(),
00241                                  header().detector(),
00242                                  moduleType,
00243                                  slot,
00244                                  cbltReadout,
00245                                  header().eventTraits(),
00246                                  true,
00247                                  *this);
00248     } else {
00249         result = new RomFragment(header().site(),
00250                                  header().detector(),
00251                                  moduleType,
00252                                  slot,
00253                                  readout,
00254                                  header().eventTraits(),
00255                                  false,
00256                                  *this);
00257     }
00258     add(result);
00259 }

const RomFragment & EventReadout::add ( const RomFragment fragment  )  [private]

Adds the supplied RomFragment to this object,.

Definition at line 261 of file EventReadout.cc.

00261                                                                 {
00262     if (0 == m_fragments) {
00263         m_fragments = new RomFragmentPtrList();
00264     }
00265     m_fragments->push_back(fragment);
00266     expanded(fragment->bufferSize());
00267     return *fragment;
00268 }


Member Data Documentation

EventHeader* DybDaq::EventReadout::m_header [mutable, private]

The EventHeader for this object.

Definition at line 157 of file EventReadout.h.

std::vector<const RomFragment*>* DybDaq::EventReadout::m_fragments [mutable, private]

The list of RomFragments in this object.

Definition at line 162 of file EventReadout.h.

const CbltTraits* DybDaq::EventReadout::m_cbltTraits [private]

The CbltTraits, if any, to use when wrapping rom data.

Definition at line 167 of file EventReadout.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:24 2011 for EventReadoutFormat by doxygen 1.4.7