RawConfigurationHeaderV0.cpp
Go to the documentation of this file.
1 #include "DAQDataFormats/RawConfigurationHeaderV0.h"
2 #include "DAQDataFormats/RawConfigurationTail.h"
3 #include "DAQDataFormats/RawConfigurationSystemID.h"
4 #include "DAQDataFormats/BitFields.h"
5 #include <boost/format.hpp>
6 
7 /// It is requred to
8 /// 1. include DAQDataFormats/DataFormatFirst.inc
9 /// 2. define CURRENT_CLASS
10 /// 3. define CURRENT_CLASS_VERSION for version of the class
11 /// OR define LAST_CLASS_VERSION for the main structure of the class
12 /// 4. (optional) define CURRENT_FIELDS_SUB_NAMESPACE
13 /// 5. include DAQDataFormats/DataFormatLast.inc
14 /// before the declaration of the DataFormat version class in the header.
15 #include "DAQDataFormats/DataFormatFirst.inc"
16 #define CURRENT_CLASS RawConfigurationHeader
17 #define CURRENT_CLASS_VERSION 0
18 #define CURRENT_FIELDS_SUB_NAMESPACE rawconfhdr
19 #include "DAQDataFormats/DataFormatLast.inc"
20 
21 namespace daqdataformats{
22 namespace VERSION_NAMESPACE{
23 
24 //------------------------------------------------------------------------------
25 // Default constructor
27  PREVIOUS_VERSION_CLASS_NAME(version)
28  ,ZEROOUT_GET_AND_SET(ConfigurationHeaderVersion)
29  ,ZEROOUT_GET_AND_SET(MarkerHi1)
30  ,ZEROOUT_GET_AND_SET(MarkerHi2)
31  ,ZEROOUT_GET_AND_SET(DetectorID )
32  ,ZEROOUT_GET_AND_SET(ConfigurationBlockSize)
33  ,ZEROOUT_GET_AND_SET(ResourceManagerID )
34  ,ZEROOUT_GET_AND_SET(RunNumber )
36  ,ZEROOUT_GET_AND_SET(ConfigurationIDX )
37  ,ZEROOUT_GET_AND_SET(Partition )
38  ,ZEROOUT_GET_AND_SET(Subrun )
39  ,ZEROOUT_GET_AND_SET(SystemNumber )
40  ,ZEROOUT_GET_AND_SET(SystemVersionIDX )
41  ,ZEROOUT_FUNCTION(advanceSystemNumber)
42 {}
43 
45  PREVIOUS_VERSION_CLASS_NAME(copyin)
46  ,DEEPCOPY_GET_AND_SET(ConfigurationHeaderVersion)
47  ,DEEPCOPY_GET_AND_SET(MarkerHi1)
48  ,DEEPCOPY_GET_AND_SET(MarkerHi2)
49  ,DEEPCOPY_GET_AND_SET(DetectorID )
50  ,DEEPCOPY_GET_AND_SET(ConfigurationBlockSize)
51  ,DEEPCOPY_GET_AND_SET(ResourceManagerID )
52  ,DEEPCOPY_GET_AND_SET(RunNumber )
54  ,DEEPCOPY_GET_AND_SET(ConfigurationIDX )
55  ,DEEPCOPY_GET_AND_SET(Partition )
56  ,DEEPCOPY_GET_AND_SET(Subrun )
57  ,DEEPCOPY_GET_AND_SET(SystemNumber )
58  ,DEEPCOPY_GET_AND_SET(SystemVersionIDX )
59  ,DEEPCOPY_FUNCTION(advanceSystemNumber)
60 {}
61 //------------------------------------------------------------------------------
62 // Destructor
64 
65 //------------------------------------------------------------------------------
66 // Initialization of data members
68 
69  EXECUTE_FUNCTION(setConfigurationHeaderVersion)(_version);
70 
71  // Set the Marker
74 }
75 
76 //------------------------------------------------------------------------------
77 bool RawConfigurationHeader::advanceSystemNumber() { RETURN_FUNCTION(setSystemNumber)(EXECUTE_FUNCTION(getSystemNumber)() + 1);}
78 
79 //------------------------------------------------------------------------------
80 // Printing the rawconfigurationheader structure
81 void RawConfigurationHeader::print(std::ostream& os) const{
82  os<<boost::format("\n---RawConfigurationHeader---------------------------------------------size = %u words\n")
84 
85  os<<boost::format(" MarkerHi1=%u" ) % EXECUTE_FUNCTION(getMarkerHi1)();
86  os<<boost::format(" MarkerHi2=%u" ) % EXECUTE_FUNCTION(getMarkerHi2)();
87  os<<boost::format(" ConfigurationHeaderVersion=%u") % EXECUTE_FUNCTION(getConfigurationHeaderVersion)();
88  os<<boost::format(" DetectorID=%u" ) % EXECUTE_FUNCTION(getDetectorID)();
89  os<<boost::format(" ConfigurationBlockSize=%u" ) % EXECUTE_FUNCTION(getConfigurationBlockSize)();
90  os<<boost::format(" ResourceManagerID=%u" ) % EXECUTE_FUNCTION(getResourceManagerID)();
91  os<<boost::format(" RunNumber=%u" ) % EXECUTE_FUNCTION(getRunNumber)();
92  os<<boost::format(" RunType=%u" ) % EXECUTE_FUNCTION(getRunType)();
93  os<<boost::format(" ConfigurationIDX=%u" ) % EXECUTE_FUNCTION(getConfigurationIDX)();
94  os<<boost::format(" Partition=%u" ) % EXECUTE_FUNCTION(getPartition)();
95  os<<boost::format(" Subrun=%u" ) % EXECUTE_FUNCTION(getSubrun)();
96  os<<boost::format(" SystemNumber=%u" ) % EXECUTE_FUNCTION(getSystemNumber)();
97  os<<boost::format(" SystemVersionIDX=%u" ) % EXECUTE_FUNCTION(getSystemVersionIDX)();
98 }
99 
100 }}// end of namespaces
#define ZEROOUT_FUNCTION(FUNC)
Definition: FunctionBind.h:52
#define DEEPCOPY_FUNCTION(FUNC)
Definition: FunctionBind.h:40
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
#define DEEPCOPY_GET_AND_SET(FUNC)
Definition: FunctionBind.h:44
RawConfigurationHeader(const version_t)
The default constructor.
#define VERSION_NAMESPACE
#define ZEROOUT_GET_AND_SET(FUNC)
Definition: FunctionBind.h:56
#define RETURN_FUNCTION(FULLFUNCTIONNAME)
Definition: Macros.h:57
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
const XML_Char * version
Definition: expat.h:187
int32_t version_t
Definition: RawDAQData.h:72
Class to hold the data from the FEBs in correct formats.