-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContext.h
53 lines (46 loc) · 1.34 KB
/
Context.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Per-thread analysis context
#ifndef PPODD_CONTEXT
#define PPODD_CONTEXT
#include "Podd.h"
#include "Decoder.h"
#include "Output.h"
#include <thread>
#include <functional>
#include <cassert>
#include <memory>
#include <string>
class Context {
public:
explicit Context( int id = 0 );
Context( const Context& context ); //FIXME: but operator= is deleted?
Context& operator=( const Context& rhs ) = delete;
~Context();
int Init();
#ifdef EVTORDER
void MarkActive();
void UnmarkActive();
void WaitAllDone();
bool IsSyncEvent();
#endif
// Per-thread data
#ifndef PPODD_TBB
evbuf_ptr_t evbuffer; // Event buffer read from file
#endif
Decoder evdata; // Decoded data
detlst_t detectors; // Detectors with private event-by-event data
std::shared_ptr<varlst_t> variables; // Interface to analysis results
voutp_t outvars; // Output definitions
size_t nev{}; // Event number given to this thread
size_t iseq{}; // Event sequence number
int id{}; // This context's ID
bool is_init; // Init() called successfully
bool is_active; // Currently being processed in a worker thread
ClockTime_t m_time_spent{}; // Analysis time sum
private:
#ifdef EVTORDER
static std::mutex fgMutex;
static std::condition_variable fgAllDone;
static int fgNactive;
#endif
};
#endif