fsm
states.h
1 
12 #pragma once
13 
14 #include <tuple>
15 #include <type_traits>
16 
17 #include "../base/assert.h"
18 #include "../base/type_traits.h"
19 
20 #include "detail/handle_result.h"
21 #include "transitions.h"
22 //#include "fsmpp2/config.hpp"
23 
24 
25 namespace escad
26 {
27 
31 struct event {};
32 
33 
38 template<class... E>
39 using events = mpl::type_list<E...>;
40 
44 template<class... S>
45 struct states {
46  using type_list = mpl::type_list<S...>;
47  static constexpr auto count = type_list::size;
48 };
49 
60 template<class... SubStates>
61 struct state {
62  using substates_type = states<SubStates...>;
63  using state_tag = void;
64 
70  template<class S>
71  auto transition() const {
73  }
74 
81  auto not_handled() const {
83  }
84 
91  auto handled() const {
93  }
94 };
95 
96 
97 
98 } // namespace fsm
auto transition() const
Execute transition to another state.
Definition: states.h:71
Definition: handle_result.h:18
auto handled() const
Indicate that event was handled.
Definition: states.h:91
Base class for an event.
Definition: states.h:31
Denotes a state.
Definition: states.h:61
auto not_handled() const
Indicate that event was not handled.
Definition: states.h:81
Definition: handle_result.h:19
Defines a set of states.
Definition: states.h:45
Event handler return type.
Definition: transitions.h:28
Definition: compressed_pair.h:10
Alias template to facilitate the creation of named values.
Definition: type_traits.h:142
Definition: handle_result.h:17