SMACC2
Loading...
Searching...
No Matches
cl_keyboard::CbDefaultKeyboardBehavior Class Reference

#include <cb_default_keyboard_behavior.hpp>

Inheritance diagram for cl_keyboard::CbDefaultKeyboardBehavior:
Inheritance graph
Collaboration diagram for cl_keyboard::CbDefaultKeyboardBehavior:
Collaboration graph

Public Member Functions

void onEntry ()
 
template<typename TOrthogonal , typename TSourceObject >
void onStateOrthogonalAllocation ()
 
void OnKeyPress (char character)
 
template<typename TEv >
void postKeyEvent ()
 
void onEntry ()
 
template<typename TOrthogonal , typename TSourceObject >
void onStateOrthogonalAllocation ()
 
void OnKeyPress (char character)
 
template<typename TEv >
void postKeyEvent ()
 
- Public Member Functions inherited from smacc2::SmaccClientBehavior
virtual ~SmaccClientBehavior ()
 
void onEntry () override
 
void onExit () override
 
- Public Member Functions inherited from smacc2::ISmaccClientBehavior
 ISmaccClientBehavior ()
 
virtual ~ISmaccClientBehavior ()
 
ISmaccStateMachinegetStateMachine ()
 
std::string getName () const
 
template<typename SmaccClientType >
void requiresClient (SmaccClientType *&storage)
 
template<typename SmaccComponentType >
void requiresComponent (SmaccComponentType *&storage, bool throwExceptionIfNotExist)
 
template<typename SmaccComponentType >
void requiresComponent (SmaccComponentType *&storage, ComponentRequirement requirementType=ComponentRequirement::SOFT)
 
virtual void executeOnEntry ()
 
virtual void executeOnExit ()
 

Public Attributes

components::CpKeyboardListener1cpSubscriber1
 
std::function< void(char)> postEventKeyPress
 

Additional Inherited Members

- Protected Member Functions inherited from smacc2::ISmaccClientBehavior
virtual void runtimeConfigure ()
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
ISmaccStategetCurrentState ()
 
virtual void dispose ()
 
virtual rclcpp::Node::SharedPtr getNode () const
 
virtual rclcpp::Logger getLogger () const
 

Detailed Description

Definition at line 26 of file cb_default_keyboard_behavior.hpp.

Member Function Documentation

◆ onEntry() [1/2]

void cl_keyboard::CbDefaultKeyboardBehavior::onEntry ( )
inlinevirtual

Reimplemented from smacc2::ISmaccClientBehavior.

Definition at line 32 of file cb_default_keyboard_behavior.hpp.

33 {
36 }
void OnKeyPress(void(T::*callback)(char keypress), T *object)
void requiresComponent(SmaccComponentType *&storage, bool throwExceptionIfNotExist)

References OnKeyPress(), cl_keyboard::components::CpKeyboardListener1::OnKeyPress(), and smacc2::ISmaccClientBehavior::requiresComponent().

Here is the call graph for this function:

◆ onEntry() [2/2]

void cl_keyboard::CbDefaultKeyboardBehavior::onEntry ( )
inlinevirtual

◆ OnKeyPress() [1/2]

void cl_keyboard::CbDefaultKeyboardBehavior::OnKeyPress ( char character)
inline

Definition at line 98 of file cb_default_keyboard_behavior.hpp.

98{ postEventKeyPress(character); }

References postEventKeyPress.

Referenced by onEntry().

Here is the caller graph for this function:

◆ OnKeyPress() [2/2]

void cl_keyboard::CbDefaultKeyboardBehavior::OnKeyPress ( char character)
inline

Definition at line 98 of file cb_default_keyboard_behavior.hpp.

98{ postEventKeyPress(character); }

References postEventKeyPress.

◆ onStateOrthogonalAllocation() [1/2]

template<typename TOrthogonal , typename TSourceObject >
void cl_keyboard::CbDefaultKeyboardBehavior::onStateOrthogonalAllocation ( )
inline

Definition at line 39 of file cb_default_keyboard_behavior.hpp.

