SMACC2
Loading...
Searching...
No Matches
sr_all_events_go.cpp
Go to the documentation of this file.
1// Copyright 2021 RobosoftAI Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#include <smacc2/common.hpp>
17
18namespace smacc2
19{
20namespace state_reactors
21{
22using namespace smacc2::introspection;
24{
25 for (auto type : eventTypes)
26 {
27 triggeredEvents[type] = false;
28 }
29}
30
31void SrAllEventsGo::onEventNotified(const std::type_info * eventType)
32{
33 RCLCPP_INFO_STREAM(
34 getLogger(), "[SB ALLEventsGo] RECEIVED EVENT OF TYPE:" << demangleSymbol(eventType->name()));
35 triggeredEvents[eventType] = true;
36
37 for (auto & entry : triggeredEvents)
38 {
39 RCLCPP_INFO_STREAM(getLogger(), demangleSymbol(entry.first->name()) << " = " << entry.second);
40 }
41}
42
44{
45 RCLCPP_INFO_STREAM(getLogger(), "SB All TRIGGERS?");
46 for (auto & entry : triggeredEvents)
47 {
48 if (!entry.second) return false;
49 }
50 RCLCPP_INFO_STREAM(getLogger(), "SB ALL TRIGGERED");
51 return true;
52}
53} // namespace state_reactors
54} // namespace smacc2
rclcpp::Logger getLogger()
std::vector< const std::type_info * > eventTypes
std::map< const std::type_info *, bool > triggeredEvents
void onEventNotified(const std::type_info *eventType) override
std::string demangleSymbol()