29#define STATE_NAME (demangleSymbol(typeid(MostDerived).name()).c_str()) 
   37  class MostDerived, 
class Context, 
class InnerInitial = mpl::list<>,
 
   38  sc::history_mode historyMode = sc::has_deep_history>
 
   68      std::is_base_of<ISmaccState, Context>::value ||
 
   69        std::is_base_of<ISmaccStateMachine, Context>::value,
 
   70      "The context class must be a SmaccState or a SmaccStateMachine");
 
   72      !std::is_same<MostDerived, Context>::value,
 
   73      "The context must be a different state or state machine " 
   74      "than the current state");
 
   76    logger_.reset(
new rclcpp::Logger(
 
   87    auto & ps = this->
template context<Context>();
 
   98    auto key = 
typeid(MostDerived).name();
 
   99    if (smInfo.states.count(key))
 
  101      return smInfo.
states[key].get();
 
  125    auto * derivedThis = 
static_cast<MostDerived *
>(
this);
 
  128      std::lock_guard<std::recursive_mutex> lock(this->
getStateMachine().getMutex());
 
  157  template <
typename T>
 
  160    return base_type::outermost_context().getGlobalSMData(name, ret);
 
  164  template <
typename T>
 
  167    base_type::outermost_context().setGlobalSMData(name, value);
 
  170  template <
typename SmaccComponentType>
 
  173    base_type::outermost_context().requiresComponent(storage);
 
  178  template <
typename TOrthogonal, 
typename TBehavior>
 
  180    std::function<
void(TBehavior & bh, MostDerived &)> initializationFunction)
 
  182    configure_orthogonal_internal<TOrthogonal, TBehavior>(
 
  186        auto bh = state->
configure<TOrthogonal, TBehavior>();
 
  187        initializationFunction(*bh, *(
static_cast<MostDerived *
>(state)));
 
  191  template <
typename TOrthogonal, 
typename TBehavior>
 
  193    std::function<
void(TBehavior & bh)> initializationFunction)
 
  195    configure_orthogonal_internal<TOrthogonal, TBehavior>(
 
  199        auto bh = state->
configure<TOrthogonal, TBehavior>();
 
  200        initializationFunction(*bh);
 
  204  template <
typename TOrthogonal, 
typename TBehavior, 
typename... Args>
 
  207    configure_orthogonal_internal<TOrthogonal, TBehavior>(
 
  211        state->
configure<TOrthogonal, TBehavior>(args...);
 
  216    typename TStateReactor, 
typename TOutputEvent, 
typename TInputEventList, 
typename... TArgs>
 
  220    auto srh = std::make_shared<smacc2::introspection::StateReactorHandler>(
globalNh_);
 
  221    auto srinfo = std::make_shared<SmaccStateReactorInfo>();
 
  223    srinfo->stateReactorType = TypeInfo::getTypeInfoFromType<TStateReactor>();
 
  224    srinfo->outputEventType = TypeInfo::getTypeInfoFromType<TOutputEvent>();
 
  226    if (srinfo->outputEventType->templateParameters.size() == 2)
 
  228      srinfo->objectTagType = srinfo->outputEventType->templateParameters[1];
 
  230    else if (srinfo->outputEventType->templateParameters.size() == 1)
 
  232      srinfo->objectTagType = TypeInfo::getTypeInfoFromType<state_reactors::EmptyObjectTag>();
 
  238        "state reactor output events should have one or two parameters (SourceType, ObjectTag)");
 
  242    using boost::mpl::_1;
 
  243    using wrappedList = 
typename boost::mpl::transform<TInputEventList, _1>::type;
 
  245    boost::mpl::for_each<wrappedList>(op);
 
  248    srh->srInfo_ = srinfo;
 
  250    const std::type_info * tindex = &(
typeid(MostDerived));  
 
  254        std::vector<std::shared_ptr<SmaccStateReactorInfo>>();
 
  256    srinfo->factoryFunction = [&, srh, args...](
ISmaccState * state)
 
  259        state->createStateReactor<TStateReactor, TOutputEvent, TInputEventList, TArgs...>(args...);
 
  260      srh->configureStateReactor(sr);
 
  261      sr->initialize(state);
 
  270  template <
typename TEventGenerator, 
typename... TUArgs>
 
  274    auto egh = std::make_shared<smacc2::introspection::EventGeneratorHandler>();
 
  275    auto eginfo = std::make_shared<SmaccEventGeneratorInfo>();
 
  276    eginfo->eventGeneratorType = TypeInfo::getTypeInfoFromType<TEventGenerator>();
 
  279    egh->egInfo_ = eginfo;
 
  281    const std::type_info * tindex = &(
typeid(MostDerived));  
 
  285        std::vector<std::shared_ptr<SmaccEventGeneratorInfo>>();
 
  287    eginfo->factoryFunction = [&, egh, args...](
ISmaccState * state)
 
  289      auto eg = state->createEventGenerator<TEventGenerator>(args...);
 
  290      egh->configureEventGenerator(eg);
 
  291      eg->initialize(state);
 
  292      eg->template onStateAllocation<MostDerived, TEventGenerator>();
 
  300  template <
typename TStateReactor, 
typename... TUArgs>
 
  304    auto srh = std::make_shared<smacc2::introspection::StateReactorHandler>(
globalNh_);
 
  305    auto srinfo = std::make_shared<SmaccStateReactorInfo>();
 
  307    srinfo->stateReactorType = TypeInfo::getTypeInfoFromType<TStateReactor>();
 
  309    srh->srInfo_ = srinfo;
 
  311    const std::type_info * tindex = &(
typeid(MostDerived));  
 
  315        std::vector<std::shared_ptr<SmaccStateReactorInfo>>();
 
  317    srinfo->factoryFunction = [&, srh, args...](
ISmaccState * state)
 
  319      auto sr = state->createStateReactor<TStateReactor>(args...);
 
  320      srh->configureStateReactor(sr);
 
  321      sr->initialize(state);
 
  332    auto * thisobject = 
static_cast<MostDerived *
>(
this);
 
  333    auto condition = boost::bind(conditionFn, thisobject);
 
  334    bool conditionResult = condition();
 
  339      this->postEvent<EvLoopContinue<MostDerived>>();
 
  343      this->postEvent<EvLoopEnd<MostDerived>>();
 
  370    base_type::template deep_construct_inner<inner_initial_list>(
 
  371      pInnerContext, outermostContextBase);
 
  378    auto state = 
new MostDerived(
 
  383    state->entryStateInternal();
 
  386    outermostContextBase.add(pInnerContext);
 
  387    return pInnerContext;
 
  391  template <
typename TOrthogonal, 
typename TBehavior>
 
  393    std::function<
void(
ISmaccState * state)> initializationFunction)
 
  401    const std::type_info * tindex = &(
typeid(MostDerived));
 
  407      rclcpp::get_logger(
"static"), 
"[states walking] State " 
  409                                      << 
"client behavior count: " 
  422                       << 
"] creating ros subnode");
 
  433        for (
auto & cbinfo : clientBehavior.second)
 
  441      const std::type_info * tindex = &(
typeid(MostDerived));
 
  451        ortho.second->initState(
this);
 
  455        getLogger(), 
"finding static client behaviors. State Database: " 
  459      for (
auto & bhinfo : staticDefinedBehaviors)
 
  464        bhinfo.factoryFunction(
this);
 
  467      for (
auto & sr : staticDefinedStateReactors)
 
  471          sr->stateReactorType->getFullName().c_str());
 
  472        sr->factoryFunction(
this);
 
  475      for (
auto & eg : staticDefinedEventGenerators)
 
  479          eg->eventGeneratorType->getFullName().c_str());
 
  480        eg->factoryFunction(
this);
 
  488    auto * derivedthis = 
