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

In This Package:

DybDaq::DaqFormatFromBytes Class Reference

#include <DaqFormatFromBytes.h>

Collaboration diagram for DybDaq::DaqFormatFromBytes:

[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 35 of file DaqFormatFromBytes.cc.

00035                                        :
00036 m_traits(&FileTraits::defaultTraits()),
00037 m_additionalCapacity(0) {
00038 }

DaqFormatFromBytes::~DaqFormatFromBytes (  )  [virtual]

Destroy this instance of the class.

Definition at line 40 of file DaqFormatFromBytes.cc.

00040                                         {
00041 }

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 108 of file DaqFormatFromBytes.cc.

00108                                                     {
00109         return m_additionalCapacity;
00110 }

const FileBuffer * DaqFormatFromBytes::createFileBuffer ( const ByteBuffer buffer  ) 

Create the next FileBuffer in the supplied buffer.

Definition at line 112 of file DaqFormatFromBytes.cc.

00112                                                                                {
00113         unsigned int remaining = buffer->remaining();
00114         if (MINIMUM_CAPACITY > remaining) {
00115                 m_additionalCapacity = MINIMUM_CAPACITY - remaining;
00116                 return 0;
00117         }
00118         
00119         unsigned int size = buffer->readUnsignedInt(buffer->position() + ByteBuffer::BYTES_IN_INT);
00120         unsigned int lengthInBytes = size * ByteBuffer::BYTES_IN_INT;
00121         if (lengthInBytes >  remaining) {
00122                 m_additionalCapacity = lengthInBytes - remaining;
00123                 return 0;
00124         }       
00125         
00126         return processMarker(buffer,
00127                                                  buffer->readUnsignedInt(buffer->position()));
00128 }

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 43 of file DaqFormatFromBytes.cc.

00044                                                                                                                        {
00045         if (0 == m_traits || marker == m_traits->marker(FileTraits::kFileStartRecord)) {
00046                 FileStartRecord*  result = new FileStartRecord(*buffer,
00047                                                        *m_traits);
00048         buffer->release();
00049         const FileTraits* otherTraits = &(result->fileTraits());
00050         if (m_traits != otherTraits) {
00051             if (0 == otherTraits) {
00052                 delete result;
00053                 m_additionalCapacity = 0;
00054                 return 0;
00055             }
00056             m_traits = otherTraits;
00057         }
00058                 return result;
00059         }
00060         if (marker == m_traits->marker(FileTraits::kFileNameStrings)) {
00061                 const FileBuffer* result = new FileNameStrings(*buffer,
00062                                                                                                            *m_traits);
00063         buffer->release();
00064                 return result;
00065         }
00066         if (marker == m_traits->marker(FileTraits::kMetadataStrings)) {
00067                 const FileBuffer* result = new MetadataStrings(*buffer,
00068                                                                                                            *m_traits);
00069         buffer->release();
00070                 return result;
00071         }
00072         if (marker == m_traits->marker(FileTraits::kRunParametersRecord)) {
00073                 const FileBuffer* result = new RunParametersRecord(*buffer,
00074                                                                                                                    *m_traits);
00075         buffer->release();
00076                 return result;
00077         }
00078         if (marker == m_traits->marker(FileTraits::kCalibrationParametersRecord)) {
00079                 const FileBuffer* result = new CalibrationParametersRecord(*buffer,
00080                                                                                                                                    *m_traits);
00081         buffer->release();
00082                 return result;
00083         }
00084         if (marker == m_traits->marker(FileTraits::kDataSeparatorRecord)) {
00085                 DataSeparatorRecord* result = new DataSeparatorRecord(*buffer,
00086                                                                                                                           *m_traits);
00087                 unsigned int length = result->blockLength();
00088                 if (length  > buffer->remaining()) {
00089                         m_additionalCapacity = length - buffer->remaining();
00090                         delete result;
00091                         return 0;
00092                 }
00093                 const EventReadout* dataBlock = new EventReadout(*buffer);
00094         buffer->release();
00095                 result->setBlock(dataBlock);
00096                 return result;
00097         }
00098         if (marker == m_traits->marker(FileTraits::kFileEndRecord)) {
00099                 const FileBuffer* result = new FileEndRecord(*buffer,
00100                                                                                                          *m_traits);
00101         buffer->release();
00102                 return result;
00103         }
00104         m_additionalCapacity = 0;
00105         return 0;
00106 }


Member Data Documentation

const FileTraits* DybDaq::DaqFormatFromBytes::m_traits [private]

The FileTraits instance used to parse the raw file.

Definition at line 65 of file DaqFormatFromBytes.h.

unsigned int DybDaq::DaqFormatFromBytes::m_additionalCapacity [private]

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 Mon Apr 11 20:08:34 2011 for FileReadoutFormat by doxygen 1.4.7