/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 | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Friends
DybDaq::DaqTraits Class Reference

#include <DaqTraits.h>

List of all members.

Public Types

typedef std::vector
< BitsDefinition
Definitions

Public Member Functions

virtual ~DaqTraits ()
 Destroy this instance of the class.
virtual unsigned int majorVersion () const =0
virtual unsigned int minorVersion () const =0
virtual const std::string versionString () const =0
 Returns the version of the event format as a string.
virtual unsigned int marker (unsigned int marker) const
 Returns the marker of the type of specified header.
virtual unsigned int illegalMarker () const =0
 Returns the index value for an illegal header.
virtual unsigned int illegalField () const =0
 Returns the index value for an illegal field.
virtual const char * boolAsString (bool value) const
 Returns the string for the specified boolean.
const DaqTraits::DefinitionsbitsDefinitions (unsigned int component) const
 Returns the set of all definitions of fields within a components.

Protected Member Functions

 DaqTraits ()
 Creates an instance of this class.
unsigned int index (unsigned int field) const
 Returns the index of the field in its block.
virtual unsigned int markersEnd () const =0
 Returns the maximum number of headers in an event.
virtual const unsigned int * markers () const =0
 Returns the markers for the records.
virtual unsigned int fieldsEnd () const =0
 Returns the maximum field value for a particluar format.
virtual const unsigned int * indices () const =0
 Returns the indices of shifts for fields.
virtual const unsigned int * shifts () const =0
 Returns the array of shifts for fields.
virtual const unsigned int * masks () const =0
 Returns the array of marks for fields.
virtual const std::string * descriptions () const
 Returns the array of descriptions for fields.
virtual DaqTraits::Definitionsdefinitions (unsigned int component) const
 Returns the array of bits definitions for a compement.
virtual void setDefinitions (DaqTraits::Definitions *definitions, unsigned int component)
 Sets the array of bits definitions for a compoment.
virtual const unsigned int * componentFields (unsigned int component) const
 Sets the array of fields for a compoment.
virtual const unsigned int componentFieldsEnd (unsigned int component) const
 Returns the maximum indexthe array of fields for a compoment.

Static Protected Member Functions

static unsigned int readUnsignedInt (const char *&buffer, const DaqTraits &traits, unsigned int field)
 Utility method to access buffer to determine correct traits.

Private Member Functions

 DaqTraits (DaqTraits &rhs)
 Suppress default.
DaqTraitsoperator= (DaqTraits &rhs)
 Suppress default.
unsigned int shift (unsigned int field) const
 Returns the shift of the field in its block.
unsigned int mask (unsigned int field) const
 Returns the mask of the field in its block.

Friends

class DaqBuffer

Detailed Description

Definition at line 20 of file DaqTraits.h.


Member Typedef Documentation

Definition at line 26 of file DaqTraits.h.


Constructor & Destructor Documentation

DaqTraits::~DaqTraits ( ) [virtual]

Destroy this instance of the class.

Definition at line 21 of file DaqTraits.cc.

                      {
}
DaqTraits::DaqTraits ( ) [protected]

Creates an instance of this class.

Definition at line 18 of file DaqTraits.cc.

                     {
}
DybDaq::DaqTraits::DaqTraits ( DaqTraits rhs) [private]

Suppress default.


Member Function Documentation

virtual unsigned int DybDaq::DaqTraits::majorVersion ( ) const [pure virtual]
virtual unsigned int DybDaq::DaqTraits::minorVersion ( ) const [pure virtual]
virtual const std::string DybDaq::DaqTraits::versionString ( ) const [pure virtual]

Returns the version of the event format as a string.

unsigned int DaqTraits::marker ( unsigned int  marker) const [virtual]

Returns the marker of the type of specified header.

Definition at line 35 of file DaqTraits.cc.

                                                        {
        if (marker >= markersEnd()) {
                return illegalMarker();
        }
        return markers()[marker];
}
virtual unsigned int DybDaq::DaqTraits::illegalMarker ( ) const [pure virtual]

Returns the index value for an illegal header.

virtual unsigned int DybDaq::DaqTraits::illegalField ( ) const [pure virtual]

Returns the index value for an illegal field.

const char * DaqTraits::boolAsString ( bool  value) const [virtual]

Returns the string for the specified boolean.

Definition at line 63 of file DaqTraits.cc.

                                                    {
    if (value) {
        return "yes";
    }
    return "no";
}
const DaqTraits::Definitions & DaqTraits::bitsDefinitions ( unsigned int  component) const

Returns the set of all definitions of fields within a components.

