stream  0.10.0
stream analysis framework
Markers.h
1 #ifndef BASE_MARKERS_H
2 #define BASE_MARKERS_H
3 
4 #include "base/TimeStamp.h"
5 
6 #include "base/Queue.h"
7 
8 namespace base {
9 
10  class SubEvent;
11 
14  struct SyncMarker {
15  unsigned uniqueid;
16  unsigned localid;
17  LocalStamp_t local_stamp;
18  GlobalTime_t localtm;
19  GlobalTime_t globaltm;
20  unsigned bufid;
21 
23  SyncMarker() : uniqueid(0), localid(0), local_stamp(0), localtm(0.), globaltm(0.), bufid(0) {}
24 
27 
29  void reset() { uniqueid=0; localid=0; local_stamp=0; localtm=0; globaltm=0; bufid=0; }
30  };
31 
32  // =========================================================================
33 
36  struct LocalTimeMarker {
37  GlobalTime_t localtm;
38  unsigned localid;
39 
42 
45 
46  // ~LocalTimeMarker() {}
47 
50  void reset() {}
51  };
52 
53  typedef RecordsQueue<LocalTimeMarker, false> LocalMarkersQueue;
54 
55  // =========================================================================
56 
59  struct GlobalMarker {
60  GlobalTime_t globaltm;
61  GlobalTime_t lefttm;
62  GlobalTime_t righttm;
63 
65  bool isflush;
66 
68  GlobalMarker(GlobalTime_t tm = 0.) :
69  globaltm(tm), lefttm(0.), righttm(0.), subev(0), isflush(false) {}
70 
72  GlobalMarker(const GlobalMarker& src) :
73  globaltm(src.globaltm), lefttm(src.lefttm), righttm(src.righttm), subev(src.subev), isflush(src.isflush) {}
74 
77 
79  bool null() const { return globaltm<=0.; }
81  void reset() { globaltm = 0.; isflush = false; subev = 0; }
82 
84  bool normal() const { return !isflush; }
85 
86  void SetInterval(double left, double right);
87 
88  int TestHitTime(const GlobalTime_t& hittime, double* dist = 0);
89  };
90 
91  typedef RecordsQueue<GlobalMarker, false> GlobalMarksQueue;
92 
93 }
94 
95 #endif
SubEvent - base class for all event structures Need for: virtual destructor - to be able delete any i...
Definition: base/SubEvent.h:14
global time marker
Definition: Markers.h:59
GlobalTime_t righttm
right range for hit selection
Definition: Markers.h:62
GlobalMarker(const GlobalMarker &src)
constructor
Definition: Markers.h:72
SubEvent * subev
structure with data, selected for the trigger, ownership
Definition: Markers.h:64
int TestHitTime(const GlobalTime_t &hittime, double *dist=0)
test hit time
Definition: Markers.cxx:26
~GlobalMarker()
destructor
Definition: Markers.h:76
bool normal() const
return true when interval defines normal event
Definition: Markers.h:84
GlobalTime_t globaltm
global time - reference time of marker
Definition: Markers.h:60
bool isflush
indicate that trigger is just for flushing, no real data is important
Definition: Markers.h:65
GlobalTime_t lefttm
left range for hit selection
Definition: Markers.h:61
void reset()
reset
Definition: Markers.h:81
GlobalMarker(GlobalTime_t tm=0.)
constructor
Definition: Markers.h:68
void SetInterval(double left, double right)
set interval
Definition: Markers.cxx:9
local time marker
Definition: Markers.h:36
GlobalTime_t localtm
local time in ns,
Definition: Markers.h:37
LocalTimeMarker()
constructor
Definition: Markers.h:41
void reset()
reset marker we need function, but it is not really used while no memory allocation
Definition: Markers.h:50
LocalTimeMarker(const LocalTimeMarker &src)
constructor
Definition: Markers.h:44
unsigned localid
arbitrary id, like aux number or sync number
Definition: Markers.h:38
sync marker
Definition: Markers.h:14
LocalStamp_t local_stamp
64-bit integer for local stamp representation
Definition: Markers.h:17
GlobalTime_t localtm
local time (ns),
Definition: Markers.h:18
void reset()
reset marker
Definition: Markers.h:29
GlobalTime_t globaltm
global time (ns), used for all selections
Definition: Markers.h:19
unsigned uniqueid
unique identifier for marker like 24-bit number of SYNC message
Definition: Markers.h:15
unsigned bufid
use it for keep reference from which buffer it is
Definition: Markers.h:20
SyncMarker()
constructor
Definition: Markers.h:23
SyncMarker(const SyncMarker &src)
constructor
Definition: Markers.h:26
unsigned localid
some local id, custom number for each subsystem
Definition: Markers.h:16