00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "DaqReadoutFormat/BitsDefinition.h"
00010
00011 using DybDaq::BitsDefinition;
00012 using std::string;
00013
00014 BitsDefinition::BitsDefinition() :
00015 m_description(0) {
00016 }
00017
00018 BitsDefinition::BitsDefinition(unsigned int field,
00019 unsigned int offset,
00020 unsigned int lowBit,
00021 unsigned int count,
00022 const string& description) :
00023 m_field(field),
00024 m_offset(offset),
00025 m_lowBit(lowBit),
00026 m_count(count),
00027 m_description(&description) {
00028 }
00029
00030 BitsDefinition::~BitsDefinition() {
00031 }
00032
00033 BitsDefinition::BitsDefinition(const BitsDefinition& rhs) :
00034 m_field(rhs.m_field),
00035 m_offset(rhs.m_offset),
00036 m_lowBit(rhs.m_lowBit),
00037 m_count(rhs.m_count),
00038 m_description(rhs.m_description) {
00039 }
00040
00041 BitsDefinition& BitsDefinition::operator=(const BitsDefinition& rhs) {
00042 m_field = rhs.m_field;
00043 m_offset = rhs.m_offset;
00044 m_lowBit = rhs.m_lowBit;
00045 m_count = rhs.m_count;
00046 m_description = rhs.m_description;
00047 return *this;
00048 }
00049
00050 unsigned int BitsDefinition::field() const {
00051 return m_field;
00052 }
00053
00054 unsigned int BitsDefinition::offset() const {
00055 return m_offset;
00056 }
00057
00058 unsigned int BitsDefinition::lowBit() const {
00059 return m_lowBit;
00060 }
00061
00062 unsigned int BitsDefinition::highBit() const {
00063 if (0 == m_count) {
00064 return m_lowBit;
00065 }
00066 return m_lowBit + m_count - 1;
00067 }
00068
00069 const string& BitsDefinition::description() const {
00070 return *m_description;
00071 }