ConfigurationSystemIDConstructor.cpp
Go to the documentation of this file.
1 /*
2  * File: ConfigurationSystemIDConstructor.cpp
3  * Author: denis
4  *
5  * Created on September 20, 2012, 2:18 PM
6  */
8 
9 /// It is requred to
10 /// 1. include DAQDataFormats/DataFormatFirst.inc
11 /// 2. define CURRENT_CLASS
12 /// 3. define CURRENT_CLASS_VERSION for version of the class
13 /// OR define LAST_CLASS_VERSION for the main structure of the class
14 /// 4. (optional) define CURRENT_FIELDS_SUB_NAMESPACE
15 /// 5. include DAQDataFormats/DataFormatLast.inc
16 /// before the declaration of the DataFormat version class in the header.
17 #include "DAQDataFormats/DataFormatFirst.inc"
18 #define CURRENT_CLASS RawConfigurationSystemID
19 #define LAST_CLASS_VERSION 0
20 #define CURRENT_FIELDS_SUB_NAMESPACE rawconfsysid
21 #include "DAQDataFormats/DataFormatLast.inc"
22 
23 namespace daqdataformats {
25 
26 //------------------------------------------------------------------------------
29 {
30 }
31 
32 //------------------------------------------------------------------------------
34 
35 //------------------------------------------------------------------------------
38  fillDataFormat(out);
39  return out;
40 }
41 
42 //------------------------------------------------------------------------------
45 }
46 
47 //------------------------------------------------------------------------------
50  setFieldToTestValue_DAQSystemID(cname);
51  setFieldToTestValue_DAQSubSystemID(cname);
53 
54  return true;
55 }
56 
57 
58 //------------------------------------------------------------------------------
60 
61  if(!setFieldToTestValue_VersionName(dataformat)) {
62  LOG_ERROR("UNITTEST") << std::endl<< __PRETTY_FUNCTION__
63  <<"\nsetFieldToTestValue_"<<"Name"<<" failed.\n"
64  <<"Test value = "<<TEST_VALUE_VersionName<<"\n";
66  LOG_ERROR("UNITTEST")<<"version = "<<getVersion(dataformat)<<"\n";
67  return false;
68  }
69 
70  if(TEST_VALUE_VersionName.compare(getFieldValue_VersionName(dataformat)) != 0 ){
71  LOG_ERROR("UNITTEST") << std::endl<< __PRETTY_FUNCTION__
72  <<"\ngetFieldToTestValue_"<<"Name"<<" failed.\n"
73  <<"Test value = "<<TEST_VALUE_VersionName<<"!"
74  <<" but get is "
75  << getFieldValue_VersionName(dataformat)<<"!\n";
77  LOG_ERROR("UNITTEST")<<"version = "<<getVersion(dataformat)<<"\n";
78  return false;
79  }
80 
81  std::string suceed_string = "Checking BitField in ";
82  suceed_string.append(__PRETTY_FUNCTION__);
83  suceed_string.append(" field ");
84  suceed_string.append("Name");
85  suceed_string.append(" suceeded for version = ");
86  suceed_string.append(boost::lexical_cast<std::string>(getVersion(dataformat)));
87  suceed_string.append(" (set to ");
88  suceed_string.append(boost::lexical_cast<std::string>(TEST_VALUE_VersionName));
89  suceed_string.append(" received ");
90  suceed_string.append(boost::lexical_cast<std::string>(getFieldValue_VersionName(dataformat)));
91  suceed_string.append(").");
92 
93  if(!setFieldToZeroValue_VersionName(dataformat)){
94  LOG_ERROR("UNITTEST")<<"\nsetFieldToZeroValue_"<<"Name"<<" failed.\n"
95  <<"version = "<<getVersion(dataformat)<<"\n";
96  return false;
97  }
98  if(getFieldValue_VersionName(dataformat).size() != 0) {
99  LOG_ERROR("UNITTEST")<<"\ngetFieldValue_"<<"Name"<<" failed.\n"
100  <<"Should be zero"
101  <<" but get is "<<getFieldValue_VersionName(dataformat)<<"\n"
102  <<"version = "<<getVersion(dataformat)<<"\n";
103  return false;
104  }
105  LOG_DEBUG("UNITTEST")<< suceed_string;
106  return true;
107 }
108 
109 
110 
111 
112 
113 }}// end of namespaces
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
daqdataformats::RawDAQData * getFilledDataFormat(const daqdataformats::version_t) const
bool fillDataFormat(daqdataformats::RawDAQData *) const
method to Fill the input dataformat
daqdataformats::RawDAQData * getEmptyDataFormat(const daqdataformats::version_t) const
method to create an empty dataformat with a given version
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
int32_t version_t
Definition: RawDAQData.h:72
static const version_t DAQDATAFORMAT_UNKNOWN_VERSION
Definition: RawDAQData.h:81
Class to hold the data from the FEBs in correct formats.
#define CURRENT_FIELDS_SUB_NAMESPACE
std::string getFieldValue_VersionName(const daqdataformats::CURRENT_CLASS *dataformat) const
#define LOG_ERROR(stream)
Definition: Messenger.h:129
version_t getVersion(const daqdataformats::RawDAQData *inver) const
Get version of the input dataformat.