RawNanoSlice.cpp
Go to the documentation of this file.
1 #include "DAQDataFormats/RawNanoSlice.h"
2 #include "DAQDataFormats/DataFormatException.h"
3 
4 /// It is requred to
5 /// 1. include DAQDataFormats/DataFormatFirst.inc
6 /// 2. define CURRENT_CLASS
7 /// 3. define CURRENT_CLASS_VERSION for version of the class
8 /// OR define LAST_CLASS_VERSION for the main structure of the class
9 /// 4. (optional) define CURRENT_FIELDS_SUB_NAMESPACE
10 /// 5. include DAQDataFormats/DataFormatLast.inc
11 /// before the declaration of the DataFormat version class in the header.
12 #include "DAQDataFormats/DataFormatFirst.inc"
13 #define CURRENT_CLASS RawNanoSlice
14 #define LAST_CLASS_VERSION 4
15 #define CURRENT_FIELDS_SUB_NAMESPACE rawnano
16 #include "DAQDataFormats/DataFormatLast.inc"
17 
18 namespace daqdataformats{
19 
20 //------------------------Constructors------------------------------------------
21 /// After this constructor the buffer pointer is set to the internal source
23  PREVIOUS_VERSION_CLASS_NAME(version)
24  ,_nanoSliceParameters(NULL)
25 {
26  INITIALIZE_DEBUGGING_VARIABLES;
27  /// Perform general routines
28  defaultConstructorFixedSize();
29 }// end of :RawNanoSlice(version_t version)
30 
31 //------------------------------------------------------------------------------
32 /// After this constructor the buffer pointer is set to the internal source
33 RawNanoSlice::RawNanoSlice (const NanoSlice& nanoslice_parameters):
34  PREVIOUS_VERSION_CLASS_NAME(nanoslice_parameters)
35  ,_nanoSliceParameters((NanoSlice*)&nanoslice_parameters)
36 {
37  INITIALIZE_DEBUGGING_VARIABLES;
38  /// Now, apply the default constructor, passing function pointer to initWithDataInternal
39  defaultConstructorFixedSize((init_t) &RawNanoSlice::initWithDataInternal);
40 }// end of RawNanoSlice (NanoSlice nanoslice_parameters)
41 
42 
43 //------------------------------------------------------------------------------
44 /// After this constructor the buffer pointer is set to the external source
46  PREVIOUS_VERSION_CLASS_NAME(copy_in)
48 {
49  INITIALIZE_DEBUGGING_VARIABLES;
50  lastOperationsInDeepCopy(copy_in);
52 
53 }// end of RawNanoSlice(const RawNanoSlice& copy_in)
54 
55 //------------------------------------------------------------------------------
56 // check how to get the version number
57 RawNanoSlice::RawNanoSlice(const void* nanoslice_buffer, const version_t version):
58  PREVIOUS_VERSION_CLASS_NAME(version)
60 {
61  INITIALIZE_DEBUGGING_VARIABLES;
62  copy(nanoslice_buffer);
63 }
64 
65 //------------------------Destructor--------------------------------------------
67 
68 //------------------------------------------------------------------------------
69 void RawNanoSlice::initWithDataInternal(){ EXECUTE_FUNCTION(initWithData)(*_nanoSliceParameters); }
70 
71 /// All binding routines
72 #define STANDARD_ROUTINES \
73  BIND_GET_AND_SET(PulseHeight , version0, uint32_t);\
74  BIND_GET_AND_SET(TimeStamp , version0, uint32_t);\
75  BIND_GET_AND_SET(Reserved , version0, uint32_t);\
76  BIND_GET_AND_SET(Value1 , version1, uint32_t);\
77  BIND_SET (Parameters , version0, NanoSlice&);\
78  BIND_CUSTOM_FUNCTION(initWithData , version0, , void, const NanoSlice&); \
79  BIND_CUSTOM_FUNCTION(checkReservedForCafe, version0, const, bool, ); \
80  BIND_CUSTOM_FUNCTION(getValue , version2, const, uint32_t, const uint32_t); \
81  BIND_CUSTOM_FUNCTION(setValue , version2, , bool , const uint32_t, const uint32_t); \
82  BIND_STADARD_FUNCTION(sizeofdata); \
83  BIND_STADARD_FUNCTIONS;
84 
85 
86 #include "DAQDataFormats/setFunctionPointers_template.inc"
87 
88 
89 }// end of namespace
90 
91 
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
Data structure for holding all the nanoslice data of interest.
RawNanoSlice(const version_t version=nanosliceheader::RAWNANOSLICE_DEFAULT_VERSION)
After this constructor the buffer pointer is set to the internal source.
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.
#define init_t
Definition: FunctionBind.h:29