SMACC2
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
smacc2::ISmaccClientBehavior Class Reference

#include <smacc_client_behavior_base.hpp>

Inheritance diagram for smacc2::ISmaccClientBehavior:
Inheritance graph
Collaboration diagram for smacc2::ISmaccClientBehavior:
Collaboration graph

Public Member Functions

 ISmaccClientBehavior ()
 
virtual ~ISmaccClientBehavior ()
 
ISmaccStateMachinegetStateMachine ()
 
std::string getName () const
 
template<typename SmaccClientType >
void requiresClient (SmaccClientType *&storage)
 
template<typename SmaccComponentType >
void requiresComponent (SmaccComponentType *&storage)
 

Protected Member Functions

virtual void runtimeConfigure ()
 
virtual void onEntry ()
 
virtual void onExit ()
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
ISmaccStategetCurrentState ()
 
virtual void dispose ()
 
virtual rclcpp::Node::SharedPtr getNode ()
 
virtual rclcpp::Logger getLogger ()
 

Private Member Functions

virtual void executeOnEntry ()
 
virtual void executeOnExit ()
 
template<typename TOrthogonal , typename TSourceObject >
void onOrthogonalAllocation ()
 

Private Attributes

ISmaccStateMachinestateMachine_
 
ISmaccStatecurrentState
 
smacc2::ISmaccOrthogonalcurrentOrthogonal
 

Friends

class ISmaccState
 
class ISmaccOrthogonal
 
class ISmaccAsynchronousClientBehavior
 

Detailed Description

Definition at line 29 of file smacc_client_behavior_base.hpp.

Constructor & Destructor Documentation

◆ ISmaccClientBehavior()

smacc2::ISmaccClientBehavior::ISmaccClientBehavior ( )

Definition at line 25 of file smacc_client_behavior_base.cpp.

26{
27 stateMachine_ = nullptr;
28 currentState = nullptr;
29}

References currentState, and stateMachine_.

◆ ~ISmaccClientBehavior()

smacc2::ISmaccClientBehavior::~ISmaccClientBehavior ( )
virtual

Definition at line 31 of file smacc_client_behavior_base.cpp.

32{
33 RCLCPP_WARN(getLogger(), "Client behavior deallocated.");
34}

References getLogger().

Here is the call graph for this function:

Member Function Documentation

◆ dispose()

void smacc2::ISmaccClientBehavior::dispose ( )
protectedvirtual

Reimplemented in smacc2::SmaccAsyncClientBehavior.

Definition at line 74 of file smacc_client_behavior_base.cpp.

74{}

◆ executeOnEntry()

void smacc2::ISmaccClientBehavior::executeOnEntry ( )
privatevirtual

Reimplemented in smacc2::SmaccAsyncClientBehavior.

Definition at line 60 of file smacc_client_behavior_base.cpp.

61{
62 RCLCPP_DEBUG(
63 getLogger(), "[%s] Default empty SmaccClientBehavior onEntry", this->getName().c_str());
64 this->onEntry();
65}

References getLogger(), getName(), and onEntry().

Here is the call graph for this function:

◆ executeOnExit()

void smacc2::ISmaccClientBehavior::executeOnExit ( )
privatevirtual

Reimplemented in smacc2::SmaccAsyncClientBehavior.

Definition at line 67 of file smacc_client_behavior_base.cpp.

68{
69 RCLCPP_DEBUG(
70 getLogger(), "[%s] Default empty SmaccClientBehavior onExit", this->getName().c_str());
71 this->onExit();
72}

References getLogger(), getName(), and onExit().

Here is the call graph for this function:

◆ getCurrentState()

ISmaccState * smacc2::ISmaccClientBehavior::getCurrentState ( )
inlineprotected

Definition at line 64 of file smacc_client_behavior_impl.hpp.

64{ return this->currentState; }

References currentState.

◆ getLogger()

rclcpp::Logger smacc2::ISmaccClientBehavior::getLogger ( )
protectedvirtual

◆ getName()

std::string smacc2::ISmaccClientBehavior::getName ( ) const

◆ getNode()

rclcpp::Node::SharedPtr smacc2::ISmaccClientBehavior::getNode ( )
protectedvirtual

◆ getStateMachine()

ISmaccStateMachine * smacc2::ISmaccClientBehavior::getStateMachine ( )
inline

◆ onEntry()

