/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | Friends
DybDaq::CbltReadout Class Reference

#include <CbltReadout.h>

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

                                                   :
DaqContainer(),
m_head(new CbltHead(moduleAddress,
                    moduleType,
                    traits)),
m_body(new CbltBody(romData,
                    moduleType,
                    *this)),
m_foot(0) {
    const LtbReadout* ltbReadout;
    if (0 != (ltbReadout = dynamic_cast<const LtbReadout*>(romData))) {
        // TODO: DAQ_ERROR, Fix LTB trigger number!
        const LtbHead& ltbHead = ltbReadout->head();
        if (ltbHead.ltbTraits().majorVersion() > 3) {
            // Set undocumented values
        const unsigned int triggerNumber = ltbHead.localTriggerNumber();
        *((unsigned int*)m_head->buffer()) = *((const unsigned int*)m_head->buffer())
            + ((triggerNumber % 256) * 256)
            + (triggerNumber % 256);
        }
    }
    CbltFoot& footToUse = foot();
    footToUse.setDataLength(footToUse.dataLength() + (m_body->bufferSize() * kBytesInInt));
}
CbltReadout::CbltReadout ( const ByteBuffer byteBuffer,
const unsigned int  length 
)

Create an instance of this class.

Definition at line 62 of file CbltReadout.cc.

                                                        :
DaqContainer(byteBuffer,
             bufferSize),
m_head(0),
m_body(0),
m_foot(0) {
    byteBuffer.position(byteBuffer.position() + (bufferSize * kBytesInInt));
}
CbltReadout::~CbltReadout ( ) [virtual]

Destroy this instance of the class.

Definition at line 72 of file CbltReadout.cc.

                          {
    if (0 != m_foot) {
        delete m_foot;
    }
    if (0 != m_body) {
        delete m_body;
    }
    if (0 != m_head) {
        delete m_head;
    }
}
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.

                                              {
    return head().cbltTraits();
}
const CbltHead & CbltReadout::head ( ) const

Definition at line 88 of file CbltReadout.cc.

                                        {
    if (0 == m_head && hasByteBuffer()) {
        const ByteBuffer& buffer = byteBuffer();
        const unsigned int originalPosition = buffer.position();
        buffer.position(begin());
        m_head = new CbltHead(buffer);
        buffer.position(originalPosition);
    }
    return *m_head;
}
const CbltBody & CbltReadout::body ( ) const

Definition at line 99 of file CbltReadout.cc.

                                        {
    if (0 == m_body) {
        if (hasByteBuffer()) {
            const CbltTraits& traits = cbltTraits();
            const ByteBuffer& buffer = byteBuffer();
            
            const unsigned int originalPosition = buffer.position();
            buffer.position(begin() + (traits.headSize() * kBytesInInt));
            m_body = new CbltBody(buffer,
                                  head().moduleType(),
                                  containerSize() - (traits.headSize() + traits.footSize()),
                                  head().cbltTraits());
            buffer.position(originalPosition);
        }
    }
    return *m_body;
}
const CbltFoot & CbltReadout::foot ( ) const

Definition at line 117 of file CbltReadout.cc.

                                        {
    if (0 == m_foot && hasByteBuffer()) {
        const CbltTraits& traits = cbltTraits();
        const ByteBuffer& buffer = byteBuffer();
        
        const unsigned int originalPosition = buffer.position();
        buffer.position(begin() + ((containerSize() - traits.footSize()) * kBytesInInt));
        m_foot = new CbltFoot(buffer,
                              head().cbltTraits());
        buffer.position(originalPosition);
        
    }
    return *m_foot;
}
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.

                                        {
    return bufferSize();
}
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.

                                                                                  {
    return gather(outputBuffers);
}
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.

                                                                     {
    return inspect(inspectors);
}
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.

                                           {
    unsigned int result = head().bufferSize();
    result += body().bufferSize();
    result += foot().bufferSize();
    return result;
}
unsigned int CbltReadout::gatherComponents ( DaqBuffer::OutputBufferList outputBuffers) const [protected, virtual]

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

Implements DybDaq::DaqContainer.

Definition at line 151 of file CbltReadout.cc.

                                                                                         {
    unsigned int result = head().gather(outputBuffers);
    result += body().gather(outputBuffers);
    
    result += foot().gather(outputBuffers);
    return result;
}
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.

                                                                            {
    unsigned int result = head().inspect(inspectors);
    result += body().inspect(inspectors);
    
    result += foot().inspect(inspectors);
    return result;
}
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.

                                                  {
    CbltFoot& footToUse = foot();
    footToUse.setDataLength(footToUse.dataLength() + (size * kBytesInInt));
    notifyExpandable(size);
}
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.

                                                            {
    return setExpandable(expandable);
}
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.

                                                {
    return dynamic_cast<const CbltTraits&>(daqTraits());
}
CbltFoot & CbltReadout::foot ( ) [private]

Definition at line 181 of file CbltReadout.cc.

                            {
    if (0 == m_foot) {
        m_foot = new CbltFoot(head());
    }
    return *m_foot;
}

Member Data Documentation

The CbltHead for this fragment.

Definition at line 143 of file CbltReadout.h.

The CbltBody for this event.

Definition at line 148 of file CbltReadout.h.

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 Fri May 16 2014 09:53:11 for CbltReadoutFormat by doxygen 1.7.4