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

In This Package:

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

Generated on Fri May 16 2014 09:53:02 for FeeReadoutFormat by doxygen 1.7.4