|
| SmaccState ()=delete |
|
| SmaccState (my_context ctx) |
|
virtual | ~SmaccState () |
|
const smacc::introspection::SmaccStateInfo * | getStateInfo () |
|
std::string | getFullName () |
|
std::string | getShortName () |
|
virtual ISmaccState * | getParentState () |
|
void | exit () |
|
void | runtimeConfigure () |
|
void | onEntry () |
|
void | onExit () |
|
template<typename T > |
bool | getGlobalSMData (std::string name, T &ret) |
|
template<typename T > |
void | setGlobalSMData (std::string name, T value) |
|
template<typename SmaccComponentType > |
void | requiresComponent (SmaccComponentType *&storage) |
|
virtual ISmaccStateMachine & | getStateMachine () |
|
void | checkWhileLoopConditionAndThrowEvent (bool(MostDerived::*conditionFn)()) |
|
void | throwSequenceFinishedEvent () |
|
virtual ISmaccStateMachine & | getStateMachine ()=0 |
|
ISmaccState * | getParentState () |
|
ros::NodeHandle & | getROSNode () |
|
virtual std::string | getClassName () |
|
template<typename TOrthogonal , typename TBehavior , typename... Args> |
std::shared_ptr< TBehavior > | configure (Args &&... args) |
|
template<typename SmaccComponentType > |
void | requiresComponent (SmaccComponentType *&storage) |
|
template<typename SmaccClientType > |
void | requiresClient (SmaccClientType *&storage) |
|
template<typename T > |
bool | getGlobalSMData (std::string name, T &ret) |
|
template<typename T > |
void | setGlobalSMData (std::string name, T value) |
|
template<typename TStateReactor , typename TTriggerEvent , typename TEventList , typename... TEvArgs> |
std::shared_ptr< TStateReactor > | createStateReactor (TEvArgs... args) |
|
template<typename TStateReactor , typename... TEvArgs> |
std::shared_ptr< TStateReactor > | createStateReactor (TEvArgs... args) |
|
template<typename TEventGenerator , typename... TEvArgs> |
std::shared_ptr< TEventGenerator > | createEventGenerator (TEvArgs... args) |
|
template<typename EventType > |
void | postEvent (const EventType &ev) |
|
template<typename EventType > |
void | postEvent () |
|
template<typename TransitionType > |
void | notifyTransition () |
|
void | notifyTransitionFromTransitionTypeInfo (std::shared_ptr< smacc::introspection::TypeInfo > &transitionTypeInfo) |
|
std::vector< std::shared_ptr< StateReactor > > & | getStateReactors () |
|
std::vector< std::shared_ptr< SmaccEventGenerator > > & | getEventGenerators () |
|
template<typename T > |
bool | getParam (std::string param_name, T ¶m_storage) |
|
template<typename T > |
void | setParam (std::string param_name, T param_val) |
|
template<typename T > |
bool | param (std::string param_name, T ¶m_val, const T &default_val) const |
|
template<typename TOrthogonal > |
TOrthogonal * | getOrthogonal () |
|
template<typename TEventGenerator > |
TEventGenerator * | getEventGenerator () |
|
template<typename TStateReactor > |
TStateReactor * | getStateReactor () |
|
|
template<typename TOrthogonal , typename TBehavior > |
static void | configure_orthogonal_runtime (std::function< void(TBehavior &bh, MostDerived &)> initializationFunction) |
|
template<typename TOrthogonal , typename TBehavior > |
static void | configure_orthogonal_runtime (std::function< void(TBehavior &bh)> initializationFunction) |
|
template<typename TOrthogonal , typename TBehavior , typename... Args> |
static void | configure_orthogonal (Args &&... args) |
|
template<typename TStateReactor , typename TOutputEvent , typename TInputEventList , typename... TArgs> |
static std::shared_ptr< smacc::introspection::StateReactorHandler > | static_createStateReactor (TArgs... args) |
|
template<typename TEventGenerator , typename... TUArgs> |
static std::shared_ptr< smacc::introspection::EventGeneratorHandler > | static_createEventGenerator (TUArgs... args) |
|
template<typename TStateReactor , typename... TUArgs> |
static std::shared_ptr< smacc::introspection::StateReactorHandler > | static_createStateReactor_aux (TUArgs... args) |
|
static void | initial_deep_construct (outermost_context_base_type &outermostContextBase) |
|
static void | deep_construct (const context_ptr_type &pContext, outermost_context_base_type &outermostContextBase) |
|
static inner_context_ptr_type | shallow_construct (const context_ptr_type &pContext, outermost_context_base_type &outermostContextBase) |
|
template<class MostDerived, class Context, class InnerInitial = mpl::list<>, sc::history_mode historyMode = sc::has_deep_history>
class smacc::SmaccState< MostDerived, Context, InnerInitial, historyMode >
Definition at line 22 of file smacc_state_base.h.
template<class MostDerived , class Context , class InnerInitial = mpl::list<>, sc::history_mode historyMode = sc::has_deep_history>
Definition at line 53 of file smacc_state_base.h.
54 {
55 static_assert(std::is_base_of<ISmaccState, Context>::value || std::is_base_of<ISmaccStateMachine, Context>::value, "The context class must be a SmaccState or a SmaccStateMachine");
56
57 static_assert(!std::is_same<MostDerived, Context>::value, "The context must be a different state or state machine than the current state");
58
60 this->set_context(ctx.pContext_);
61
63
64
65 auto &ps = this->template context<Context>();
68
70 ROS_DEBUG(
"[%s] Ros node handle namespace for this state: %s",
STATE_NAME,
contextNh.getNamespace().c_str());
72 {
74 ROS_INFO(
"[%s] Creating ros NodeHandle for this state: %s",
STATE_NAME, nhname.c_str());
76 }
77 }
ISmaccState * parentState_
ros::NodeHandle contextNh
const smacc::introspection::SmaccStateInfo * stateInfo_
const smacc::introspection::SmaccStateInfo * getStateInfo()
auto optionalNodeHandle(boost::intrusive_ptr< T > &obj) -> ros::NodeHandle
std::string cleanShortTypeName(const std::type_info &tinfo)
References smacc::utils::cleanShortTypeName(), smacc::ISmaccState::contextNh, smacc::SmaccState< MostDerived, Context, InnerInitial, historyMode >::finishStateThrown, smacc::SmaccState< MostDerived, Context, InnerInitial, historyMode >::getStateInfo(), smacc::introspection::optionalNodeHandle(), smacc::ISmaccState::parentState_, smacc::SmaccState< MostDerived, Context, InnerInitial, historyMode >::my_context::pContext_, STATE_NAME, and smacc::ISmaccState::stateInfo_.
template<class MostDerived , class Context , class InnerInitial = mpl::list<>, sc::history_mode historyMode = sc::has_deep_history>
template<typename TOrthogonal , typename TBehavior , typename... Args>
static void smacc::SmaccState< MostDerived, Context, InnerInitial, historyMode >::configure_orthogonal |
( |
Args &&... |
args | ) |
|
|
inlinestatic |
Definition at line 194 of file smacc_state_base.h.
195 {
196 configure_orthogonal_internal<TOrthogonal, TBehavior>(
197 [=](ISmaccState *state) {
198
199 state->configure<TOrthogonal, TBehavior>(args...);
200 });
201 }
References smacc::ISmaccState::configure().
template<class MostDerived , class Context , class InnerInitial = mpl::list<>, sc::history_mode historyMode = sc::has_deep_history>
template<typename TOrthogonal , typename TBehavior >
static void smacc::SmaccState< MostDerived, Context, InnerInitial, historyMode >::configure_orthogonal_internal |
( |
std::function< void(ISmaccState< MostDerived, Context, InnerInitial, historyMode > *state)> |
initializationFunction | ) |
|
|
inlinestaticprivate |
template<class MostDerived , class Context , class InnerInitial = mpl::list<>, sc::history_mode historyMode = sc::has_deep_history>
template<typename TOrthogonal , typename TBehavior >
static void smacc::SmaccState< MostDerived, Context, InnerInitial, historyMode >::configure_orthogonal_runtime |
( |
std::function< void(TBehavior &bh)> |
initializationFunction | ) |
|
|
inlinestatic |
Definition at line 184 of file smacc_state_base.h.
185 {
186 configure_orthogonal_internal<TOrthogonal, TBehavior>([=](ISmaccState *state) {
187
188 auto bh = state->configure<TOrthogonal, TBehavior>();
189 initializationFunction(*bh);
190 });
191 }
References smacc::ISmaccState::configure().
template<class MostDerived , class Context , class InnerInitial = mpl::list<>, sc::history_mode historyMode = sc::has_deep_history>
template<typename TOrthogonal , typename TBehavior >
static void smacc::SmaccState< MostDerived, Context, InnerInitial, historyMode >::configure_orthogonal_runtime |
( |
std::function< void(TBehavior &bh, MostDerived &)> |
initializationFunction | ) |
|
|
inlinestatic |
Definition at line 174 of file smacc_state_base.h.
175 {
176 configure_orthogonal_internal<TOrthogonal, TBehavior>([=](ISmaccState *state) {
177
178 auto bh = state->configure<TOrthogonal, TBehavior>();
179 initializationFunction(*bh, *(static_cast<MostDerived *>(state)));
180 });
181 }
References smacc::ISmaccState::configure().
template<class MostDerived , class Context , class InnerInitial = mpl::list<>, sc::history_mode historyMode = sc::has_deep_history>
void smacc::SmaccState< MostDerived, Context, InnerInitial, historyMode >::entryStateInternal |
( |
| ) |
|
|
inlineprivate |
Definition at line 393 of file smacc_state_base.h.
394 {
396
397
399
400 ROS_DEBUG(
"[%s] nodehandle namespace: %s",
STATE_NAME,
nh.getNamespace().c_str());
401
403
404
405 {
406 ROS_INFO(
"[%s] -- STATIC STATE DESCRIPTION --",
STATE_NAME);
407
409 {
411 for (auto &bhinfo : stateReactorsVector.second)
412 {
414 }
415 }
416
417 const std::type_info *tindex = &(typeid(MostDerived));
421
423 {
425 ortho.second->initState(this);
426 }
427
428 for (auto &bhinfo : staticDefinedBehaviors)
429 {
430 ROS_INFO(
"[%s] Creating static client behavior: %s",
STATE_NAME,
demangleSymbol(bhinfo.behaviorType->name()).c_str());
431 bhinfo.factoryFunction(this);
432 }
433
434 for (auto &sr : staticDefinedStateReactors)
435 {
436 ROS_INFO(
"[%s] Creating static state reactor: %s",
STATE_NAME,
demangleSymbol(sr->stateReactorType->name()).c_str());
437 sr->factoryFunction(this);
438 }
439
440 for (auto &eg : staticDefinedEventGenerators)
441 {
442 ROS_INFO(
"[%s] Creating static event generator: %s",
STATE_NAME,
demangleSymbol(eg->eventGeneratorType->name()).c_str());
443 eg->factoryFunction(this);
444 }
445
446 ROS_INFO(
"[%s] ---- END STATIC DESCRIPTION",
STATE_NAME);
447 }
448
449 ROS_INFO(
"[%s] State runtime configuration",
STATE_NAME);
450
451 auto *derivedthis = static_cast<MostDerived *>(this);
452
453
455
456
458
460
462
463
464 static_cast<MostDerived *
>(
this)->
onEntry();
465
466
468 }
void notifyOnRuntimeConfigurationFinished(StateType *state)
void notifyOnRuntimeConfigured(StateType *state)
const std::map< std::string, std::shared_ptr< smacc::ISmaccOrthogonal > > & getOrthogonals() const
void notifyOnStateEntryEnd(StateType *state)
void notifyOnStateEntryStart(StateType *state)
void setParam(std::string param_name, T param_val)
virtual ISmaccStateMachine & getStateMachine()
static std::map< const std::type_info *, std::vector< std::shared_ptr< SmaccStateReactorInfo > > > stateReactorsInfo
static std::map< const std::type_info *, std::vector< std::shared_ptr< SmaccEventGeneratorInfo > > > eventGeneratorsInfo
References smacc::utils::cleanShortTypeName(), smacc::ISmaccState::contextNh, smacc::introspection::demangleSymbol(), smacc::introspection::SmaccStateInfo::eventGeneratorsInfo, smacc::ISmaccStateMachine::getOrthogonals(), smacc::SmaccState< MostDerived, Context, InnerInitial, historyMode >::getStateMachine(), smacc::ISmaccState::nh, smacc::ISmaccStateMachine::notifyOnRuntimeConfigurationFinished(), smacc::ISmaccStateMachine::notifyOnRuntimeConfigured(), smacc::ISmaccStateMachine::notifyOnStateEntryEnd(), smacc::ISmaccStateMachine::notifyOnStateEntryStart(), smacc::SmaccState< MostDerived, Context, InnerInitial, historyMode >::onEntry(), smacc::SmaccState< MostDerived, Context, InnerInitial, historyMode >::runtimeConfigure(), smacc::ISmaccState::setParam(), STATE_NAME, smacc::introspection::SmaccStateInfo::stateReactorsInfo, and smacc::introspection::SmaccStateInfo::staticBehaviorInfo.
template<class MostDerived , class Context , class InnerInitial = mpl::list<>, sc::history_mode historyMode = sc::has_deep_history>
template<typename TEventGenerator , typename... TUArgs>
Definition at line 256 of file smacc_state_base.h.
257 {
258 auto egh = std::make_shared<smacc::introspection::EventGeneratorHandler>();
259 auto eginfo = std::make_shared<SmaccEventGeneratorInfo>();
260 eginfo->eventGeneratorType = &typeid(TEventGenerator);
261 eginfo->egh = egh;
262 egh->egInfo_ = eginfo;
263
264 const std::type_info *tindex = &(typeid(MostDerived));
265
268
269 eginfo->factoryFunction = [&, egh, args...](ISmaccState *state) {
270 auto eg = state->createEventGenerator<TEventGenerator>(args...);
271 egh->configureEventGenerator(eg);
272 eg->initialize(state);
273 eg->template onStateAllocation<MostDerived, TEventGenerator>();
274 return eg;
275 };
276
278 return egh;
279 }
References smacc::introspection::SmaccStateInfo::eventGeneratorsInfo.
template<class MostDerived , class Context , class InnerInitial = mpl::list<>, sc::history_mode historyMode = sc::has_deep_history>
template<typename TStateReactor , typename TOutputEvent , typename TInputEventList , typename... TArgs>
Definition at line 229 of file smacc_state_base.h.
230 {
231 auto srh = std::make_shared<smacc::introspection::StateReactorHandler>();
232 auto srinfo = std::make_shared<SmaccStateReactorInfo>();
233
234 srinfo->stateReactorType = &typeid(TStateReactor);
235 srinfo->srh = srh;
236 srh->srInfo_ = srinfo;
237
238 const std::type_info *tindex = &(typeid(MostDerived));
239
242
243 srinfo->factoryFunction = [&, srh, args...](ISmaccState *state) {
244 auto sr = state->createStateReactor<TStateReactor, TOutputEvent, TInputEventList, TArgs...>(args...);
245 srh->configureStateReactor(sr);
246 sr->initialize(state);
247 return sr;
248 };
249
251
252 return srh;
253 }
References smacc::introspection::SmaccStateInfo::stateReactorsInfo.
template<class MostDerived , class Context , class InnerInitial = mpl::list<>, sc::history_mode historyMode = sc::has_deep_history>
template<typename TStateReactor , typename... TUArgs>
Definition at line 282 of file smacc_state_base.h.
283 {
284 auto srh = std::make_shared<smacc::introspection::StateReactorHandler>();
285 auto srinfo = std::make_shared<SmaccStateReactorInfo>();
286
287 srinfo->stateReactorType = &typeid(TStateReactor);
288 srinfo->srh = srh;
289 srh->srInfo_ = srinfo;
290
291 const std::type_info *tindex = &(typeid(MostDerived));
292
295
296 srinfo->factoryFunction = [&, srh, args...](ISmaccState *state) {
297 auto sr = state->createStateReactor<TStateReactor>(args...);
298 srh->configureStateReactor(sr);
299 sr->initialize(state);
300 return sr;
301 };
302
304
305 return srh;
306 }
References smacc::introspection::SmaccStateInfo::stateReactorsInfo.