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

In This Package:

DybDaq::CbltReadout Class Reference

#include <CbltReadout.h>

Inheritance diagram for DybDaq::CbltReadout:

[legend]
Collaboration diagram for DybDaq::CbltReadout:
[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

 CbltReadout (const unsigned int moduleAddress, const unsigned int moduleType, const RomData *romData, const CbltTraits &traits)
 Create an instance of this class.
 CbltReadout (const ByteBuffer &byteBuffer, const unsigned int length)
 Create an instance of this class.
virtual ~CbltReadout ()
 Destroy this instance of the class.
virtual const DaqTraitsdaqTraits () const
 Returns the DaqTraits instance used to parse this object's buffer.
const CbltHeadhead () const
const CbltBodybody () const
const CbltFootfoot () const
virtual unsigned int romSize () const
 Returns the 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.
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 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

 CbltReadout ()
 Suppress default.
 CbltReadout (CbltReadout &rhs)
 Suppress default.
CbltReadoutoperator= (CbltReadout &rhs)
 Suppress default.
const CbltTraitscbltTraits () const
 Returns the CbltTraits instance used to parse this object's buffer.
CbltFootfoot ()

Private Attributes

CbltHeadm_head
 The CbltHead for this fragment.
CbltBodym_body
 The CbltBody for this event.
CbltFootm_foot
 The CbltFoot for this fragment.

Friends

friend class DaqContainer

Detailed Description

Definition at line 25 of file CbltReadout.h.


Constructor & Destructor Documentation

CbltReadout::CbltReadout ( const unsigned int  moduleAddress,
const unsigned int  moduleType,
const RomData romData,
const CbltTraits traits 
)

Create an instance of this class.

Definition at line 34 of file CbltReadout.cc.

00037                                                    :
00038 DaqContainer(),
00039 m_head(new CbltHead(moduleAddress,
00040                     moduleType,
00041                     traits)),
00042 m_body(new CbltBody(romData,
00043                     moduleType,
00044                     *this)),
00045 m_foot(0) {
00046     const LtbReadout* ltbReadout;
00047     if (0 != (ltbReadout = dynamic_cast<const LtbReadout*>(romData))) {
00048         // TODO: DAQ_ERROR, Fix LTB trigger number!
00049         const LtbHead& ltbHead = ltbReadout->head();
00050         if (ltbHead.ltbTraits().majorVersion() > 3) {
00051             // Set undocumented values
00052         const unsigned int triggerNumber = ltbHead.localTriggerNumber();
00053         *((unsigned int*)m_head->buffer()) = *((const unsigned int*)m_head->buffer())
00054             + ((triggerNumber % 256) * 256)
00055             + (triggerNumber % 256);
00056         }
00057     }
00058     CbltFoot& footToUse = foot();
00059     footToUse.setDataLength(footToUse.dataLength() + (m_body->bufferSize() * kBytesInInt));
00060 }

CbltReadout::CbltReadout ( const ByteBuffer byteBuffer,
const unsigned int  length 
)

Create an instance of this class.

Definition at line 62 of file CbltReadout.cc.

00063                                                         :
00064 DaqContainer(byteBuffer,
00065              bufferSize),
00066 m_head(0),
00067 m_body(0),
00068 m_foot(0) {
00069     byteBuffer.position(byteBuffer.position() + (bufferSize * kBytesInInt));
00070 }

CbltReadout::~CbltReadout (  )  [virtual]

Destroy this instance of the class.

Definition at line 72 of file CbltReadout.cc.

00072                           {
00073     if (0 != m_foot) {
00074         delete m_foot;
00075     }
00076     if (0 != m_body) {
00077         delete m_body;
00078     }
00079     if (0 != m_head) {
00080         delete m_head;
00081     }
00082 }

DybDaq::CbltReadout::CbltReadout (  )  [private]

Suppress default.

DybDaq::CbltReadout::CbltReadout ( CbltReadout rhs  )  [private]

Suppress default.


Member Function Documentation

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

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

Reimplemented from DybDaq::DaqContainer.

Definition at line 84 of file CbltReadout.cc.

00084                                               {
00085     return head().cbltTraits();
00086 }

const CbltHead & CbltReadout::head (  )  const

Definition at line 88 of file CbltReadout.cc.

00088                                         {
00089     if (0 == m_head && hasByteBuffer()) {
00090         const ByteBuffer& buffer = byteBuffer();
00091         const unsigned int originalPosition = buffer.position();
00092         buffer.position(begin());
00093         m_head = new CbltHead(buffer);
00094         buffer.position(originalPosition);
00095     }
00096     return *m_head;
00097 }

const CbltBody & CbltReadout::body (  )  const

Definition at line 99 of file CbltReadout.cc.

00099                                         {
00100     if (0 == m_body) {
00101         if (hasByteBuffer()) {
00102             const CbltTraits& traits = cbltTraits();
00103             const ByteBuffer& buffer = byteBuffer();
00104             
00105             const unsigned int originalPosition = buffer.position();
00106             buffer.position(begin() + (traits.headSize() * kBytesInInt));
00107             m_body = new CbltBody(buffer,
00108                                   head().moduleType(),
00109                                   containerSize() - (traits.headSize() + traits.footSize()),
00110                                   head().cbltTraits());
00111             buffer.position(originalPosition);
00112         }
00113     }
00114     return *m_body;
00115 }

const CbltFoot & CbltReadout::foot (  )  const

Definition at line 117 of file CbltReadout.cc.

00117                                         {
00118     if (0 == m_foot && hasByteBuffer()) {
00119         const CbltTraits& traits = cbltTraits();
00120         const ByteBuffer& buffer = byteBuffer();
00121         
00122         const unsigned int originalPosition = buffer.position();
00123         buffer.position(begin() + ((containerSize() - traits.footSize()) * kBytesInInt));
00124         m_foot = new CbltFoot(buffer,
00125                               head().cbltTraits());
00126         buffer.position(originalPosition);
00127         
00128     }
00129     return *m_foot;
00130 }

unsigned int CbltReadout::romSize (  )  const [virtual]

Returns the size, in 4-bytes, of all the buffers for this object's components.

Implements DybDaq::RomData.

Definition at line 132 of file CbltReadout.cc.

00132                                         {
00133     return bufferSize();
00134 }

unsigned int CbltReadout::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 136 of file CbltReadout.cc.

00136                                                                                   {
00137     return gather(outputBuffers);
00138 }

unsigned int CbltReadout::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 140 of file CbltReadout.cc.

00140                                                                      {
00141     return inspect(inspectors);
00142 }

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

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

Implements DybDaq::DaqContainer.

Definition at line 144 of file CbltReadout.cc.

00144                                            {
00145     unsigned int result = head().bufferSize();
00146     result += body().bufferSize();
00147     result += foot().bufferSize();
00148     return result;
00149 }

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

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

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

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

Implements DybDaq::DaqContainer.

Definition at line 159 of file CbltReadout.cc.

00159                                                                             {
00160     unsigned int result = head().inspect(inspectors);
00161     result += body().inspect(inspectors);
00162     
00163     result += foot().inspect(inspectors);
00164     return result;
00165 }

void CbltReadout::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 167 of file CbltReadout.cc.

00167                                                   {
00168     CbltFoot& footToUse = foot();
00169     footToUse.setDataLength(footToUse.dataLength() + (size * kBytesInInt));
00170     notifyExpandable(size);
00171 }

bool CbltReadout::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 173 of file CbltReadout.cc.

00173                                                             {
00174     return setExpandable(expandable);
00175 }

CbltReadout& DybDaq::CbltReadout::operator= ( CbltReadout rhs  )  [private]

Suppress default.

const CbltTraits & CbltReadout::cbltTraits (  )  const [private]

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

Definition at line 177 of file CbltReadout.cc.

00177                                                 {
00178     return dynamic_cast<const CbltTraits&>(daqTraits());
00179 }

CbltFoot & CbltReadout::foot (  )  [private]

Definition at line 181 of file CbltReadout.cc.

00181                             {
00182     if (0 == m_foot) {
00183         m_foot = new CbltFoot(head());
00184     }
00185     return *m_foot;
00186 }


Member Data Documentation

CbltHead* DybDaq::CbltReadout::m_head [mutable, private]

The CbltHead for this fragment.

Definition at line 143 of file CbltReadout.h.

CbltBody* DybDaq::CbltReadout::m_body [mutable, private]

The CbltBody for this event.

Definition at line 148 of file CbltReadout.h.

CbltFoot* DybDaq::CbltReadout::m_foot [mutable, private]

The CbltFoot for this fragment.

Definition at line 153 of file CbltReadout.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:16 2011 for CbltReadoutFormat by doxygen 1.4.7