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

In This Package:

Public Member Functions | Private Member Functions | Private Attributes
DybDaq::DaqFormatFromBytes Class Reference

#include <DaqFormatFromBytes.h>

Collaboration diagram for DybDaq::DaqFormatFromBytes:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DaqFormatFromBytes ()
 Create an instance of this class.
virtual ~DaqFormatFromBytes ()
 Destroy this instance of the class.
unsigned int additionalCapacity ()
 Returns the additional number of bytes needed to read the next FileBuffer.
const FileBuffercreateFileBuffer (const ByteBuffer *buffer)
 Create the next FileBuffer in the supplied buffer.

Private Member Functions

 DaqFormatFromBytes (DaqFormatFromBytes &rhs)
 Suppress default.
DaqFormatFromBytesoperator= (DaqFormatFromBytes &rhs)
 Suppress default.
const FileBufferprocessMarker (const ByteBuffer *buffer, unsigned int marker)
 Processes the supplied byte, dependent on the marker provided.

Private Attributes

const FileTraitsm_traits
 The FileTraits instance used to parse the raw file.
unsigned int m_additionalCapacity
 The additional number of bytes needed to read the next FileBuffer.

Detailed Description

Definition at line 19 of file DaqFormatFromBytes.h.


Constructor & Destructor Documentation

DaqFormatFromBytes::DaqFormatFromBytes ( )

Create an instance of this class.

Definition at line 37 of file DaqFormatFromBytes.cc.

DaqFormatFromBytes::~DaqFormatFromBytes ( ) [virtual]

Destroy this instance of the class.

Definition at line 42 of file DaqFormatFromBytes.cc.

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

Suppress default.


Member Function Documentation

unsigned int DaqFormatFromBytes::additionalCapacity ( )

Returns the additional number of bytes needed to read the next FileBuffer.

Definition at line 116 of file DaqFormatFromBytes.cc.

                                                    {
        return m_additionalCapacity;
}
const FileBuffer * DaqFormatFromBytes::createFileBuffer ( const ByteBuffer buffer)

Create the next FileBuffer in the supplied buffer.

Definition at line 120 of file DaqFormatFromBytes.cc.

                                                                               {
        unsigned int remaining = buffer->remaining();
        if (MINIMUM_CAPACITY > remaining) {
                m_additionalCapacity = MINIMUM_CAPACITY - remaining;
                return 0;
        }
        
        unsigned int size = buffer->readUnsignedInt(buffer->position() + ByteBuffer::BYTES_IN_INT);
        unsigned int lengthInBytes = size * ByteBuffer::BYTES_IN_INT;
        if (lengthInBytes >  remaining) {
                m_additionalCapacity = lengthInBytes - remaining;
                return 0;
        }       
        
        return processMarker(buffer,
                                                 buffer->readUnsignedInt(buffer->position()));
}
DaqFormatFromBytes& DybDaq::DaqFormatFromBytes::operator= ( DaqFormatFromBytes rhs) [private]

Suppress default.

const FileBuffer * DaqFormatFromBytes::processMarker ( const ByteBuffer buffer,
unsigned int  marker 
) [private]

Processes the supplied byte, dependent on the marker provided.

Definition at line 45 of file DaqFormatFromBytes.cc.

                                                                                                                       {
        if (0 == m_traits || marker == m_traits->marker(FileTraits::kFileStartRecord)) {
                FileStartRecord*  result = new FileStartRecord(*buffer,
                                                       *m_traits);
        buffer->release();
        const FileTraits* otherTraits = &(result->fileTraits());
        if (m_traits != otherTraits) {
            if (0 == otherTraits) {
                delete result;
                m_additionalCapacity = 0;
                return 0;
            }
            m_traits = otherTraits;
        }
                return result;
        }
        if (marker == m_traits->marker(FileTraits::kFileNameStrings)) {
                const FileBuffer* result = new FileNameStrings(*buffer,
                                                                                                           *m_traits);
        buffer->release();
                return result;
        }
        if (marker == m_traits->marker(FileTraits::kMetadataStrings)) {
                const FileBuffer* result = new MetadataStrings(*buffer,
                                                                                                           *m_traits);
        buffer->release();
                return result;
        }
        if (marker == m_traits->marker(FileTraits::kRunParametersRecord)) {
                const FileBuffer* result = new RunParametersRecord(*buffer,
                                                                                                                   *m_traits);
        buffer->release();
                return result;
        }
        if (marker == m_traits->marker(FileTraits::kCalibrationParametersRecord)) {
                const FileBuffer* result = new CalibrationParametersRecord(*buffer,
                                                                                                                                   *m_traits);
        buffer->release();
                return result;
        }
        if (marker == m_traits->marker(FileTraits::kMomParametersRecord)) {
                const FileBuffer* result = new MomParametersRecord(*buffer,
                                                                                                                                   *m_traits);
        buffer->release();
                return result;
        }
        if (marker == m_traits->marker(FileTraits::kDataSeparatorRecord)) {
                DataSeparatorRecord* result = new DataSeparatorRecord(*buffer,
                                                                                                                          *m_traits);
                unsigned int length = result->blockLength();
                if (length  > buffer->remaining()) {
                        m_additionalCapacity = length - buffer->remaining();
                        delete result;
                        return 0;
                }
                const EventReadout* dataBlock = new EventReadout(*buffer);
        buffer->release();
                result->setBlock(dataBlock);
                return result;
        }
        if (marker == m_traits->marker(FileTraits::kFileEndRecord)) {
                const FileBuffer* result = new FileEndRecord(*buffer,
                                                                                                         *m_traits);
        buffer->release();
                return result;
        }
        m_additionalCapacity = 0;
        return 0;
}

Member Data Documentation

The FileTraits instance used to parse the raw file.

Definition at line 65 of file DaqFormatFromBytes.h.

The additional number of bytes needed to read the next FileBuffer.

Definition at line 70 of file DaqFormatFromBytes.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:22 for FileReadoutFormat by doxygen 1.7.4