RawSummaryDCMDataHeaderV0.cpp
Go to the documentation of this file.
1 #include "DAQDataFormats/RawSummaryDCMDataHeaderV0.h"
2 #include "DAQDataFormats/RawMilliSliceHeader.h"
3 #include "DAQDataFormats/BitFields.h"
4 #include <boost/format.hpp>
5 
6 /// It is requred to
7 /// 1. include DAQDataFormats/DataFormatFirst.inc
8 /// 2. define CURRENT_CLASS
9 /// 3. define CURRENT_CLASS_VERSION for version of the class
10 /// OR define LAST_CLASS_VERSION for the main structure of the class
11 /// 4. (optional) define CURRENT_FIELDS_SUB_NAMESPACE
12 /// 5. include DAQDataFormats/DataFormatLast.inc
13 /// before the declaration of the DataFormat version class in the header.
14 #include "DAQDataFormats/DataFormatFirst.inc"
15 #define CURRENT_CLASS RawSummaryDCMDataHeader
16 #define CURRENT_CLASS_VERSION 0
17 #define CURRENT_FIELDS_SUB_NAMESPACE summarydcmdatahdr
18 #include "DAQDataFormats/DataFormatLast.inc"
19 
20 
21 namespace daqdataformats{
22 namespace VERSION_NAMESPACE{
23 //------------------------------------------------------------
24 // Default constructor
26  PREVIOUS_VERSION_CLASS_NAME(version)
27  ,ZEROOUT_GET_AND_SET(Version)
28  ,ZEROOUT_GET_AND_SET(NumEntries)
29  ,ZEROOUT_FUNCTION(advanceNumEntries)
30 {}
31 
32 //------------------------------------------------------------
34  PREVIOUS_VERSION_CLASS_NAME(copyin)
35  ,DEEPCOPY_GET_AND_SET(Version)
36  ,DEEPCOPY_GET_AND_SET(NumEntries)
37  ,DEEPCOPY_FUNCTION(advanceNumEntries)
38 {}
39 
40 //------------------------------------------------------------
41 // Destructor
43 }
44 
45 //------------------------------------------------------------
46 // Initialize the data members
48  EXECUTE_FUNCTION(setVersion)(_version);
49  EXECUTE_FUNCTION(setNumEntries)(0);
50 }
51 
52 bool RawSummaryDCMDataHeader::advanceNumEntries()
53  { RETURN_FUNCTION(setNumEntries)(EXECUTE_FUNCTION(getNumEntries)() + 1);}
54 
55 //------------------------------------------------------------------------------
56 // Print the MicroBlock header information
57 void RawSummaryDCMDataHeader::print(std::ostream& os) const{
58  const uint32_t size_of_data = EXECUTE_FUNCTION(sizeofdata)();
59 
60  os<<boost::format("\nSummaryDCMData Header(size=%u, version=%u):") % size_of_data % _version ;
61  os<<boost::format(" getNumEntries=%u")% getNumEntries();
62  os<<boost::format(" Version=%u" )% EXECUTE_FUNCTION(getVersion)();
63  os<<"\n";
64 
65  printBuffer(os);
66 
67  os<<"\nSummaryDCMDataHeader RAW 32bit words (converted, if required, to native endian format):";
68  for(uint32_t i = 0; i < size_of_data; ++i){
69  os<<" ";
70  printWord(i,false, os);
71  }
72 
73  os<<"\nSummaryDCMDataHeader RAW bits (converted, if required, to native endian format):";
74  for(uint32_t i = 0; i < size_of_data; ++i){
75  os<<std::endl;
76  printWord(i,true, os);
77  }
78 }
79 
80 
81 }}// 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
#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.