SMACC2
Public Member Functions | Private Attributes | List of all members
smacc2::state_reactors::SrAllEventsGo Class Reference

#include <sr_all_events_go.hpp>

Inheritance diagram for smacc2::state_reactors::SrAllEventsGo:
Inheritance graph
Collaboration diagram for smacc2::state_reactors::SrAllEventsGo:
Collaboration graph

Public Member Functions

 SrAllEventsGo ()
 
void onInitialized () override
 
void onEventNotified (const std::type_info *eventType) override
 
bool triggers () override
 
- Public Member Functions inherited from smacc2::StateReactor
 StateReactor ()
 
virtual ~StateReactor ()
 
virtual void onInitialized ()
 
virtual void onEntry ()
 
virtual void onExit ()
 
virtual void onEventNotified (const std::type_info *eventType)
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
template<typename T , typename TClass >
void createEventCallback (void(TClass::*callback)(T *), TClass *object)
 
template<typename T >
void createEventCallback (std::function< void(T *)> callback)
 
void update ()
 
virtual bool triggers ()=0
 
template<typename TEv >
void addInputEvent ()
 
template<typename TEv >
void setOutputEvent ()
 
void initialize (ISmaccState *ownerState)
 
rclcpp::Node::SharedPtr & getNode ()
 
rclcpp::Logger getLogger ()
 

Private Attributes

std::map< const std::type_info *, booltriggeredEvents
 

Additional Inherited Members

- Public Attributes inherited from smacc2::StateReactor
ISmaccStateownerState
 
std::function< void()> postEventFn
 
std::vector< const std::type_info * > eventTypes
 
std::map< const std::type_info *, std::function< void(void *)> > eventCallbacks_
 

Detailed Description

Definition at line 31 of file sr_all_events_go.hpp.

Constructor & Destructor Documentation

◆ SrAllEventsGo()

smacc2::state_reactors::SrAllEventsGo::SrAllEventsGo ( )
inline

Definition at line 36 of file sr_all_events_go.hpp.

36{}

Member Function Documentation

◆ onEventNotified()

void smacc2::state_reactors::SrAllEventsGo::onEventNotified ( const std::type_info *  eventType)
overridevirtual

Reimplemented from smacc2::StateReactor.

Definition at line 31 of file sr_all_events_go.cpp.

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}
rclcpp::Logger getLogger()
std::map< const std::type_info *, bool > triggeredEvents
std::string demangleSymbol(const std::string &name)

References smacc2::introspection::demangleSymbol(), smacc2::StateReactor::getLogger(), and triggeredEvents.

Here is the call graph for this function:

◆ onInitialized()

void smacc2::state_reactors::SrAllEventsGo::onInitialized ( )
overridevirtual

Reimplemented from smacc2::StateReactor.

Definition at line 23 of file sr_all_events_go.cpp.

24{
25 for (auto type : eventTypes)
26 {
27 triggeredEvents[type] = false;
28 }
29}
std::vector< const std::type_info * > eventTypes

References smacc2::StateReactor::eventTypes, triggeredEvents, and generate_debs::type.

◆ triggers()

bool smacc2::state_reactors::SrAllEventsGo::triggers ( )
overridevirtual

Implements smacc2::StateReactor.

Definition at line 43 of file sr_all_events_go.cpp.

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}

References smacc2::StateReactor::getLogger(), and triggeredEvents.

Here is the call graph for this function:

Member Data Documentation

◆ triggeredEvents

std::map<const std::type_info *, bool> smacc2::state_reactors::SrAllEventsGo::triggeredEvents
private

Definition at line 33 of file sr_all_events_go.hpp.

Referenced by onEventNotified(), onInitialized(), and triggers().


The documentation for this class was generated from the following files: