SMACC2
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
smacc2::state_reactors::SrConditional< TEv > Class Template Reference

#include <sr_conditional.hpp>

Inheritance diagram for smacc2::state_reactors::SrConditional< TEv >:
Inheritance graph
Collaboration diagram for smacc2::state_reactors::SrConditional< TEv >:
Collaboration graph

Public Member Functions

 SrConditional (std::function< bool(TEv *)> sr_conditionalFunction)
 
bool triggers ()
 
- 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 ()
 
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
 
bool conditionFlag = false
 

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

template<typename TEv>
class smacc2::state_reactors::SrConditional< TEv >

Definition at line 32 of file sr_conditional.hpp.

Constructor & Destructor Documentation

◆ SrConditional()

template<typename TEv >
smacc2::state_reactors::SrConditional< TEv >::SrConditional ( std::function< bool(TEv *)>  sr_conditionalFunction)
inline

Definition at line 39 of file sr_conditional.hpp.

40 {
41 std::function<void(TEv *)> callback = [this, sr_conditionalFunction](TEv * ev)
42 {
43 bool condition = sr_conditionalFunction(ev);
44 this->conditionFlag = condition;
45 };
46
47 this->createEventCallback(callback);
48 }
void createEventCallback(void(TClass::*callback)(T *), TClass *object)

References smacc2::StateReactor::createEventCallback().

Here is the call graph for this function:

Member Function Documentation

◆ triggers()

template<typename TEv >
bool smacc2::state_reactors::SrConditional< TEv >::triggers ( )
inlinevirtual

Implements smacc2::StateReactor.

Definition at line 50 of file sr_conditional.hpp.

50{ return this->conditionFlag; }

References smacc2::state_reactors::SrConditional< TEv >::conditionFlag.

Member Data Documentation

◆ conditionFlag

template<typename TEv >
bool smacc2::state_reactors::SrConditional< TEv >::conditionFlag = false
private

◆ triggeredEvents

template<typename TEv >
std::map<const std::type_info *, bool> smacc2::state_reactors::SrConditional< TEv >::triggeredEvents
private

Definition at line 35 of file sr_conditional.hpp.


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