-
Notifications
You must be signed in to change notification settings - Fork 2
/
ApplicationContext.h
69 lines (45 loc) · 1.47 KB
/
ApplicationContext.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// Created by romanov on 6/1/17.
//
#ifndef EVESTANDALONE_ROOTLOOPTASKS_H
#define EVESTANDALONE_ROOTLOOPTASKS_H
#include <atomic>
#include <chrono>
#include <thread>
#include <mutex>
#include "WaitingLogic.h"
namespace hdvis {
enum class JanaStates {
Startup,
ProcessingEvent,
Idle
};
class ApplicationContext {
public:
/// Mutex between ROOT graphical thread and EvenRead function
static std::mutex InnerLoopMutex;
ApplicationContext():
_janaState(JanaStates::Startup)
{
};
WaitingLogic& JanaWaitingLogic() { return _waitingLogic; }
std::string JanaStateStr() const
{
JanaStates state = _janaState;
if (state == JanaStates::Startup) return "Startup";
if (state == JanaStates::ProcessingEvent) return "ProcessingEvent";
if (state == JanaStates::Idle) return "Idle";
return std::string();
}
JanaStates JanaState() const {return _janaState; }
void SetJanaState(JanaStates state) { _janaState = state; }
uint64_t CurrentEventNumber() const {return _currentEventNumber; }
void SetCurrentEventNumber(uint64_t eventNumber) {_currentEventNumber = eventNumber; }
protected:
private:
WaitingLogic _waitingLogic;
std::atomic<JanaStates> _janaState;
std::atomic<uint64_t> _currentEventNumber;
};
}
#endif //EVESTANDALONE_ROOTLOOPTASKS_H