SMACC
Loading...
Searching...
No Matches
state_traits.h
Go to the documentation of this file.
1#pragma once
2
3namespace smacc
4{
5 template <typename T, typename TransitionTagName>
7 {
8 template <typename U, void (U::*)(TransitionTagName)>
9 struct Check;
10 template <typename U>
11 static char func(Check<U, &U::onExit> *);
12 template <typename U>
13 static int func(...);
14
15 public:
17 enum
18 {
19 value = sizeof(func<T>(0)) == sizeof(char)
20 };
21 };
22
23 template <typename TState, typename TTransitionTagName>
24 void specificNamedOnExit(TState &st, TTransitionTagName tn, std::true_type)
25 {
26 st.onExit(tn);
27 }
28
29 template <typename TState, typename TTransitionTagName>
30 void specificNamedOnExit(TState &, TTransitionTagName tn, std::false_type)
31 {
32 }
33
34 template <typename TState, typename TTransitionTagName>
35 void specificNamedOnExit(TState &m, TTransitionTagName tn)
36 {
38 std::integral_constant<bool, HasSpecificNamedOnExit<TState, TTransitionTagName>::value>());
39 }
40
41 //-------------------------------------------------
42
43 template <typename T>
45 {
46 template <typename U, void (U::*)()>
47 struct Check;
48 template <typename U>
49 static char func(Check<U, &U::onExit> *);
50 template <typename U>
51 static int func(...);
52
53 public:
55 enum
56 {
57 value = sizeof(func<T>(0)) == sizeof(char)
58 };
59 };
60
61 template <typename TState>
62 void standardOnExit(TState &st, std::true_type)
63 {
64 st.onExit();
65 }
66
67 template <typename TState>
68 void standardOnExit(TState &, std::false_type)
69 {
70 }
71
72 template <typename TState>
73 void standardOnExit(TState &m)
74 {
76 std::integral_constant<bool, HasStandardOnExit<TState>::value>());
77 }
78
79} // namespace smacc
HasSpecificNamedOnExit type
Definition: state_traits.h:16
static char func(Check< U, &U::onExit > *)
static int func(...)
HasStandardOnExit type
Definition: state_traits.h:54
static char func(Check< U, &U::onExit > *)
void standardOnExit(TState &st, std::true_type)
Definition: state_traits.h:62
void specificNamedOnExit(TState &st, TTransitionTagName tn, std::true_type)
Definition: state_traits.h:24