SMACC
Loading...
Searching...
No Matches
state_reactor.cpp
Go to the documentation of this file.
2#include <ros/ros.h>
3
4namespace smacc
5{
6
8{
9}
10
12{
13 this->ownerState = ownerState;
14 this->onInitialized();
15}
16
18{
19}
20
21void StateReactor::onEventNotified(const std::type_info *eventType)
22{
23}
24
26{
27
28}
29
31{
32
33}
34
36{
37 if (this->triggers())
38 {
39 ROS_INFO("State reactor base REALLY TRIGGERS!!");
40 this->postEventFn();
41 }
42}
43
44namespace introspection
45{
46void StateReactorHandler::configureStateReactor(std::shared_ptr<smacc::StateReactor> sb)
47{
48 for (auto callback : this->callbacks_)
49 {
50 callback.fn(sb);
51 }
52}
53
54void EventGeneratorHandler::configureEventGenerator(std::shared_ptr<smacc::SmaccEventGenerator> eg)
55{
56 for (auto callback : this->callbacks_)
57 {
58 callback.fn(eg);
59 }
60}
61} // namespace introspection
62} // namespace smacc
virtual void onEntry()
virtual void onEventNotified(const std::type_info *eventType)
std::function< void()> postEventFn
virtual bool triggers()=0
void initialize(ISmaccState *ownerState)
virtual void onInitialized()
virtual void onExit()
void configureEventGenerator(std::shared_ptr< smacc::SmaccEventGenerator > eg)
std::vector< EventGeneratorCallbackFunctor > callbacks_
std::vector< StateReactorCallbackFunctor > callbacks_
void configureStateReactor(std::shared_ptr< smacc::StateReactor > sr)