RTC Toolkit  1.0.0
model.hpp
Go to the documentation of this file.
1 
12 #ifndef RTCTK_COMPONENTFRAMEWORK_MODEL_HPP
13 #define RTCTK_COMPONENTFRAMEWORK_MODEL_HPP
14 
15 #include <list>
16 #include <string>
17 #include <vector>
18 
19 namespace rtctk::componentFramework {
20 
21 enum StateType {
27  Final
28 };
29 
30 struct State {
31  virtual ~State() = default;
32 
33  std::string m_id;
35 
37  std::list<State*> m_children;
38 
39  std::string m_do_activity_id;
40  std::string m_entry_action_id;
41  std::string m_exit_action_id;
42 };
43 
44 struct Transition {
47 
48  std::string m_event_id;
49  std::string m_guard_id;
50  std::string m_action_id;
51 };
52 
53 struct StateMachine : State {
54  StateMachine(std::string const& id) {
55  m_type = Machine;
56  m_id = id;
57  }
58 
60  for (State* s : m_all_states) {
61  delete s;
62  }
63 
64  for (Transition* t : m_all_transitions) {
65  delete t;
66  }
67  }
68 
69  std::list<State*> m_all_states;
70  std::list<Transition*> m_all_transitions;
71 };
72 
73 } // namespace rtctk::componentFramework
74 
75 #endif
rtctk::componentFramework::Simple
@ Simple
Definition: model.hpp:23
rtctk::componentFramework::StateMachine::StateMachine
StateMachine(std::string const &id)
Definition: model.hpp:54
rtctk::componentFramework::Parallel
@ Parallel
Definition: model.hpp:24
rtctk::componentFramework::StateMachine
Definition: model.hpp:53
rtctk::componentFramework
Definition: commandReplier.cpp:20
rtctk::componentFramework::Transition::m_source
State * m_source
Definition: model.hpp:45
rtctk::componentFramework::State::m_do_activity_id
std::string m_do_activity_id
Definition: model.hpp:39
rtctk::componentFramework::Transition::m_guard_id
std::string m_guard_id
Definition: model.hpp:49
rtctk::componentFramework::State::~State
virtual ~State()=default
rtctk::componentFramework::State::m_id
std::string m_id
Definition: model.hpp:33
rtctk::componentFramework::State::m_children
std::list< State * > m_children
Definition: model.hpp:37
rtctk::componentFramework::StateMachine::m_all_transitions
std::list< Transition * > m_all_transitions
Definition: model.hpp:70
rtctk::componentFramework::StateMachine::m_all_states
std::list< State * > m_all_states
Definition: model.hpp:69
rtctk::componentFramework::State::m_entry_action_id
std::string m_entry_action_id
Definition: model.hpp:40
rtctk::componentFramework::Transition::m_event_id
std::string m_event_id
Definition: model.hpp:48
rtctk::componentFramework::State
Definition: model.hpp:30
rtctk::componentFramework::State::m_parent
State * m_parent
Definition: model.hpp:36
rtctk::componentFramework::Transition::m_action_id
std::string m_action_id
Definition: model.hpp:50
rtctk::componentFramework::StateType
StateType
Definition: model.hpp:21
rtctk::componentFramework::Transition
Definition: model.hpp:44
rtctk::componentFramework::Machine
@ Machine
Definition: model.hpp:22
rtctk::componentFramework::Initial
@ Initial
Definition: model.hpp:26
rtctk::componentFramework::Final
@ Final
Definition: model.hpp:27
rtctk::componentFramework::State::m_exit_action_id
std::string m_exit_action_id
Definition: model.hpp:41
rtctk::componentFramework::State::m_type
StateType m_type
Definition: model.hpp:34
rtctk::componentFramework::Transition::m_target
State * m_target
Definition: model.hpp:46
rtctk::componentFramework::Composite
@ Composite
Definition: model.hpp:25
rtctk::componentFramework::StateMachine::~StateMachine
~StateMachine()
Definition: model.hpp:59