Terminus
actionscheduler.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <functional>
4 #include <mutex>
5 #include <vector>
6 
7 namespace terminus
8 {
9 
17 {
18 public:
23  using Action = std::function<bool(void)>;
24 
26 
31  void scheduleAction(const Action & action);
32 
37  void executeActions();
38 
39 protected:
41  std::vector<Action> m_actionList[2];
42 
43  std::recursive_mutex m_actionListMutex;
44 };
45 
46 }
void scheduleAction(const Action &action)
add an Action to the action list
Definition: actionscheduler.cpp:11
void executeActions()
execute all Actions currently contained in the action list and possibly schedule them again ...
Definition: actionscheduler.cpp:18
std::vector< Action > m_actionList[2]
Definition: actionscheduler.h:41
ActionScheduler()
Definition: actionscheduler.cpp:6
int m_currentActionList
Definition: actionscheduler.h:40
std::function< bool(void)> Action
functions that can be stored as actions can not have parameters and must return a bool whether they s...
Definition: actionscheduler.h:23
Definition: eventhandler.cpp:18
The ActionScheduler class maintains a list of actions, that should be executed later in a specific co...
Definition: actionscheduler.h:16
std::recursive_mutex m_actionListMutex
Definition: actionscheduler.h:43