Definition at line 90 of file DaqTraits.cc.

                                                                                   {
    DaqTraits::Definitions* componentDefinitions = definitions(component);
    if (0 == componentDefinitions) {
        componentDefinitions = new DaqTraits::Definitions();
        const unsigned int* fieldIndices = componentFields(component);
        const unsigned int finished = componentFieldsEnd(component);
        for (unsigned int index = 0;
             finished != index;
             ++index) {
            const unsigned int field = fieldIndices[index];
            unsigned int shift = shifts()[field];
            const unsigned int mask = masks()[field];
            unsigned int count = 0;
            unsigned int bit = 1;
            if (0 != mask) {
                if (0 == (bit & mask)) {
                    // Assumes it is binary
                    while (32 > count && (0 == (bit & mask)) ) {
                        bit <<= 1;
                        ++count;
                    }
                    shift = count - 1;
                    count = 1;
                } else {
                    while (32 > count && (0 != (bit & mask)) ) {
                        bit <<= 1;
                        ++count;
                    }
                }
            }
            componentDefinitions->push_back(BitsDefinition(field,
                                                           indices()[field],
                                                           shift,
                                                           count,
                                                           descriptions()[field]));
        }
        const_cast<DaqTraits*>(this)->setDefinitions(componentDefinitions,
                                                     component);
    }
    return *componentDefinitions;
}
unsigned int DaqTraits::readUnsignedInt ( const char *&  buffer,
const DaqTraits traits,
unsigned int  field 
) [static, protected]

Utility method to access buffer to determine correct traits.

Definition at line 24 of file DaqTraits.cc.

                                                            {
        unsigned int index = traits.index(field);
        if (index == traits.illegalField()) {
                return 0;
        }
        unsigned int fourBytes = *(((unsigned int*)buffer) + index);
        return (fourBytes >> traits.shift(field)) & traits.mask(field);
}
unsigned int DaqTraits::index ( unsigned int  field) const [protected]

Returns the index of the field in its block.

Definition at line 42 of file DaqTraits.cc.

                                                      {
        if (field >= fieldsEnd()) {
                return illegalField();
        }
        return indices()[field];
}
virtual unsigned int DybDaq::DaqTraits::markersEnd ( ) const [protected, pure virtual]

Returns the maximum number of headers in an event.

virtual const unsigned int* DybDaq::DaqTraits::markers ( ) const [protected, pure virtual]

Returns the markers for the records.

virtual unsigned int DybDaq::DaqTraits::fieldsEnd ( ) const [protected, pure virtual]

Returns the maximum field value for a particluar format.

virtual const unsigned int* DybDaq::DaqTraits::indices ( ) const [protected, pure virtual]

Returns the indices of shifts for fields.

virtual const unsigned int* DybDaq::DaqTraits::shifts ( ) const [protected, pure virtual]

Returns the array of shifts for fields.

virtual const unsigned int* DybDaq::DaqTraits::masks ( ) const [protected, pure virtual]

Returns the array of marks for fields.

const string * DaqTraits::descriptions ( ) const [protected, virtual]

Returns the array of descriptions for fields.

Definition at line 86 of file DaqTraits.cc.

                                            {
    return 0;
}
DaqTraits::Definitions * DaqTraits::definitions ( unsigned int  component) const [protected, virtual]

Returns the array of bits definitions for a compement.

Definition at line 70 of file DaqTraits.cc.

                                                                 {
    return 0;
}
void DaqTraits::setDefinitions ( DaqTraits::Definitions definitions,
unsigned int  component 
) [protected, virtual]

Sets the array of bits definitions for a compoment.

Definition at line 74 of file DaqTraits.cc.

                                               {
}
const unsigned int * DaqTraits::componentFields ( unsigned int  component) const [protected, virtual]

Sets the array of fields for a compoment.

Definition at line 78 of file DaqTraits.cc.

                                                                   {
    return 0;
}
const unsigned int DaqTraits::componentFieldsEnd ( unsigned int  component) const [protected, virtual]

Returns the maximum indexthe array of fields for a compoment.

Definition at line 82 of file DaqTraits.cc.

                                                                     {
    return 0;
}
DaqTraits& DybDaq::DaqTraits::operator= ( DaqTraits rhs) [private]

Suppress default.

unsigned int DaqTraits::shift ( unsigned int  field) const [private]

Returns the shift of the field in its block.

Definition at line 49 of file DaqTraits.cc.

                                                      {
        if (field >= fieldsEnd()) {
                return 0;
        }
        return shifts()[field];
}
unsigned int DaqTraits::mask ( unsigned int  field) const [private]

Returns the mask of the field in its block.

Definition at line 56 of file DaqTraits.cc.

                                                     {
        if (field >= fieldsEnd()) {
                return 0;
        }
        return masks()[field];
}

Friends And Related Function Documentation

friend class DaqBuffer [friend]

Definition at line 24 of file DaqTraits.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:49 for DaqReadoutFormat by doxygen 1.7.4