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

In This Package:

FileBuffer.cc
Go to the documentation of this file.
00001 /*
00002  *  FileBuffer.cc
00003  *  RawDataBundle
00004  *
00005  *  Created by Simon Patton on 7/18/10.
00006  *  Copyright 2010 DayaBay Collaboration. All rights reserved.
00007  *
00008  */
00009 
00010 #include "FileReadoutFormat/FileBuffer.h"
00011 
00012 #include "DaqReadoutFormat/ByteBuffer.h"
00013 #include "FileReadoutFormat/FileTraits.h"
00014 
00015 using DybDaq::ByteBuffer;
00016 using DybDaq::FileBuffer;
00017 using DybDaq::FileTraits;
00018 
00019 FileBuffer::FileBuffer(char* buffer,
00020                        const FileTraits& traits,
00021                        const unsigned int marker) :
00022 DaqBuffer(buffer,
00023           traits,
00024           traits.recordSize(marker)) {
00025     setMarker(traits.marker(marker));
00026     setSize(traits.recordSize(marker));
00027 }
00028 
00029 
00030 FileBuffer::FileBuffer(const ByteBuffer& byteBuffer,
00031                        const FileTraits& traits) :
00032 DaqBuffer(byteBuffer,
00033           traits) {
00034     byteBuffer.position(byteBuffer.position() + (size() * kBytesInInt));
00035 }
00036 
00037 FileBuffer::~FileBuffer() {
00038 }
00039 
00040 const FileTraits& FileBuffer::fileTraits() const {
00041     return dynamic_cast<const FileTraits&>(daqTraits());
00042 }
00043 
00044 unsigned int FileBuffer::marker() const {
00045     return readUnsignedInt(FileTraits::kMarker);
00046 }
00047 
00048 unsigned int FileBuffer::size() const {
00049     return readUnsignedInt(FileTraits::kRecordSize);
00050 }
00051 
00052 unsigned int FileBuffer::bufferSize() const {
00053     return size();
00054 }
00055 
00056 void FileBuffer::setMarker(const unsigned int marker) {
00057     writeField(marker,
00058                FileTraits::kMarker);
00059 }
00060 
00061 void FileBuffer::setSize(const unsigned int size) {
00062     writeField(size,
00063                FileTraits::kRecordSize);
00064 }
00065 
| 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