RawTriggerTimeV0.h
Go to the documentation of this file.
1 #ifndef DAQRAWTRIGGERTIMEV0_H
2 #define DAQRAWTRIGGERTIMEV0_H
3 
4 #include "DAQDataFormats/RawDAQData.h"
5 #include "DAQDataFormats/BitFields.h"
6 #include "DAQDataFormats/TriggerDefines.h"
7 #include "DAQDataFormats/Macros.h"
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 RawTriggerTime
19 #define CURRENT_CLASS_VERSION 0
20 #define CURRENT_FIELDS_SUB_NAMESPACE triggertime
21 #include "DAQDataFormats/DataFormatLast.inc"
22 
23 namespace daqdataformats {
24 namespace VERSION_NAMESPACE {
25 
27 
28  static const uint32_t TRIGGERTIME_SIZE = 5;
29 
33  MASK_Version = 0xFF000000,
36  MASK_ClockSource = 0x000000FF,
38  };
39 
43  WORD_Version = 1,
48  };
49 
50  DEFINE_SHIFT_FROM_MASK(TriggerTimeStampLow);
51  DEFINE_SHIFT_FROM_MASK(TriggerTimeStampHigh);
52  DEFINE_SHIFT_FROM_MASK(Version);
53  DEFINE_SHIFT_FROM_MASK(TriggerTimeStamp_sec);
54  DEFINE_SHIFT_FROM_MASK(TriggerTimeStamp_usec);
55  DEFINE_SHIFT_FROM_MASK(ClockSource);
56  DEFINE_SHIFT_FROM_MASK(TriggerOrigLength);
57  }// end of namespace
58 
59 
60  //! Class to hold the data corresponding to the generated time of the trigger
61  /*!
62  The RawTriggerTimeV0 contains the information pertaining to the time at
63  which the trigger was generated, and what device generated the timestamp.
64 
65  The class supports general initialization with an internal or external
66  data buffer as well as copyin style initialization for use with
67  STL containers.
68  */
69  class RawTriggerTime: public PREVIOUS_VERSION_CLASS_NAME {
70 
71  public:
72 
73  RawTriggerTime (const version_t); ///< The default constructor
75  ~RawTriggerTime(); ///< Destructor
76 
77  void init ();
79  void print (std::ostream& os=std::cout) const;
81  /// Nanoslice of version 0 is a fixed size format
83  void* readData(const void* pointer){return RawDAQData::readDataGeneral(pointer);};
84 
85  IMPLEMENT_FIRST_GET_AND_SET(Version , uint32_t);
86  IMPLEMENT_FIRST_GET_AND_SET(TriggerTimeStampLow , uint32_t);
87  IMPLEMENT_FIRST_GET_AND_SET(TriggerTimeStampHigh , uint32_t);
88  IMPLEMENT_FIRST_GET_AND_SET(TriggerTimeStamp_sec , uint32_t);
89  IMPLEMENT_FIRST_GET_AND_SET(TriggerTimeStamp_usec, uint32_t);
90  IMPLEMENT_FIRST_GET_AND_SET(ClockSource , uint32_t);
91  IMPLEMENT_FIRST_GET_AND_SET(TriggerOrigLength , uint32_t);
92 
93  INIT_FIRST(getTriggerTimeStamp , const, uint64_t, );
94  INIT_FIRST(setTriggerTimeStamp , , bool , const uint64_t);
95  INIT_FIRST(getTriggerTimeStampTvUsec, const, suseconds_t, );
96  INIT_FIRST(setTriggerTimeStampTvUsec, , bool , const suseconds_t);
97  INIT_FIRST(getTriggerTimeStampTvSec , const, time_t, );
98  INIT_FIRST(setTriggerTimeStampTvSec , , bool , const time_t);
99  INIT_FIRST(getTriggerTimeStampTv , const, timeval, );
100  INIT_FIRST(setTriggerTimeStampTv , , bool , const timeval);
101  };
102 
103 
104 }} // END NAMESPCE daqdataformats
105 #endif /* DAQRAWTRIGGERTIMEV0_H */
void * readDataGeneral(const void *buffer)
General ReadData method when the sizeofdata is known.
Definition: RawDAQData.cpp:186
#define VERSION_NAMESPACE
#define CURRENT_FIELDS_SUB_NAMESPACE
#define INIT_FIRST(FUNC, CONSTNESS, OUTPUT_UNITS,...)
Definition: Macros.h:239
#define IMPLEMENT_FIRST_GET_AND_SET(FUNC, UNITS)
Definition: Macros.h:171
bool print
OStream cout
Definition: OStream.cxx:6
void * readData(const void *buffer)
Shallow copy constructor.
Definition: RawDAQData.cpp:181
int32_t version_t
Definition: RawDAQData.h:72
Class to hold the data from the FEBs in correct formats.
Class to hold the data corresponding to the generated time of the trigger.