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

#include <FadcReadout.h>

Inheritance diagram for DybDaq::FadcReadout:
Inheritance graph
[legend]
Collaboration diagram for DybDaq::FadcReadout:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::vector< const
FadcData * > 
FadcDataPtrList
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

 FadcReadout (const unsigned int triggerNumber, const unsigned int triggerType, const bool noData, const FadcTraits &traits)
 FadcReadout (const ByteBuffer &byteBuffer, const unsigned int length)
 Create an instance of this class.
virtual ~FadcReadout ()
 Destroy this instance of the class.
virtual const DaqTraitsdaqTraits () const
 Returns the DaqTraits instance used to parse this object's buffer.
const FadcHeadhead () const
const FadcDataPtrListfadcData () const
const FadcFootfoot () const
virtual unsigned int romSize () const
 Returns the total 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.
const FadcDataaddData (const unsigned int channel, const unsigned int highDataByte, const unsigned int middleDataByte, const unsigned int lowDataByte)
 Creates a new FadcData in this readout using the supplied values.
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

 FadcReadout ()
 Suppress default.
 FadcReadout (FadcReadout &rhs)
 Suppress default.
FadcReadoutoperator= (FadcReadout &rhs)
 Suppress default.
const FadcDataadd (const FadcData *data)
 Adds the supplied FadcData to this object,.
FadcFootfoot ()

Private Attributes

FadcHeadm_head
 The FadcHead for this fragment.
FadcDataPtrListm_data
 The list of Fadc Data in this object.
FadcFootm_foot
 The FadcFoot for this fragment.

Friends

friend class DaqContainer

Detailed Description

Definition at line 27 of file FadcReadout.h.


Member Typedef Documentation

typedef std::vector<const FadcData*> DybDaq::FadcReadout::FadcDataPtrList

Definition at line 31 of file FadcReadout.h.


Constructor & Destructor Documentation

FadcReadout::FadcReadout ( const unsigned int  triggerNumber,
const unsigned int  triggerType,
const bool  noData,
const FadcTraits traits 
)

Definition at line 25 of file FadcReadout.cc.

                                                   :
    DaqContainer(),
    m_head(new FadcHead(triggerNumber,
                        triggerType,
                        noData,
                        traits)),
    m_data(0),
    m_foot(0) {
}
FadcReadout::FadcReadout ( const ByteBuffer byteBuffer,
const unsigned int  length 
)

Create an instance of this class.

Definition at line 38 of file FadcReadout.cc.

FadcReadout::~FadcReadout ( ) [virtual]

Destroy this instance of the class.

Definition at line 48 of file FadcReadout.cc.

                          {
    if (0 != m_foot) {
        delete m_foot;
    }
    if (0 != m_data) {
        FadcDataPtrList::const_iterator data;
        for (data = m_data->begin();
             data != m_data->end();
             ++data) {
            delete const_cast<FadcData*>(*data);
        }
        delete m_data;
    }
    if (0 != m_head) {
        delete m_head;
    }
}
DybDaq::FadcReadout::FadcReadout ( ) [private]

Suppress default.

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

Suppress default.


Member Function Documentation

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

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

Reimplemented from DybDaq::DaqContainer.

Definition at line 66 of file FadcReadout.cc.

                                              {
    return head().fadcTraits();
}
const FadcHead & FadcReadout::head ( ) const

Definition at line 70 of file FadcReadout.cc.

                                        {
    if (0 == m_head && hasByteBuffer()) {
        const ByteBuffer& buffer = byteBuffer();
        const unsigned int originalPosition = buffer.position();
        buffer.position(begin());
        m_head = new FadcHead(buffer);
        buffer.position(originalPosition);
    }
    return *m_head;
}
const FadcReadout::FadcDataPtrList & FadcReadout::fadcData ( ) const

Definition at line 81 of file FadcReadout.cc.

                                                              {
    if (0 == m_data) {
        m_data = new FadcDataPtrList();
        if (hasByteBuffer()) {
            const FadcTraits& traits = head().fadcTraits();
            const ByteBuffer& buffer = byteBuffer();
            
            const unsigned int originalPosition = buffer.position();
            buffer.position(begin() + (traits.headSize() * kBytesInInt));
            const unsigned int finished = (containerSize() - (traits.headSize() + traits.footSize())) / traits.dataSize();
            for (unsigned int count = 0;
                 count != finished;
                 ++count) {
                FadcData* data = new FadcData(buffer,
                                              traits);
                m_data->push_back(data);
            }
            buffer.position(originalPosition);
        }
    }
    return *m_data;
}
const FadcFoot & FadcReadout::foot ( ) const