40 {
41 postEventKeyPress = [=](char character)
42 {
43 if (character == 'a')
45 else if (character == 'b')
47 else if (character == 'c')
49 else if (character == 'd')
51 else if (character == 'e')
53 else if (character == 'f')
55 else if (character == 'g')
57 else if (character == 'h')
59 else if (character == 'i')
61 else if (character == 'j')
63 else if (character == 'k')
65 else if (character == 'l')
67 else if (character == 'm')
69 else if (character == 'n')
71 else if (character == 'o')
73 else if (character == 'p')
75 else if (character == 'q')
77 else if (character == 'r')
79 else if (character == 's')
81 else if (character == 't')
83 else if (character == 'u')
85 else if (character == 'v')
87 else if (character == 'w')
89 else if (character == 'x')
91 else if (character == 'y')
93 else if (character == 'z')
95 };
96 }

References postEventKeyPress, and postKeyEvent().

Here is the call graph for this function:

◆ onStateOrthogonalAllocation() [2/2]

template<typename TOrthogonal , typename TSourceObject >
void cl_keyboard::CbDefaultKeyboardBehavior::onStateOrthogonalAllocation ( )
inline

Definition at line 39 of file cb_default_keyboard_behavior.hpp.

40 {
41 postEventKeyPress = [=](char character)
42 {
43 if (character == 'a')
45 else if (character == 'b')
47 else if (character == 'c')
49 else if (character == 'd')
51 else if (character == 'e')
53 else if (character == 'f')
55 else if (character == 'g')
57 else if (character == 'h')
59 else if (character == 'i')
61 else if (character == 'j')
63 else if (character == 'k')
65 else if (character == 'l')
67 else if (character == 'm')
69 else if (character == 'n')
71 else if (character == 'o')
73 else if (character == 'p')
75 else if (character == 'q')
77 else if (character == 'r')
79 else if (character == 's')
81 else if (character == 't')
83 else if (character == 'u')
85 else if (character == 'v')
87 else if (character == 'w')
89 else if (character == 'x')
91 else if (character == 'y')
93 else if (character == 'z')
95 };
96 }

References postEventKeyPress, and postKeyEvent().

Here is the call graph for this function:

◆ postKeyEvent() [1/2]

template<typename TEv >
void cl_keyboard::CbDefaultKeyboardBehavior::postKeyEvent ( )
inline

Definition at line 101 of file cb_default_keyboard_behavior.hpp.

102 {
103 RCLCPP_WARN(
104 getLogger(), "CbDefaultKeyboardBehavior %ld ev: %s", (long)(void *)this,
105 smacc2::demangleSymbol(typeid(TEv).name()).c_str());
106 auto event = new TEv();
107 this->postEvent(event);
108 }
virtual rclcpp::Logger getLogger() const
std::string demangleSymbol()

References smacc2::introspection::demangleSymbol(), smacc2::ISmaccClientBehavior::getLogger(), and smacc2::ISmaccClientBehavior::postEvent().

Referenced by onStateOrthogonalAllocation().

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

◆ postKeyEvent() [2/2]

template<typename TEv >
void cl_keyboard::CbDefaultKeyboardBehavior::postKeyEvent ( )
inline

Definition at line 101 of file cb_default_keyboard_behavior.hpp.

102 {
103 RCLCPP_WARN(
104 getLogger(), "CbDefaultKeyboardBehavior %ld ev: %s", (long)(void *)this,
105 smacc2::demangleSymbol(typeid(TEv).name()).c_str());
106 auto event = new TEv();
107 this->postEvent(event);
108 }

References smacc2::introspection::demangleSymbol(), smacc2::ISmaccClientBehavior::getLogger(), and smacc2::ISmaccClientBehavior::postEvent().

Here is the call graph for this function:

Member Data Documentation

◆ cpSubscriber1

components::CpKeyboardListener1 * cl_keyboard::CbDefaultKeyboardBehavior::cpSubscriber1

Definition at line 29 of file cb_default_keyboard_behavior.hpp.

◆ postEventKeyPress

std::function< void(char)> cl_keyboard::CbDefaultKeyboardBehavior::postEventKeyPress

Definition at line 30 of file cb_default_keyboard_behavior.hpp.

Referenced by OnKeyPress(), and onStateOrthogonalAllocation().


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