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

In This Package:

FadcHead.cc
Go to the documentation of this file.
00001 /*
00002  *  FadcHead.cc
00003  *  FadcReadoutFormat
00004  *
00005  *  Created by Simon Patton on 9/2/10.
00006  *  Copyright 2010 DayaBay Collaboration. All rights reserved.
00007  *
00008  */
00009 #include "FadcReadoutFormat/FadcHead.h"
00010 
00011 #include "DaqReadoutFormat/ByteBuffer.h"
00012 #include "FadcReadoutFormat/FadcTraits.h"
00013 
00014 using DybDaq::FadcHead;
00015 using DybDaq::DaqTraits;
00016 
00017 FadcHead::FadcHead(const unsigned int triggerNumber,
00018                    const unsigned int triggerType,
00019                    const bool noData,
00020                    const FadcTraits& traits) :
00021     FadcBuffer(new char[traits.headSize() * kBytesInInt],
00022                traits) {
00023     m_traits = &traits;
00024     traits.initializeHead(buffer());
00025     setTriggerNumber(triggerNumber);
00026     setTriggerType(triggerType);
00027     setNoData(noData);
00028 }
00029 
00030 
00031 FadcHead::FadcHead(const ByteBuffer& byteBuffer) :
00032     FadcBuffer(byteBuffer,
00033                *((FadcTraits*)0)) {
00034     const char* buffer = byteBuffer.cursor();
00035     m_traits = FadcTraits::readTraits(buffer);
00036     byteBuffer.position(byteBuffer.position() + kBytesInInt);
00037 }
00038 
00039 FadcHead::~FadcHead() {
00040 }
00041 
00042 unsigned int FadcHead::formatComponent() const {
00043     return FadcTraits::kHead;
00044 }
00045 
00046 unsigned int FadcHead::version() const {
00047     return readUnsignedInt(FadcTraits::kMinorVersion);
00048 }
00049 
00050 const DaqTraits& FadcHead::daqTraits() const  {
00051     return *m_traits;
00052 }
00053 
00054 unsigned int FadcHead::triggerNumber() const {
00055     return readUnsignedInt(FadcTraits::kHeadTriggerNumber);
00056 }
00057 
00058 unsigned int FadcHead::triggerType() const {
00059     return readUnsignedInt(FadcTraits::kTriggerType);
00060 }
00061 
00062 bool FadcHead::noData() const {
00063     return readBool(FadcTraits::kNoData);
00064 }
00065 
00066 unsigned int FadcHead::bufferSize() const {
00067     return fadcTraits().headSize();
00068 }
00069 
00070 void FadcHead::setTriggerNumber(const unsigned int triggerNumber) {
00071     writeField(triggerNumber,
00072                FadcTraits::kHeadTriggerNumber);
00073 }
00074 
00075 void FadcHead::setTriggerType(const unsigned int triggerType) {
00076     writeField(triggerType,
00077                FadcTraits::kTriggerType);
00078 }
00079 
00080 void FadcHead::setNoData(const bool noData) {
00081     writeField(noData,
00082                FadcTraits::kNoData);
00083 }
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:52:58 for FadcReadoutFormat by doxygen 1.7.4