Definition at line 104 of file FadcReadout.cc.

                                        {
    if (0 == m_foot) {
        if (hasByteBuffer()) {
            const FadcTraits& traits = head().fadcTraits();
            const ByteBuffer& buffer = byteBuffer();
            
            const unsigned int originalPosition = buffer.position();
            buffer.position(begin() + ((containerSize() - traits.footSize()) * kBytesInInt));
            m_foot = new FadcFoot(buffer,
                                  head().fadcTraits());
            buffer.position(originalPosition);
        } else {
            m_foot = new FadcFoot(head());
        }
    }
    return *m_foot;
}
unsigned int FadcReadout::romSize ( ) const [virtual]

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

Implements DybDaq::RomData.

Definition at line 130 of file FadcReadout.cc.

                                        {
    return bufferSize();
}
unsigned int FadcReadout::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 122 of file FadcReadout.cc.

                                                                                  {
    return gather(outputBuffers);
}
unsigned int FadcReadout::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 126 of file FadcReadout.cc.

                                                                     {
    return inspect(inspectors);
}
unsigned int FadcReadout::bufferSize ( ) const [virtual]

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

Implements DybDaq::DaqContainer.

Definition at line 162 of file FadcReadout.cc.

                                           {
    unsigned int result = head().bufferSize();
    const FadcDataPtrList& data = fadcData();
    FadcDataPtrList::const_iterator entry;
    for (entry = data.begin();
         entry != data.end();
         ++entry) {
        result += (*entry)->bufferSize();
    }
    result += foot().bufferSize();
    return result;
}
const FadcData & FadcReadout::addData ( const unsigned int  channel,
const unsigned int  highDataByte,
const unsigned int  middleDataByte,
const unsigned int  lowDataByte 
)

Creates a new FadcData in this readout using the supplied values.

Definition at line 185 of file FadcReadout.cc.

                                                                     {
    const FadcTraits& traits = head().fadcTraits();
    FadcData* result = new FadcData(channel,
                                    highDataByte,
                                    middleDataByte,
                                    lowDataByte,
                                    traits);
    return add(result);
}
unsigned int FadcReadout::gatherComponents ( OutputBufferList outputBuffers) const [protected, virtual]

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

Implements DybDaq::DaqContainer.

Definition at line 134 of file FadcReadout.cc.

                                                                                {
    unsigned int result = head().gather(outputBuffers);
    const FadcDataPtrList& data = fadcData();
    FadcDataPtrList::const_iterator entry;
    for (entry = data.begin();
         entry != data.end();
         ++entry) {
        result += (*entry)->gather(outputBuffers);
    }
    
    result += foot().gather(outputBuffers);
    return result;
}
unsigned int FadcReadout::inspectComponents ( DaqBuffer::Bytes inspectors) const [protected, virtual]

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

Implements DybDaq::DaqContainer.

Definition at line 148 of file FadcReadout.cc.

                                                                            {
    unsigned int result = head().inspect(inspectors);
    const FadcDataPtrList& data = fadcData();
    FadcDataPtrList::const_iterator entry;
    for (entry = data.begin();
         entry != data.end();
         ++entry) {
        result += (*entry)->inspect(inspectors);
    }
    
    result += foot().inspect(inspectors);
    return result;
}
void FadcReadout::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 175 of file FadcReadout.cc.

                                                  {
    FadcFoot& footToUse = foot();
    footToUse.setDataLength(footToUse.dataLength() + (size * kBytesInInt));
    notifyExpandable(size);
}
bool FadcReadout::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 181 of file FadcReadout.cc.

                                                            {
    return setExpandable(expandable);
}
FadcReadout& DybDaq::FadcReadout::operator= ( FadcReadout rhs) [private]

Suppress default.

const FadcData & FadcReadout::add ( const FadcData data) [private]

Adds the supplied FadcData to this object,.

Definition at line 198 of file FadcReadout.cc.

                                                     {
    if (0 == m_data) {
        m_data = new FadcDataPtrList();
    }
    m_data->push_back(data);
    expanded(data->bufferSize());
    return *data;
}
FadcFoot & FadcReadout::foot ( ) [private]

Definition at line 207 of file FadcReadout.cc.

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

Member Data Documentation

The FadcHead for this fragment.

Definition at line 152 of file FadcReadout.h.

The list of Fadc Data in this object.

Definition at line 157 of file FadcReadout.h.

The FadcFoot for this fragment.

Definition at line 162 of file FadcReadout.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:52:59 for FadcReadoutFormat by doxygen 1.7.4