SMACC2
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 ()
 
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
 
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 bool condition = sr_conditionalFunction(ev);
43 this->conditionFlag = condition;
44 };
45
46 this->createEventCallback(callback);
47 }
void createEventCallback(void(TClass::*callback)(T *), TClass *object)
void callback(const image_tools::ROSCvMatContainer &img)

References callback(), and 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 49 of file sr_conditional.hpp.

49{ 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: