32 typedef enum { UNINITIALIZED, STOPPED, RUNNING } status_type;
35 Process() : _name(
"unnamed process"), _status(UNINITIALIZED), _manager_ptr(NULL) {}
41 Process(std::string name) : _name(name), _status(UNINITIALIZED), _manager_ptr(NULL) {}
50 virtual void init() = 0;
55 virtual void start() = 0;
61 virtual void update() = 0;
66 virtual void stop() = 0;
72 inline string name() {
return _name; }
80 inline high_resolution_clock::duration
period() {
return _period; }
88 inline time_point<high_resolution_clock>
start_time() {
return _start_time; }
93 inline high_resolution_clock::duration
last_update() {
return _last_update; }
98 inline high_resolution_clock::duration
previous_update() {
return _previous_update; }
105 void watch(
string event_name, std::function<
void(
Event&)> handler);
106 void emit(
const Event& event);
108 void http_get(std::string url, std::function<
void(json&)> handler);
114 void _start(high_resolution_clock::duration elapsed);
115 void _update(high_resolution_clock::duration elapsed);
121 high_resolution_clock::duration _period,
124 time_point<high_resolution_clock> _start_time;
The Process Manager class.
high_resolution_clock::duration previous_update()
time_point< high_resolution_clock > start_time()
Events that can be emitted, watched, and responded to with event handlers.
high_resolution_clock::duration last_update()
high_resolution_clock::duration period()
Process()
Default constructor. Names process "no name".
A channel for sending double values to and from Process objects.
An abstract base class for processes.
Process(std::string name)
Constructor that takes a name for the process.