static_cast<MostDerived *
>(
this);
 
  502    static_cast<MostDerived *
>(
this)->
onEntry();
 
rclcpp::Node::SharedPtr getNode()
 
void notifyOnStateExitting(StateType *state)
 
void notifyOnRuntimeConfigurationFinished(StateType *state)
 
const std::map< std::string, std::shared_ptr< smacc2::ISmaccOrthogonal > > & getOrthogonals() const
 
void notifyOnStateExited(StateType *state)
 
void notifyOnStateEntryEnd(StateType *state)
 
const SmaccStateMachineInfo & getStateMachineInfo()
 
void notifyOnRuntimeConfigured(StateType *state)
 
void notifyOnStateEntryStart(StateType *state)
 
std::shared_ptr< rclcpp::Logger > logger_
 
rclcpp::Logger getLogger()
 
std::shared_ptr< TBehavior > configure(Args &&... args)
 
rclcpp::Node::SharedPtr node_
 
ISmaccState * parentState_
 
const smacc2::introspection::SmaccStateInfo * stateInfo_
 
sc::simple_state< MostDerived, Context, InnerInitial, historyMode > base_type
 
static inner_context_ptr_type shallow_construct(const context_ptr_type &pContext, outermost_context_base_type &outermostContextBase)
 
static std::shared_ptr< smacc2::introspection::StateReactorHandler > static_createStateReactor(TArgs... args)
 
