LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
RDTimeStamp.h
Go to the documentation of this file.
1 //
3 // A timestamp data product to be associated with raw::RawDigit
4 // Tom Junk, June 26, 2018
5 //
7 
8 #ifndef RDTIMESTAMPDATAPRODUCT_H
9 #define RDTIMESTAMPDATAPRODUCT_H
10 
11 // uint64_t is typedef unsigned long long on macOS but unsigned long on Linux
12 // We use the root type ULong64_t from RtypesCore.h instead
13 #include "RtypesCore.h"
14 #include <stdint.h>
15 
16 namespace raw {
17 
18  class RDTimeStamp {
19 
20  public:
21  RDTimeStamp(ULong64_t tstamp = 0, uint16_t flags = 0)
22  {
23  fTimeStamp = tstamp;
24  fFlags = flags;
25  } // Constructor
26 
27  void SetTimeStamp(ULong64_t tstamp);
28  void SetTimeStamp_Low(uint32_t tslow);
29  void SetTimeStamp_High(uint32_t tshigh);
30  ULong64_t GetTimeStamp() const;
31  uint32_t GetTimeStamp_Low() const;
32  uint32_t GetTimeStamp_High() const;
33  void SetFlags(uint16_t flags);
34  uint16_t GetFlags() const;
35 
36  private:
37  ULong64_t fTimeStamp;
38  uint16_t fFlags;
39  };
40 
41  inline void RDTimeStamp::SetTimeStamp(ULong64_t tstamp)
42  {
43  fTimeStamp = tstamp;
44  }
45  inline void RDTimeStamp::SetTimeStamp_Low(uint32_t tslow)
46  {
47  fTimeStamp &= 0xFFFFFFFF00000000;
48  fTimeStamp |= tslow;
49  }
50  inline void RDTimeStamp::SetTimeStamp_High(uint32_t tshigh)
51  {
52  fTimeStamp &= 0xFFFFFFFF;
53  fTimeStamp |= ((ULong64_t)tshigh << 32);
54  }
55  inline ULong64_t RDTimeStamp::GetTimeStamp() const
56  {
57  return fTimeStamp;
58  }
59  inline uint32_t RDTimeStamp::GetTimeStamp_Low() const
60  {
61  return fTimeStamp & 0xFFFFFFFF;
62  }
63  inline uint32_t RDTimeStamp::GetTimeStamp_High() const
64  {
65  return fTimeStamp >> 32;
66  }
67  inline void RDTimeStamp::SetFlags(uint16_t flags)
68  {
69  fFlags = flags;
70  }
71  inline uint16_t RDTimeStamp::GetFlags() const
72  {
73  return fFlags;
74  }
75 
76 }
77 
78 #endif // RDTIMESTAMPDATAPRODUCT_H
uint16_t fFlags
Definition: RDTimeStamp.h:38
uint16_t GetFlags() const
Definition: RDTimeStamp.h:71
void SetTimeStamp(ULong64_t tstamp)
Definition: RDTimeStamp.h:41
Raw data description.
Definition: RawTypes.h:6
ULong64_t fTimeStamp
Definition: RDTimeStamp.h:37
uint32_t GetTimeStamp_High() const
Definition: RDTimeStamp.h:63
void SetFlags(uint16_t flags)
Definition: RDTimeStamp.h:67
void SetTimeStamp_High(uint32_t tshigh)
Definition: RDTimeStamp.h:50
ULong64_t GetTimeStamp() const
Definition: RDTimeStamp.h:55
uint32_t GetTimeStamp_Low() const
Definition: RDTimeStamp.h:59
RDTimeStamp(ULong64_t tstamp=0, uint16_t flags=0)
Definition: RDTimeStamp.h:21
void SetTimeStamp_Low(uint32_t tslow)
Definition: RDTimeStamp.h:45