RawDataBlockV0.h
Go to the documentation of this file.
1 #ifndef RAWDATABLOCKV0_H
2 #define RAWDATABLOCKV0_H
3 #include "DAQDataFormats/RawDataBlockHeader.h"
4 
5 /// It is requred to
6 /// 1. include DAQDataFormats/DataFormatFirst.inc
7 /// 2. define CURRENT_CLASS
8 /// 3. define CURRENT_CLASS_VERSION for version of the class
9 /// OR define LAST_CLASS_VERSION for the main structure of the class
10 /// 4. (optional) define CURRENT_FIELDS_SUB_NAMESPACE
11 /// 5. include DAQDataFormats/DataFormatLast.inc
12 /// before the declaration of the DataFormat version class in the header.
13 #include "DAQDataFormats/DataFormatFirst.inc"
14 #define CURRENT_CLASS RawDataBlock
15 #define CURRENT_CLASS_VERSION 0
16 #define CURRENT_FIELDS_SUB_NAMESPACE datablock
17 #include "DAQDataFormats/DataFormatLast.inc"
18 
19 
20 namespace daqdataformats {
21  class RawMicroBlock;
22 }
23 
24 namespace daqdataformats {
25 namespace VERSION_NAMESPACE {
26 
27  class RawDataBlock : public PREVIOUS_VERSION_CLASS_NAME {
28  protected:
29  /// Constructors
30  RawDataBlock(const version_t, const uint32_t tlvl);
31  RawDataBlock(const RawDataBlock&);
32  /// Destructor
33  ~RawDataBlock();
34  public:
35 
36  void init ();
37  using RawDAQData::print;
38  void print (std::ostream& os=std::cout) const;
39  uint32_t sizeofdata () const { return _Header->getDataSize();}
40  bool setBufferSource(const void* pointer);
41 
43  void* readData(const void*);
44 
45  // Getters
48 
49 
50  /// Add the MicroBlock to _Buffer.
51  /// If check_mc_flag = true, the method checks whether the microslice
52  /// in the microblock is MC generatedand adds an appropriate flag to the DataBlock Header.
53  bool addMicroBlock1(const void* microblock_buffer,
54  const bool check_mc_flag
55  );
56  /// Add the MicroBlock of a known size to _Buffer.
57  /// If check_mc_flag = true, the method checks whether the microslice
58  /// in the microblock is MC generatedand adds an appropriate flag to the DataBlock Header.
59  bool addMicroBlock2(const void* microblock_buffer,
60  const uint32_t microblock_size,
61  const bool check_mc_flag
62  );
63  /// Add the MicroBlock to _Buffer by passing the references of
64  /// the MilliSlice and the MicroSlice. MilliSlice is the one that contains the MicroSlice.
65  /// If check_mc_flag = true, the method checks whether the microslice
66  /// in the microblock is MC generatedand adds an appropriate flag to the DataBlock Header.
67  bool addMicroBlock3(const void* millislice_buffer,
68  const void* microslice_buffer,
69  const version_t microblock_version,
70  const bool check_mc_flag
71  );
72  /// Add the MicroBlock to _Buffer by passing the references of
73  /// the MilliSlice and the MicroSlice of a known size.
74  /// MilliSlice is the one that contains the MicroSlice.
75  /// If check_mc_flag = true, the method checks whether the microslice
76  /// in the microblock is MC generatedand adds an appropriate flag to the DataBlock Header.
77  bool addMicroBlock4(const void* millislice_buffer,
78  const void* microslice_buffer,
79  const uint32_t microslice_size,
80  const version_t microblock_version,
81  const bool check_mc_flag
82  );
83 
84  // setMarker and addDroppedMicroblock are only defined in Version 1
85  bool setMarker(const uint32_t) { return GENERATE_FUNCTION_IS_NOT_ALLOWED; }
87 
88  // addDCMData1 and addDCMData2 are only defined in Version 2
89  bool addDCMData1(const void*) { return GENERATE_FUNCTION_IS_NOT_ALLOWED; }
90  bool addDCMData2(const void*, const uint32_t) { return GENERATE_FUNCTION_IS_NOT_ALLOWED; }
91 
92  protected:
93 
94  uint32_t getPredeterminedSize() const {return 1;}
95 
97  INIT_FIRST(readDataFromFileDescriptor , , readDataStatus, const int);
98 
99  INIT_FIRST(close , , bool , const bool);
100  INIT_FIRST(setFloatingMicroBlockToBufferSource, const, bool , const void*);
101 
102  INIT_FIRST(clear , , bool, );
103  INIT_FIRST(softclear , , bool, );
104  INIT_FIRST(getVersion, const, uint32_t, );
105  INIT_FIRST(getMarker, const, uint32_t, );
106  INIT_FIRST(getTrigNumLo, const, uint32_t, );
107  INIT_FIRST(getTrigNumHi, const, uint32_t, );
108  INIT_FIRST(getTrigNum, const, uint64_t, );
109  INIT_FIRST(getNumMicroBlocks, const, uint16_t, );
110  INIT_FIRST(getBuffId, const, uint16_t, );
111  INIT_FIRST(getDataSize, const, uint32_t, );
112  INIT_FIRST(getMonteCarloFlag, const, bool, );
113  INIT_FIRST(isCRCCalculationUsed, const, bool, );
114  INIT_FIRST(isConnectionInitialization, const, bool, );
115  INIT_FIRST(isCloseConnection, const, bool, );
116  INIT_FIRST(isMissingData, const, bool, );
117  INIT_FIRST(setFloatingMicroBlock, const, bool, const uint32_t);
118  INIT_FIRST(getCRC, const, uint32_t, );
119  INIT_FIRST(setTrigNumLo, , bool, const uint32_t);
120  INIT_FIRST(setTrigNumHi, , bool, const uint32_t);
121  INIT_FIRST(setTrigNum, , bool, const uint64_t);
122  INIT_FIRST(setBuffId, , bool, const uint16_t);
123  INIT_FIRST(setConnectionInitialization, , bool, const bool);
124  INIT_FIRST(setMonteCarloFlag, , bool, const bool);
125  INIT_FIRST(setCloseConnection, , bool, const bool);
126  INIT_FIRST(setMissingData, , bool, const bool);
127 
128  protected:
129  INIT_CUSTOM_DELEGATE(addMicroBlock1, bool, const void*, const bool);
130  INIT_CUSTOM_DELEGATE(addMicroBlock2, bool, const void*, const uint32_t, const bool);
131  INIT_CUSTOM_DELEGATE(addMicroBlock3, bool, const void*, const void* , const version_t, const bool);
132  INIT_CUSTOM_DELEGATE(addMicroBlock4, bool, const void*, const void* , const uint32_t , const version_t, const bool);
133 
135  mutable daqdataformats::RawMicroBlock* _FloatingMicroBlock; //! Floating MicroBlock
136  mutable int _FloatingMicroBlockNumber;//! Floating MicroBlock Number
137  version_t _microBlockVersion; ///< Version of the MicroBlock
138 
139  uint32_t _tlvl; // debug "trace level mask"
141 
142  public:
143  void tprintf( unsigned lvl, const char *fmt, ... )
144  __attribute__((format(printf, 3, 4))); // g++ note: attributes are not
145 
146  // allowed on a function-definition
147  };// end of class definition
148 
149 }} // END NAMESPCE daqdataformats
150 #endif /* RAWDATABLOCKV0_H */
void print(std::ostream &os=std::cout) const
#define GENERATE_FUNCTION_IS_NOT_ALLOWED
calling functionIsNotAllowed
Definition: RawDAQData.h:21
daqdataformats::RawMicroBlock * _FloatingMicroBlock
DataBlock header.
bool addMicroBlock4(const void *millislice_buffer, const void *microslice_buffer, const uint32_t microslice_size, const version_t microblock_version, const bool check_mc_flag)
#define VERSION_NAMESPACE
INIT_FIRST(readDataFromFileDescriptor,, readDataStatus, const int)
RawDataBlock(const version_t, const uint32_t tlvl)
Constructors.
vector< vector< double > > clear
bool addMicroBlock1(const void *microblock_buffer, const bool check_mc_flag)
daqdataformats::RawDataBlockHeader * getHeader() const
void tprintf(unsigned lvl, const char *fmt,...) __attribute__((format(printf
bool addDCMData2(const void *, const uint32_t)
version_t _microBlockVersion
Floating MicroBlock Number.
void print(std::ostream &os=std::cout) const
Method for printing the content of the Buffer.
Definition: RawDAQData.cpp:500
__attribute__((unused)) static std
INIT_CUSTOM_DELEGATE(addMicroBlock1, bool, const void *, const bool)
printf("%d Experimental points found\n", nlines)
daqdataformats::RawDataBlockHeader * _Header
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
OStream cout
Definition: OStream.cxx:6
bool addMicroBlock2(const void *microblock_buffer, const uint32_t microblock_size, const bool check_mc_flag)
void * readData(const void *buffer)
Shallow copy constructor.
Definition: RawDAQData.cpp:181
int32_t version_t
Definition: RawDAQData.h:72
daqdataformats::RawMicroBlock * getFloatingMicroBlock() const
Class to hold the data from the FEBs in correct formats.
bool addMicroBlock3(const void *millislice_buffer, const void *microslice_buffer, const version_t microblock_version, const bool check_mc_flag)
procfile close()