base_type::context_ptr_type context_ptr_type
 
static void initial_deep_construct(outermost_context_base_type &outermostContextBase)
 
InnerInitial * smacc_inner_type
 
base_type::inner_context_ptr_type inner_context_ptr_type
 
void checkWhileLoopConditionAndThrowEvent(bool(MostDerived::*conditionFn)())
 
static void configure_orthogonal_internal(std::function< void(ISmaccState *state)> initializationFunction)
 
base_type::inner_initial_list inner_initial_list
 
static std::shared_ptr< smacc2::introspection::EventGeneratorHandler > static_createEventGenerator(TUArgs... args)
 
virtual ISmaccStateMachine & getStateMachine()
 
static std::shared_ptr< smacc2::introspection::StateReactorHandler > static_createStateReactor_aux(TUArgs... args)
 
const smacc2::introspection::SmaccStateInfo * getStateInfo()
 
bool getGlobalSMData(std::string name, T &ret)
 
std::string getFullName()
 
static void deep_construct(const context_ptr_type &pContext, outermost_context_base_type &outermostContextBase)
 
base_type::outermost_context_base_type outermost_context_base_type
 
InnerInitial LastDeepState
 
virtual ISmaccState * getParentState()
 
SmaccState(my_context ctx)
 
context_type::state_iterator state_iterator
 
std::string getName() override
 
void setGlobalSMData(std::string name, T value)
 
Context::inner_context_type context_type
 
static void configure_orthogonal_runtime(std::function< void(TBehavior &bh)> initializationFunction)
 
void throwSequenceFinishedEvent()
 
void requiresComponent(SmaccComponentType *&storage)
 
std::string getShortName()
 
static void configure_orthogonal_runtime(std::function< void(TBehavior &bh, MostDerived &)> initializationFunction)
 
static void configure_orthogonal(Args &&... args)
 
void entryStateInternal()
 
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
 
static std::map< const std::type_info *, std::vector< ClientBehaviorInfoEntry > > staticBehaviorInfo
 
std::map< std::string, std::shared_ptr< SmaccStateInfo > > states
 
rclcpp::Node::SharedPtr globalNh_
 
std::string demangleSymbol()
 
std::string cleanShortTypeName()
 
void standardOnExit(TState &st, std::true_type)
 
void TRACEPOINT(spinOnce)
 
my_context(typename base_type::context_ptr_type pContext)
 
base_type::context_ptr_type pContext_
 
const std::type_info * behaviorType
 
const std::type_info * orthogonalType
 
std::function< void(smacc2::ISmaccState *)> factoryFunction
 
smacc2_state_onRuntimeConfigure_start
 
smacc2_state_onRuntimeConfigure_end
 
smacc2_state_onEntry_start
 
smacc2_state_onExit_start