RTC Toolkit  1.0.0
malEventInjector.hpp
Go to the documentation of this file.
1 
12 #ifndef RTCTK_COMPONENTFRAMEWORK_MALEVENTINJECTOR_HPP
13 #define RTCTK_COMPONENTFRAMEWORK_MALEVENTINJECTOR_HPP
14 
16 
17 #include <mal/utility/future.hpp>
18 
19 namespace rtctk::componentFramework {
20 
21 template <typename EventType>
22 elt::mal::future<std::string> InjectReqRepEvent(StateMachineEngine& engine) {
23  auto ev = std::make_shared<EventType>();
24  auto f = ev->GetPayload().GetReplyFuture();
25  engine.PostEvent(ev);
26  return f;
27 }
28 
29 template <typename EventType, typename PayloadType>
30 elt::mal::future<std::string> InjectReqRepEvent(StateMachineEngine& engine, PayloadType& payload) {
31  auto ev = std::make_shared<EventType>(payload);
32  auto f = ev->GetPayload().GetReplyFuture();
33  engine.PostEvent(ev);
34  return f;
35 }
36 
37 } // namespace rtctk::componentFramework
38 
39 #endif
stateMachineEngine.hpp
Wrapper around the SCXML State Machine Engine.
rtctk::componentFramework
Definition: commandReplier.cpp:20
rtctk::componentFramework::StateMachineEngine
Definition: stateMachineEngine.hpp:31
rtctk::componentFramework::InjectReqRepEvent
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition: malEventInjector.hpp:22
rtctk::componentFramework::StateMachineEngine::PostEvent
void PostEvent(rad::SharedEvent s)
Injects a new event into the state machine engine.
Definition: stateMachineEngine.cpp:121