SMACC
Loading...
Searching...
No Matches
smacc_transition.h
Go to the documentation of this file.
1/*****************************************************************************************************************
2 * ReelRobotix Inc. - Software License Agreement Copyright (c) 2018
3 * Authors: Pablo Inigo Blasco, Brett Aldrich
4 *
5 ******************************************************************************************************************/
6
7#pragma once
8
11namespace smacc
12{
13
15template <class Event,
16 class Destination,
17 typename Tag,
18 class TransitionContext,
19 void (TransitionContext::*pTransitionAction)(const Event &)>
21{
22public:
23 typedef Tag TRANSITION_TAG;
24
25private:
27 template <class State>
28 struct reactions
29 {
30 static boost::statechart::result react_without_action(State &stt)
31 {
32 ROS_DEBUG("[Smacc Transition] REACT WITHOUT ACTION");
34 TRANSITION_TAG mock;
35 specificNamedOnExit(stt, mock);
36
37 stt.template notifyTransition<Transtype>();
38 return stt.template transit<Destination>();
39 }
40
41 static boost::statechart::result react_with_action(State &stt, const Event &evt)
42 {
43 ROS_DEBUG("[Smacc Transition] REACT WITH ACTION AND EVENT");
45 TRANSITION_TAG mock;
46 specificNamedOnExit(stt, mock);
47 stt.template notifyTransition<Transtype>();
48 return stt.template transit<Destination>(pTransitionAction, evt);
49 }
50 };
51
52public:
54 // The following declarations should be private.
55 // They are only public because many compilers lack template friends.
57 template <class State, class EventBase, class IdType>
58 static boost::statechart::detail::reaction_result react(
59 State &stt, const EventBase &evt, const IdType &eventType)
60 {
61 typedef boost::statechart::detail::reaction_dispatcher<
62 reactions<State>, State, EventBase, Event, TransitionContext, IdType>
63 dispatcher;
64 return dispatcher::react(stt, evt, eventType);
65 }
66};
67} // namespace smacc
static boost::statechart::detail::reaction_result react(State &stt, const EventBase &evt, const IdType &eventType)
void specificNamedOnExit(TState &st, TTransitionTagName tn, std::true_type)
Definition: state_traits.h:24
static boost::statechart::result react_with_action(State &stt, const Event &evt)
static boost::statechart::result react_without_action(State &stt)