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

In This Package:

DybDaq::FeeReadout Class Reference

#include <FeeReadout.h>

Inheritance diagram for DybDaq::FeeReadout:

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

Public Types

typedef std::vector< const
FeeHit * > 
FeeHitPtrList
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

 FeeReadout (const unsigned int triggerNumber, const unsigned int triggerType, const bool checked, const bool error, const FeeTraits &traits)
 FeeReadout (const ByteBuffer &byteBuffer, const unsigned int length)
 Create an instance of this class.
virtual ~FeeReadout ()
 Destroy this instance of the class.
virtual const DaqTraitsdaqTraits () const
 Returns the DaqTraits instance used to parse this object's buffer.
const FeeHeadhead () const
const FeeHitPtrListfeeHits () const
const FeeFootfoot () 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 FeeHitaddHit (const unsigned int channel, const unsigned int peakCycle, const bool highRangeAdc, const unsigned int pedestal, const unsigned int charge, const unsigned int hitNumber, const unsigned int time)
 Creates a new FeeHit in this readout using the supplied values.
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

 FeeReadout ()
 Suppress default.
 FeeReadout (FeeReadout &rhs)
 Suppress default.
FeeReadoutoperator= (FeeReadout &rhs)
 Suppress default.
const FeeHitadd (const FeeHit *hit)
 Adds the supplied FeeHit to this object,.
FeeFootfoot ()

Private Attributes

FeeHeadm_head
 The FeeHead for this fragment.
FeeHitPtrListm_hits
 The list of Fee Hits in this object.
FeeFootm_foot
 The FeeFoot for this fragment.

Friends

friend class DaqContainer

Detailed Description

Definition at line 27 of file FeeReadout.h.


Member Typedef Documentation

typedef std::vector<const FeeHit*> DybDaq::FeeReadout::FeeHitPtrList

Definition at line 31 of file FeeReadout.h.


Constructor & Destructor Documentation

FeeReadout::FeeReadout ( const unsigned int  triggerNumber,
const unsigned int  triggerType,
const bool  checked,
const bool  error,
const FeeTraits traits 
)

Definition at line 25 of file FeeReadout.cc.

00029                                                 :
00030 DaqContainer(),
00031 m_head(new FeeHead(triggerNumber,
00032                    triggerType,
00033                    checked,
00034                    error,
00035                    traits)),
00036 m_hits(0),
00037 m_foot(0) {
00038 }

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

Create an instance of this class.

Definition at line 40 of file FeeReadout.cc.

00041                                                       :
00042 DaqContainer(byteBuffer,
00043              bufferSize),
00044 m_head(0),
00045 m_hits(0),
00046 m_foot(0) {
00047     byteBuffer.position(byteBuffer.position() + (bufferSize * kBytesInInt));
00048 }

FeeReadout::~FeeReadout (  )  [virtual]

Destroy this instance of the class.

Definition at line 50 of file FeeReadout.cc.

00050                         {
00051     if (0 != m_foot) {
00052         delete m_foot;
00053     }
00054         if (0 != m_hits) {
00055                 FeeHitPtrList::const_iterator hit;
00056                 for (hit = m_hits->begin();
00057                          hit != m_hits->end();
00058                          ++hit) {
00059                         delete const_cast<FeeHit*>(*hit);
00060                 }
00061                 delete m_hits;
00062         }
00063     if (0 != m_head) {
00064         delete m_head;
00065     }
00066 }

DybDaq::FeeReadout::FeeReadout (  )  [private]

Suppress default.

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

Suppress default.


Member Function Documentation

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

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

Reimplemented from DybDaq::DaqContainer.

Definition at line 68 of file FeeReadout.cc.

00068                                              {
00069     return head().feeTraits();
00070 }

const FeeHead & FeeReadout::head (  )  const

Definition at line 72 of file FeeReadout.cc.

00072                                       {
00073     if (0 == m_head && hasByteBuffer()) {
00074         const ByteBuffer& buffer = byteBuffer();
00075         const unsigned int originalPosition = buffer.position();
00076         buffer.position(begin());
00077         m_head = new FeeHead(buffer);
00078         buffer.position(originalPosition);
00079     }
00080     return *m_head;
00081 }

const FeeReadout::FeeHitPtrList & FeeReadout::feeHits (  )  const

Definition at line 83 of file FeeReadout.cc.

00083                                                          {
00084     if (0 == m_hits) {
00085         m_hits = new FeeHitPtrList();
00086         if (hasByteBuffer()) {
00087             const FeeTraits& traits = head().feeTraits();
00088             const ByteBuffer& buffer = byteBuffer();
00089             
00090             const unsigned int originalPosition = buffer.position();
00091             buffer.position(begin() + (traits.headSize() * kBytesInInt));
00092             const unsigned int finished = (containerSize() - (traits.headSize() + traits.footSize())) / traits.hitSize();
00093             for (unsigned int count = 0;
00094                  count != finished;
00095                  ++count) {
00096                 FeeHit* hit = new FeeHit(buffer,
00097                                          traits);
00098                 m_hits->push_back(hit);
00099             }
00100             buffer.position(originalPosition);
00101         }
00102     }
00103     return *m_hits;
00104 }

