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

In This Package:

CbltFoot.cc

Go to the documentation of this file.
00001 /*
00002  *  CbltFoot.cc
00003  *  CbltReadoutFormat
00004  *
00005  *  Created by Simon Patton on 7/21/10.
00006  *  Copyright 2010 DayaBay Collaboration. All rights reserved.
00007  *
00008  */
00009 #include "CbltReadoutFormat/CbltFoot.h"
00010 
00011 #include "CbltReadoutFormat/CbltHead.h"
00012 #include "CbltReadoutFormat/CbltTraits.h"
00013 #include "DaqReadoutFormat/ByteBuffer.h"
00014 
00015 using DybDaq::ByteBuffer;
00016 using DybDaq::CbltBuffer;
00017 using DybDaq::CbltHead;
00018 using DybDaq::CbltTraits;
00019 using DybDaq::CbltFoot;
00020 
00021 CbltFoot::CbltFoot(const CbltHead& head) :
00022 CbltBuffer(new char[head.cbltTraits().footSize() * kBytesInInt],
00023           head.cbltTraits()) {
00024     const CbltTraits& traits = cbltTraits();
00025     traits.initializeFoot(buffer());
00026     setModuleAddress(head.moduleAddress());
00027     setDataLength((traits.headSize() + traits.footSize()) * kBytesInInt);
00028 }
00029 
00030 CbltFoot::CbltFoot(const ByteBuffer& byteBuffer,
00031                    const CbltTraits& traits) :
00032 CbltBuffer(byteBuffer,
00033            traits) {
00034         byteBuffer.position(byteBuffer.position() + kBytesInInt);
00035 }
00036 
00037 CbltFoot::~CbltFoot() {
00038 }
00039 
00040 unsigned int CbltFoot::formatComponent() const {
00041     return CbltTraits::kFoot;
00042 }
00043 
00044 unsigned int CbltFoot::moduleAddress() const {
00045         return readUnsignedInt(CbltTraits::kFootModuleAddress);
00046 }
00047 
00048 unsigned int CbltFoot::dataLength() const {
00049         return readUnsignedInt(CbltTraits::kFootDataLength);
00050 }
00051 
00052 unsigned int CbltFoot::bufferSize() const {
00053     return cbltTraits().footSize();
00054 }
00055 
00056 void CbltFoot::setModuleAddress(unsigned int moduleAddress) {
00057     writeField(moduleAddress,
00058                CbltTraits::kFootModuleAddress);
00059 }
00060 
00061 void CbltFoot::setDataLength(unsigned int dataLength) {
00062     writeField(dataLength,
00063                CbltTraits::kFootDataLength);
00064 }
00065 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:08:16 2011 for CbltReadoutFormat by doxygen 1.4.7