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

In This Package:

DaqBuffer.h

Go to the documentation of this file.
00001 #ifndef DAQREADOUTFORMAT_DAQBUFFER_H
00002 #define DAQREADOUTFORMAT_DAQBUFFER_H
00003 
00004 /*
00005  *  DaqBuffer.h
00006  *  DaqReadoutFormat
00007  *
00008  *  Created by Simon Patton on 7/19/10.
00009  *  Copyright 2010 DayaBay Collaboration. All rights reserved.
00010  *
00011  */
00012 #include <vector>
00013 
00014 namespace DybDaq {
00015     class BitsInspector;
00016     class ByteBuffer;
00017     class ByteInspector;
00018     class DaqTraits;
00019 }
00020 
00021 namespace DybDaq {
00022     
00023     class DaqBuffer {
00024         
00025     public:
00026         
00027         typedef std::pair<const char*, unsigned int> OutputBuffer;
00028         typedef std::vector<OutputBuffer> OutputBufferList;
00029         typedef std::vector<ByteInspector*> Bytes;
00030         typedef std::vector<BitsInspector*> Bits;
00031         
00032         static const unsigned int kBytesInInt;
00033         static const unsigned int kUndefinedFormatComponent;
00034         
00035         
00039         virtual ~DaqBuffer();
00040         
00044         bool hasDaqTraits() const;
00045         
00049         virtual const DaqTraits& daqTraits() const;
00050         
00055         virtual unsigned int gather(OutputBufferList& outputBuffers) const;
00056         
00061         virtual unsigned int inspect(DaqBuffer::Bytes& inspectors) const;
00062         
00066         virtual unsigned int bufferSize() const = 0;
00067         
00068     protected:
00069         
00073         DaqBuffer(const DaqBuffer& rhs);
00074         
00078         DaqBuffer(char* buffer,
00079                   const DaqTraits& traits,
00080                   const unsigned int size = 0);
00081         
00085         DaqBuffer(const ByteBuffer& byteBuffer,
00086                   const DaqTraits& traits);
00087         
00091         const char* buffer() const;
00092         
00096         bool hasByteBuffer() const;
00097         
00101         const ByteBuffer& byteBuffer() const;
00102         
00106         unsigned int fillInspectors(DaqBuffer::Bytes& inspectors,
00107                                     unsigned int component,
00108                                     unsigned int cursor) const;
00109         
00113         virtual bool readBool(const unsigned int field) const;
00114         
00118         virtual int readInt(const unsigned int field) const;
00119         
00123         virtual unsigned char readUnsignedChar(const unsigned int field) const;
00124         
00128         virtual unsigned int readUnsignedInt(const unsigned int field) const;
00129         
00133         char* buffer();
00134         
00138         virtual void writeField(const bool value,
00139                                 const unsigned int field);
00140         
00144         virtual void writeField(const int value,
00145                                 const unsigned int field);
00146         
00150         virtual void writeField(const unsigned int value,
00151                                 const unsigned int field);
00152         
00156         virtual unsigned int formatComponent() const;
00157         
00158     private:
00159         
00163         DaqBuffer();
00164         
00168         DaqBuffer& operator=(const DaqBuffer& rhs);
00169         
00173         const ByteBuffer* m_byteBuffer;
00174         
00178         const char* m_buffer;
00179         
00183         const DaqTraits* m_traits;
00184     };
00185     
00186 }
00187 
00188 #endif // DAQREADOUTFORMAT_DAQBUFFER_H
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:07:43 2011 for DaqReadoutFormat by doxygen 1.4.7