EEROS  0.4.1.0
API for the EEROS Real-Time Robotics Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SafetyLevel.hpp
Go to the documentation of this file.
1 #ifndef ORG_EEROS_SAFETY_SAFETYLEVEL_HPP_
2 #define ORG_EEROS_SAFETY_SAFETYLEVEL_HPP_
3 
4 #include <stdint.h>
5 #include <string>
6 #include <vector>
7 #include <map>
8 #include <functional>
11 
12 namespace eeros {
13  namespace safety {
14 
15  class SafetyContext;
16  class SafetySystem;
17 
18  enum { kInvalidLevel = -1 };
20 
21  class SafetyLevel {
22 
23  friend class SafetySystem;
24 
25  public:
26  SafetyLevel(int32_t id, std::string description);
27  virtual ~SafetyLevel();
28 
29  int32_t getId();
30  std::string getDescription();
31  int32_t getLevelIdForEvent(uint32_t event, bool privateEventOk = false);
32 
33  void addEvent(uint32_t event, int32_t nextLevelId, EventType type = kPrivateEvent);
34 
35  void setInputAction(InputAction* action); // TODO rename to add...
36  void setInputActions(std::vector<InputAction*> actionList);
37  void setOutputAction(OutputAction* action); // TODO rename to add...
38  void setOutputActions(std::vector<OutputAction*> actionList);
39 
40  void setLevelAction(std::function<void (SafetyContext* context)> action);
41 
43 
44  private:
45  std::function<void (SafetyContext*)> action;
46 
47  int32_t id;
48  std::string description;
49  std::map<uint32_t, std::pair<int32_t, EventType>> transitions;
50 
51  std::vector<InputAction*> inputAction;
52  std::vector<OutputAction*> outputAction;
53  };
54 
55  };
56 };
57 
58 #endif // ORG_EEROS_SAFETY_SAFETYLEVEL_HPP_
Definition: SafetySystem.hpp:19
void setInputAction(InputAction *action)
Definition: SafetyLevel.cpp:38
void setLevelAction(std::function< void(SafetyContext *context)> action)
Definition: SafetyLevel.cpp:33
Definition: SafetyLevel.hpp:21
Definition: SafetyLevel.hpp:19
SafetyLevel(int32_t id, std::string description)
Definition: SafetyLevel.cpp:5
EventType
Definition: SafetyLevel.hpp:19
virtual ~SafetyLevel()
Definition: SafetyLevel.cpp:9
std::string getDescription()
Definition: SafetyLevel.cpp:17
Definition: OutputAction.hpp:10
int32_t getLevelIdForEvent(uint32_t event, bool privateEventOk=false)
Definition: SafetyLevel.cpp:21
void setInputActions(std::vector< InputAction * > actionList)
Definition: SafetyLevel.cpp:42
Definition: SafetyContext.hpp:11
SafetyLevel & operator<(const SafetyLevel &)
int32_t getId()
Definition: SafetyLevel.cpp:13
type
Definition: Sequencer.hpp:15
void setOutputActions(std::vector< OutputAction * > actionList)
Definition: SafetyLevel.cpp:50
Definition: InputAction.hpp:12
void setOutputAction(OutputAction *action)
Definition: SafetyLevel.cpp:46
Definition: SafetyLevel.hpp:18
void addEvent(uint32_t event, int32_t nextLevelId, EventType type=kPrivateEvent)
Definition: SafetyLevel.cpp:29
Definition: SafetyLevel.hpp:19