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

References postEventKeyPress.

◆ postKeyEvent()

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

Definition at line 94 of file cb_default_keyboard_behavior.hpp.

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

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: