SMACC
Loading...
Searching...
No Matches
sr_event_countdown.cpp
Go to the documentation of this file.
1
2#include <smacc/common.h>
4#include <memory>
5
6namespace smacc
7{
8namespace state_reactors
9{
10using namespace smacc::introspection;
12 : eventCount_(eventCount)
13{
14}
15
17{
18 for (auto type : eventTypes)
19 {
20 triggeredEvents[type] = false;
21 }
22}
23
24void SrEventCountdown::onEventNotified(const std::type_info *eventType)
25{
27 ROS_INFO_STREAM("SB COUNTDOWN (" << eventCount_ << ") RECEIVED EVENT OF TYPE:" << demangleSymbol(eventType->name()));
28
29 // ROS_INFO_STREAM("SB ALL RECEIVED EVENT OF TYPE:" << demangleSymbol(eventType->name()));
30 // triggeredEvents[eventType] = true;
31
32 // for (auto &entry : triggeredEvents)
33 // {
34 // ROS_INFO_STREAM(demangleSymbol(entry.first->name()) << " = " << entry.second);
35 // }
36}
37
39{
40 if (eventCount_ == 0)
41 {
42 ROS_INFO_STREAM("SB COUNTDOWN (" << eventCount_ << ") TRIGGERS!");
43 return true;
44 }
45 else
46 {
47 return false;
48 }
49
50 // ROS_INFO("SB All TRIGGERS?");
51 // for (auto &entry : triggeredEvents)
52 // {
53 // if (!entry.second)
54 // return false;
55 // }
56 // ROS_INFO("SB ALL TRIGGERED");
57 // return true;
58}
59
60} // namespace state_reactors
61} // namespace smacc
std::vector< const std::type_info * > eventTypes
virtual void onEventNotified(const std::type_info *eventType) override
std::map< const std::type_info *, bool > triggeredEvents
std::string demangleSymbol()
Definition: introspection.h:75