virtual void smacc2::ISmaccClientBehavior::onEntry ( )
inlineprotectedvirtual

◆ onExit()

virtual void smacc2::ISmaccClientBehavior::onExit ( )
inlineprotectedvirtual

◆ onOrthogonalAllocation()

template<typename TOrthogonal , typename TSourceObject >
void smacc2::ISmaccClientBehavior::onOrthogonalAllocation
private

Definition at line 89 of file smacc_client_behavior_impl.hpp.

90{
91}

◆ postEvent() [1/2]

template<typename EventType >
void smacc2::ISmaccClientBehavior::postEvent
protected

Definition at line 45 of file smacc_client_behavior_impl.hpp.

46{
47 if (stateMachine_ == nullptr)
48 {
49 RCLCPP_ERROR(
50 getLogger(),
51 "The client behavior cannot post events before being assigned to an orthogonal. Ignoring "
52 "post event call.");
53 }
54 else
55 {
56 stateMachine_->template postEvent<EventType>(EventLifeTime::CURRENT_STATE);
57 }
58}

References smacc2::CURRENT_STATE, getLogger(), and stateMachine_.

Referenced by cl_keyboard::CbDefaultKeyboardBehavior::postKeyEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ postEvent() [2/2]

template<typename EventType >
void smacc2::ISmaccClientBehavior::postEvent ( const EventType &  ev)
protected

Definition at line 29 of file smacc_client_behavior_impl.hpp.

30{
31 if (stateMachine_ == nullptr)
32 {
33 RCLCPP_ERROR(
34 getLogger(),
35 "The client behavior cannot post events before being assigned to an orthogonal. Ignoring "
36 "post event call.");
37 }
38 else
39 {
41 }
42}
void postEvent(EventType *ev, EventLifeTime evlifetime=EventLifeTime::ABSOLUTE)

References smacc2::CURRENT_STATE, getLogger(), smacc2::ISmaccStateMachine::postEvent(), and stateMachine_.

Here is the call graph for this function:

◆ requiresClient()

template<typename SmaccClientType >
void smacc2::ISmaccClientBehavior::requiresClient ( SmaccClientType *&  storage)

◆ requiresComponent()

template<typename SmaccComponentType >
void smacc2::ISmaccClientBehavior::requiresComponent ( SmaccComponentType *&  storage)

Definition at line 73 of file smacc_client_behavior_impl.hpp.

74{
75 if (stateMachine_ == nullptr)
76 {
77 RCLCPP_ERROR(
78 getLogger(),
79 "Cannot use the requiresComponent funcionality before assigning the client behavior to an "
80 "orthogonal. Try using the OnEntry method to capture required components.");
81 }
82 else
83 {
85 }
86}
void requiresComponent(SmaccComponentType *&storage, bool throwsException=false)

References getLogger(), smacc2::ISmaccStateMachine::requiresComponent(), and stateMachine_.

Here is the call graph for this function:

◆ runtimeConfigure()

void smacc2::ISmaccClientBehavior::runtimeConfigure ( )
protectedvirtual

Definition at line 53 of file smacc_client_behavior_base.cpp.

54{
55 RCLCPP_DEBUG(
56 getLogger(), "[%s] Default empty SmaccClientBehavior runtimeConfigure",
57 this->getName().c_str());
58}

References getLogger(), and getName().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ ISmaccAsynchronousClientBehavior

friend class ISmaccAsynchronousClientBehavior
friend

Definition at line 86 of file smacc_client_behavior_base.hpp.

◆ ISmaccOrthogonal

friend class ISmaccOrthogonal
friend

Definition at line 85 of file smacc_client_behavior_base.hpp.

◆ ISmaccState

friend class ISmaccState
friend

Definition at line 84 of file smacc_client_behavior_base.hpp.

Member Data Documentation

◆ currentOrthogonal

smacc2::ISmaccOrthogonal* smacc2::ISmaccClientBehavior::currentOrthogonal
private

Definition at line 82 of file smacc_client_behavior_base.hpp.

Referenced by requiresClient().

◆ currentState

ISmaccState* smacc2::ISmaccClientBehavior::currentState
private

Definition at line 81 of file smacc_client_behavior_base.hpp.

Referenced by getCurrentState(), and ISmaccClientBehavior().

◆ stateMachine_

ISmaccStateMachine* smacc2::ISmaccClientBehavior::stateMachine_
private

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