SMACC
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
smacc::state_reactors::SrEventCountdown Class Reference

#include <sr_event_countdown.h>

Inheritance diagram for smacc::state_reactors::SrEventCountdown:
Inheritance graph
Collaboration diagram for smacc::state_reactors::SrEventCountdown:
Collaboration graph

Public Member Functions

 SrEventCountdown (int eventCount)
 
virtual void onInitialized () override
 
virtual void onEventNotified (const std::type_info *eventType) override
 
virtual bool triggers () override
 
- Public Member Functions inherited from smacc::StateReactor
 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)
 

Private Attributes

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

Additional Inherited Members

- Public Attributes inherited from smacc::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 19 of file sr_event_countdown.h.

Constructor & Destructor Documentation

◆ SrEventCountdown()

smacc::state_reactors::SrEventCountdown::SrEventCountdown ( int  eventCount)

Definition at line 11 of file sr_event_countdown.cpp.

Member Function Documentation

◆ onEventNotified()

void smacc::state_reactors::SrEventCountdown::onEventNotified ( const std::type_info *  eventType)
overridevirtual

Reimplemented from smacc::StateReactor.

Definition at line 24 of file sr_event_countdown.cpp.

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}
std::string demangleSymbol()
Definition: introspection.h:75

References smacc::introspection::demangleSymbol(), and eventCount_.

Here is the call graph for this function:

◆ onInitialized()

void smacc::state_reactors::SrEventCountdown::onInitialized ( )
overridevirtual

Reimplemented from smacc::StateReactor.

Definition at line 16 of file sr_event_countdown.cpp.

17{
18 for (auto type : eventTypes)
19 {
20 triggeredEvents[type] = false;
21 }
22}
std::vector< const std::type_info * > eventTypes
std::map< const std::type_info *, bool > triggeredEvents

References smacc::StateReactor::eventTypes, and triggeredEvents.

◆ triggers()

bool smacc::state_reactors::SrEventCountdown::triggers ( )
overridevirtual

Implements smacc::StateReactor.

Definition at line 38 of file sr_event_countdown.cpp.

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}

References eventCount_.

Member Data Documentation

◆ eventCount_

int smacc::state_reactors::SrEventCountdown::eventCount_
private

Definition at line 23 of file sr_event_countdown.h.

Referenced by onEventNotified(), and triggers().

◆ triggeredEvents

std::map<const std::type_info *, bool> smacc::state_reactors::SrEventCountdown::triggeredEvents
private

Definition at line 22 of file sr_event_countdown.h.

Referenced by onInitialized().


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