const FeeFoot & FeeReadout::foot (  )  const

Definition at line 106 of file FeeReadout.cc.

00106                                       {
00107     if (0 == m_foot) {
00108         if (hasByteBuffer()) {
00109             const FeeTraits& traits = head().feeTraits();
00110             const ByteBuffer& buffer = byteBuffer();
00111             
00112             const unsigned int originalPosition = buffer.position();
00113             buffer.position(begin() + ((containerSize() - traits.footSize()) * kBytesInInt));
00114             m_foot = new FeeFoot(buffer,
00115                                  head().feeTraits());
00116             buffer.position(originalPosition);
00117         } else {
00118             m_foot = new FeeFoot(head());
00119         }
00120     }
00121     return *m_foot;
00122 }

unsigned int FeeReadout::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 132 of file FeeReadout.cc.

00132                                        {
00133     return bufferSize();
00134 }

unsigned int FeeReadout::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 124 of file FeeReadout.cc.

00124                                                                                  {
00125     return gather(outputBuffers);
00126 }

unsigned int FeeReadout::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 128 of file FeeReadout.cc.

00128                                                                     {
00129     return inspect(inspectors);
00130 }

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

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

Implements DybDaq::DaqContainer.

Definition at line 164 of file FeeReadout.cc.

00164                                           {
00165     unsigned int result = head().bufferSize();
00166     const FeeHitPtrList& hits = feeHits();
00167     FeeHitPtrList::const_iterator hit;
00168     for (hit = hits.begin();
00169          hit != hits.end();
00170          ++hit) {
00171         result += (*hit)->bufferSize();
00172     }
00173     result += foot().bufferSize();
00174     return result;
00175 }

const FeeHit & FeeReadout::addHit ( const unsigned int  channel,
const unsigned int  peakCycle,
const bool  highRangeAdc,
const unsigned int  pedestal,
const unsigned int  charge,
const unsigned int  hitNumber,
const unsigned int  time 
)

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

Definition at line 187 of file FeeReadout.cc.

00193                                                              {
00194     const FeeTraits& traits = head().feeTraits();
00195     FeeHit* result = new FeeHit(channel,
00196                                 peakCycle,
00197                                 highRangeAdc,
00198                                 pedestal,
00199                                 charge,
00200                                 hitNumber,
00201                                 time,
00202                                 traits);
00203     return add(result);
00204 }

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

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

Definition at line 136 of file FeeReadout.cc.

00136                                                                                {
00137     unsigned int result = head().gather(outputBuffers);
00138     const FeeHitPtrList& hits = feeHits();
00139     FeeHitPtrList::const_iterator hit;
00140     for (hit = hits.begin();
00141          hit != hits.end();
00142          ++hit) {
00143         result += (*hit)->gather(outputBuffers);
00144     }
00145     
00146     result += foot().gather(outputBuffers);
00147     return result;
00148 }

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

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

Implements DybDaq::DaqContainer.

Definition at line 150 of file FeeReadout.cc.

00150                                                                            {
00151     unsigned int result = head().inspect(inspectors);
00152     const FeeHitPtrList& hits = feeHits();
00153     FeeHitPtrList::const_iterator hit;
00154     for (hit = hits.begin();
00155          hit != hits.end();
00156          ++hit) {
00157         result += (*hit)->inspect(inspectors);
00158     }
00159     
00160     result += foot().inspect(inspectors);
00161     return result;
00162 }

void FeeReadout::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 177 of file FeeReadout.cc.

00177                                                  {
00178     FeeFoot& footToUse = foot();
00179     footToUse.setDataLength(footToUse.dataLength() + (size * kBytesInInt));
00180     notifyExpandable(size);
00181 }

bool FeeReadout::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 183 of file FeeReadout.cc.

00183                                                            {
00184     return setExpandable(expandable);
00185 }

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

Suppress default.

const FeeHit & FeeReadout::add ( const FeeHit hit  )  [private]

Adds the supplied FeeHit to this object,.

Definition at line 206 of file FeeReadout.cc.

00206                                                {
00207     if (0 == m_hits) {
00208         m_hits = new FeeHitPtrList();
00209     }
00210     m_hits->push_back(hit);
00211     expanded(hit->bufferSize());
00212     return *hit;
00213 }

FeeFoot & FeeReadout::foot (  )  [private]

Definition at line 215 of file FeeReadout.cc.

00215                           {
00216     if (0 == m_foot) {
00217         m_foot = new FeeFoot(head());
00218     }
00219     return *m_foot;
00220 }


Member Data Documentation

FeeHead* DybDaq::FeeReadout::m_head [mutable, private]

The FeeHead for this fragment.

Definition at line 156 of file FeeReadout.h.

FeeHitPtrList* DybDaq::FeeReadout::m_hits [mutable, private]

The list of Fee Hits in this object.

Definition at line 161 of file FeeReadout.h.

FeeFoot* DybDaq::FeeReadout::m_foot [mutable, private]

The FeeFoot for this fragment.

Definition at line 166 of file FeeReadout.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:03 2011 for FeeReadoutFormat by doxygen 1.4.7