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 onOrthogonalAllocation ()
 
void OnKeyPress (char character)
 
template<typename TEv >
void postKeyEvent ()
 
- Public Member Functions inherited from smacc2::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=false)
 
virtual void executeOnEntry ()
 
virtual void executeOnExit ()
 

Public Attributes

ClKeyboardClKeyboard_
 
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 24 of file cb_default_keyboard_behavior.hpp.

Member Function Documentation

◆ onEntry()

void cl_keyboard::CbDefaultKeyboardBehavior::onEntry ( )
virtual

Reimplemented from smacc2::ISmaccClientBehavior.

Definition at line 25 of file cb_default_keyboard_behavior.cpp.

References ClKeyboard_, OnKeyPress(), cl_keyboard::ClKeyboard::OnKeyPress(), and smacc2::ISmaccClientBehavior::requiresClient().

Here is the call graph for this function:

◆ OnKeyPress()

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

Definition at line 31 of file cb_default_keyboard_behavior.cpp.

31{ postEventKeyPress(character); }

References postEventKeyPress.

Referenced by onEntry().

Here is the caller graph for this function:

◆ onOrthogonalAllocation()

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

Definition at line 33 of file cb_default_keyboard_behavior.hpp.

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

References postEventKeyPress, and postKeyEvent().

Here is the call graph for this function:

◆ postKeyEvent()

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

Definition at line 95 of file cb_default_keyboard_behavior.hpp.

96 {
97 RCLCPP_WARN(
98 getLogger(), "CbDefaultKeyboardBehavior %ld ev: %s", (long)(void *)this,
99 smacc2::demangleSymbol(typeid(TEv).name()).c_str());
100 auto event = new TEv();
101 this->postEvent(event);
102 }
virtual rclcpp::Logger getLogger() const
std::string demangleSymbol()

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

Referenced by onOrthogonalAllocation().

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

Member Data Documentation

◆ ClKeyboard_

ClKeyboard* cl_keyboard::CbDefaultKeyboardBehavior::ClKeyboard_

Definition at line 27 of file cb_default_keyboard_behavior.hpp.

Referenced by onEntry().

◆ postEventKeyPress

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

Definition at line 28 of file cb_default_keyboard_behavior.hpp.

Referenced by OnKeyPress(), and onOrthogonalAllocation().


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