SMACC2
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
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)
 

Public Attributes

ClKeyboardClKeyboard_
 
std::function< void(char)> postEventKeyPress
 

Additional Inherited Members

- Protected Member Functions inherited from smacc2::ISmaccClientBehavior
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 ()
 

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::SmaccClientBehavior.

Definition at line 19 of file cb_default_keyboard_behavior.cpp.

20{
23}
void OnKeyPress(void(T::*callback)(char keypress), T *object)
void requiresClient(SmaccClientType *&storage)

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 25 of file cb_default_keyboard_behavior.cpp.

25{ 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')
38 postKeyEvent<EvKeyPressA<CbDefaultKeyboardBehavior, TOrthogonal>>();
39 else if (character == 'b')
40 postKeyEvent<EvKeyPressB<CbDefaultKeyboardBehavior, TOrthogonal>>();
41 else if (character == 'c')
42 postKeyEvent<EvKeyPressC<CbDefaultKeyboardBehavior, TOrthogonal>>();
43 else if (character == 'd')
44 postKeyEvent<EvKeyPressD<CbDefaultKeyboardBehavior, TOrthogonal>>();
45 else if (character == 'e')
46 postKeyEvent<EvKeyPressE<CbDefaultKeyboardBehavior, TOrthogonal>>();
47 else if (character == 'f')
48 postKeyEvent<EvKeyPressF<CbDefaultKeyboardBehavior, TOrthogonal>>();
49 else if (character == 'g')
50 postKeyEvent<EvKeyPressG<CbDefaultKeyboardBehavior, TOrthogonal>>();
51 else if (character == 'h')
52 postKeyEvent<EvKeyPressH<CbDefaultKeyboardBehavior, TOrthogonal>>();
53 else if (character == 'y')
54 postKeyEvent<EvKeyPressI<CbDefaultKeyboardBehavior, TOrthogonal>>();
55 else if (character == 'j')
56 postKeyEvent<EvKeyPressJ<CbDefaultKeyboardBehavior, TOrthogonal>>();
57 else if (character == 'k')
58 postKeyEvent<EvKeyPressK<CbDefaultKeyboardBehavior, TOrthogonal>>();
59 else if (character == 'l')
60 postKeyEvent<EvKeyPressL<CbDefaultKeyboardBehavior, TOrthogonal>>();
61 else if (character == 'm')
62 postKeyEvent<EvKeyPressM<CbDefaultKeyboardBehavior, TOrthogonal>>();
63 else if (character == 'n')
64 postKeyEvent<EvKeyPressN<CbDefaultKeyboardBehavior, TOrthogonal>>();
65 else if (character == 'o')
66 postKeyEvent<EvKeyPressO<CbDefaultKeyboardBehavior, TOrthogonal>>();
67 else if (character == 'p')
68 postKeyEvent<EvKeyPressP<CbDefaultKeyboardBehavior, TOrthogonal>>();
69 else if (character == 'q')
70 postKeyEvent<EvKeyPressQ<CbDefaultKeyboardBehavior, TOrthogonal>>();
71 else if (character == 'r')
72 postKeyEvent<EvKeyPressR<CbDefaultKeyboardBehavior, TOrthogonal>>();
73 else if (character == 's')
74 postKeyEvent<EvKeyPressS<CbDefaultKeyboardBehavior, TOrthogonal>>();
75 else if (character == 't')
76 postKeyEvent<EvKeyPressT<CbDefaultKeyboardBehavior, TOrthogonal>>();
77 else if (character == 'u')
78 postKeyEvent<EvKeyPressU<CbDefaultKeyboardBehavior, TOrthogonal>>();
79 else if (character == 'v')
80 postKeyEvent<EvKeyPressV<CbDefaultKeyboardBehavior, TOrthogonal>>();
81 else if (character == 'w')
82 postKeyEvent<EvKeyPressW<CbDefaultKeyboardBehavior, TOrthogonal>>();
83 else if (character == 'x')
84 postKeyEvent<EvKeyPressX<CbDefaultKeyboardBehavior, TOrthogonal>>();
85 else if (character == 'y')
86 postKeyEvent<EvKeyPressY<CbDefaultKeyboardBehavior, TOrthogonal>>();
87 else if (character == 'z')
88 postKeyEvent<EvKeyPressZ<CbDefaultKeyboardBehavior, TOrthogonal>>();
89 };
90 }

References postEventKeyPress.

◆ 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 }
std::string demangleSymbol()

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

Here is the call 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: