ConfigurationNameConstructor.cpp
Go to the documentation of this file.
1 /*
2  * File: ConfigurationNameConstructor.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 RawConfigurationName
19 #define LAST_CLASS_VERSION 0
20 #define CURRENT_FIELDS_SUB_NAMESPACE rawconfname
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 //------------------------------------------------------------------------------
51  return true;
52 }
53 
54 
55 //------------------------------------------------------------------------------
57 
58  if(!setFieldToTestValue_Name(dataformat)) {
59  LOG_ERROR("UNITTEST") << std::endl<< __PRETTY_FUNCTION__
60  <<"\nsetFieldToTestValue_"<<"Name"<<" failed.\n"
61  <<"Test value = "<<TEST_VALUE_Name<<"\n";
63  LOG_ERROR("UNITTEST")<<"version = "<<getVersion(dataformat)<<"\n";
64  return false;
65  }
66 
67  if(TEST_VALUE_Name.compare(getFieldValue_Name(dataformat)) != 0 ){
68  LOG_ERROR("UNITTEST") << std::endl<< __PRETTY_FUNCTION__
69  <<"\ngetFieldToTestValue_"<<"Name"<<" failed.\n"
70  <<"Test value = "<<TEST_VALUE_Name<<"!"
71  <<" but get is "
72  << getFieldValue_Name(dataformat)<<"!\n";
74  LOG_ERROR("UNITTEST")<<"version = "<<getVersion(dataformat)<<"\n";
75  return false;
76  }
77 
78  std::string suceed_string = "Checking BitField in ";
79  suceed_string.append(__PRETTY_FUNCTION__);
80  suceed_string.append(" field ");
81  suceed_string.append("Name");
82  suceed_string.append(" suceeded for version = ");
83  suceed_string.append(boost::lexical_cast<std::string>(getVersion(dataformat)));
84  suceed_string.append(" (set to ");
85  suceed_string.append(boost::lexical_cast<std::string>(TEST_VALUE_Name));
86  suceed_string.append(" received ");
87  suceed_string.append(boost::lexical_cast<std::string>(getFieldValue_Name(dataformat)));
88  suceed_string.append(").");
89 
90  if(!setFieldToZeroValue_Name(dataformat)){
91  LOG_ERROR("UNITTEST")<<"\nsetFieldToZeroValue_"<<"Name"<<" failed.\n"
92  <<"version = "<<getVersion(dataformat)<<"\n";
93  return false;
94  }
95  if(getFieldValue_Name(dataformat).size() != 0) {
96  LOG_ERROR("UNITTEST")<<"\ngetFieldValue_"<<"Name"<<" failed.\n"
97  <<"Should be zero"
98  <<" but get is "<<getFieldValue_Name(dataformat)<<"\n"
99  <<"version = "<<getVersion(dataformat)<<"\n";
100  return false;
101  }
102  LOG_DEBUG("UNITTEST")<< suceed_string;
103  return true;
104 }
105 
106 
107 
108 
109 
110 
111 }}// end of namespaces
bool setFieldToZeroValue_Name(daqdataformats::CURRENT_CLASS *dataformat) const
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
#define CURRENT_FIELDS_SUB_NAMESPACE
daqdataformats::RawDAQData * getFilledDataFormat(const daqdataformats::version_t) const
bool fillDataFormat(daqdataformats::RawDAQData *) const
method to Fill the input dataformat
static const version_t RAWCONFIGURATIONNAME_LATEST_VERSION
bool setFieldToTestValue_Name(daqdataformats::CURRENT_CLASS *dataformat) const
version_t getVersion(const daqdataformats::RawDAQData *inver) const
Get version of the input dataformat.
std::string getFieldValue_Name(const daqdataformats::CURRENT_CLASS *dataformat) const
#define CURRENT_CLASS
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 LOG_ERROR(stream)
Definition: Messenger.h:129