/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::RomFragment Class Reference

#include <RomFragment.h>

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

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 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
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 69 of file RomFragment.cc.

                          {
    if (0 != m_data) {
        delete m_data;
    }
    if (0 != m_header) {
        delete m_header;
    }
}
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 36 of file RomFragment.cc.

                                                    :
DaqContainer(expandable),
m_header(new RomHeader(site,
                       detector,
                       moduleType,
                       slot,
                       traits)),
m_data(data),
m_cbltWrapping(cbltWrapping) {
    expandedByRomData(data);
    m_header->setTotalSize(m_header->headerSize() + data->romSize());
}
RomFragment::RomFragment ( const ByteBuffer byteBuffer,
const EventTraits traits,
const bool  cbltWrapping 
) [protected]

Create an instance of this class.

Definition at line 57 of file RomFragment.cc.

                                                  :
DaqContainer(byteBuffer,
             traits,
             0),
m_header(0),
m_data(0),
m_cbltWrapping(cbltWrapping) {
    byteBuffer.position(byteBuffer.position() + (header().totalSize() * kBytesInInt));
}
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 78 of file RomFragment.cc.

                                           {
    if (0 == m_header && hasByteBuffer()) {
        const ByteBuffer& buffer = byteBuffer();
        const unsigned int originalPosition = buffer.position();
        buffer.position(begin());
        m_header = new RomHeader(buffer,
                                 dynamic_cast<const EventTraits&>(daqTraits()));
        buffer.position(originalPosition);
    }
    return *m_header;
}
const RomData & RomFragment::data ( ) const

Definition at line 90 of file RomFragment.cc.

                                       {
    if (0 == m_data && hasByteBuffer()) {
        const ByteBuffer& buffer = byteBuffer();
        const unsigned int originalPosition = buffer.position();
        const RomHeader& romHeader = header();
        const unsigned int headerSize = romHeader.headerSize();
        buffer.position(begin() + (headerSize * kBytesInInt));
        unsigned dataSize = romHeader.totalSize() - headerSize;
        // Check whether data contains CBLT wrappings
        static const unsigned int cbltMask = 0xf0000000U;
        static const unsigned int cbltValue = 0x20000000U;
        const unsigned int peek = *((unsigned int*)(buffer.cursor()));
        //
        if (dataSize != 0 && (m_cbltWrapping || (cbltValue == (peek & cbltMask))) ) {
            m_data = new CbltReadout(buffer,
                                     dataSize);
            
        } else {
            const EventTraits& traits = romHeader.eventTraits();
            const unsigned int moduleType = romHeader.moduleType();
            if (moduleType == traits.moduleType(EventTraits::kFadcModule)) {
                m_data = new FadcReadout(buffer,
                                         dataSize);
            } else if (moduleType == traits.moduleType(EventTraits::kFeeModule)) {
                m_data = new FeeReadout(buffer,
                                        dataSize);
            } else if (moduleType == traits.moduleType(EventTraits::kLtbModule)) {
                m_data = new LtbReadout(buffer,
                                        dataSize);
            }
            else if (moduleType == traits.moduleType(EventTraits::kRpcRomModule)) {
               m_data = new FecReadout(buffer, dataSize);
            }
            else if (moduleType == traits.moduleType(EventTraits::kRpcRtmModule)) {
               m_data = new RtmReadout(buffer, dataSize);
            }
        }
        buffer.position(originalPosition);
    }
    return *m_data;
}
const RomData & RomFragment::unwrappedData ( ) const

Definition at line 132 of file RomFragment.cc.

                                                {
    // Make sure m_data is filled
    data();
    const CbltReadout* cbltReadout = dynamic_cast<const CbltReadout*> (m_data);
    if (0 == cbltReadout) {
        return *m_data;
    }
    return cbltReadout->body().data();
}
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 143 of file RomFragment.cc.

                                           {
    return header().totalSize();
}
unsigned int RomFragment::gatherComponents ( DaqBuffer::OutputBufferList outputBuffers) const [protected, virtual]

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

Implements DybDaq::DaqContainer.

Definition at line 147 of file RomFragment.cc.

                                                                                         {
    unsigned int result = header().gather(outputBuffers);
    
    result += data().gatherRom(outputBuffers);
    return result;
}
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 154 of file RomFragment.cc.

                                                                            {
    unsigned int result = header().inspect(inspectors);
    
    result += data().inspectRom(inspectors);
    return result;
}
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 161 of file RomFragment.cc.

                                                  {
    // If this is non-const, then header must already exist.
    m_header->setTotalSize(m_header->totalSize() + size);
    notifyExpandable(size);
}
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

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.

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