33 #include <type_traits>
38 template <
class StateType>
76 unsigned int getId()
const;
127 typename std::enable_if_t < !(std::is_base_of_v<VariantDataClass, T> || std::is_base_of_v<VariantContainerBase, T>),
T >
142 template <
class derivedState>
182 StateIceBasePtr destinationState,
183 ParameterMappingIceBasePtr mappingToNextStatesInput =
nullptr,
184 ParameterMappingIceBasePtr mappingToParentStatesLocal =
nullptr,
185 ParameterMappingIceBasePtr mappingToParentStatesOutput =
nullptr);
196 template <
class EventType>
197 TransitionIceBase&
addTransition(StateIceBasePtr sourceState,
198 StateIceBasePtr destinationState,
199 ParameterMappingIceBasePtr mappingToNextStatesInput =
nullptr,
200 ParameterMappingIceBasePtr mappingToParentStatesLocal =
nullptr,
201 ParameterMappingIceBasePtr mappingToParentStatesOutput =
nullptr);
208 template <
class EventType>
210 StateIceBasePtr destinationState,
211 ParameterMappingIceBasePtr mappingToNextStatesInput =
nullptr,
212 ParameterMappingIceBasePtr mappingToParentStatesLocal =
nullptr,
213 ParameterMappingIceBasePtr mappingToParentStatesOutput =
nullptr);
225 bool addToInput(
const std::string& key,
const ContainerType& type,
bool optional, VariantContainerBasePtr defaultValue = VariantContainerBasePtr());
252 bool addToLocal(
const std::string& key,
const ContainerType& type, VariantContainerBasePtr defaultValue = VariantContainerBasePtr());
270 bool addToOutput(
const std::string& key,
const ContainerType& type,
bool optional);
310 getInput(
const std::string& key)
const;
324 typename std::enable_if_t < !(std::is_base_of_v<VariantDataClass, T> || std::is_base_of_v<VariantContainerBase, T>),
T >
325 getInput(
const std::string& key)
const;
358 getLocal(
const std::string& key)
const;
370 typename std::enable_if_t < !(std::is_base_of_v<VariantDataClass, T> || std::is_base_of_v<VariantContainerBase, T>),
T >
371 getLocal(
const std::string& key)
const;
406 void setInput(std::string
const& key,
const VariantContainerBase& valueList);
431 void setLocal(std::string
const& key,
const VariantContainerBase& valueList);
454 void setOutput(std::string
const& key,
const VariantContainerBase& valueList);
508 StatePtr operator [](std::string
const& stateName);
510 template <
class EventType,
class StateType>
friend class FinalStateBase;
517 std::unique_ptr<Impl> simpl;
525 template <>
StatePtr State::addState<State>(std::string
const& stateName);
527 template <
class derivedState>
531 static_assert(std::is_same_v<typename derivedState::Type, derivedState>,
532 "The template parameter 'derivedState' must be derived from StateTemplate<derivedState> or the class 'State' itself! It must not inherit from a class that inherits from StateTemplate!");
546 template <
class EventType>
548 StateIceBasePtr destinationState,
549 ParameterMappingIceBasePtr mappingToNextStatesInput,
550 ParameterMappingIceBasePtr mappingToParentStatesLocal,
551 ParameterMappingIceBasePtr mappingToParentStatesOutput)
553 return addTransition(createEvent<EventType>(), sourceState, destinationState, mappingToNextStatesInput, mappingToParentStatesLocal, mappingToParentStatesOutput);
557 template <
class EventType>
559 StateIceBasePtr destinationState,
560 ParameterMappingIceBasePtr mappingToNextStatesInput,
561 ParameterMappingIceBasePtr mappingToParentStatesLocal,
562 ParameterMappingIceBasePtr mappingToParentStatesOutput)
567 assert(destinationState._ptr);
569 t.destinationState = destinationState;
571 if (mappingToNextStatesInput)
573 t.mappingToNextStatesInput = PMPtr::dynamicCast(mappingToNextStatesInput)->clone();
576 if (mappingToParentStatesLocal)
578 t.mappingToParentStatesLocal = PMPtr::dynamicCast(mappingToParentStatesLocal)->clone();
581 if (mappingToParentStatesOutput)
583 t.mappingToParentStatesOutput = PMPtr::dynamicCast(mappingToParentStatesOutput)->clone();
590 +
"' from any state to '" + destinationState->stateName +
"' into state '" +
getStateName() +
"'! There already exists a transition to that state on that event.");
592 transitions.push_back(t);
593 return *transitions.rbegin();
601 VariantContainerBasePtr varContainer;
603 if (varContainer && !SingleVariantPtr::dynamicCast(varContainer))
617 typename std::enable_if_t < !(std::is_base_of_v<VariantDataClass, T> || std::is_base_of_v<VariantContainerBase, T>),
T >
620 __checkPhaseMin(eDefined, __PRETTY_FUNCTION__);
622 getParameter(inputParameters, key, var);
623 return var->get<
T>();
632 VariantContainerBasePtr varContainer;
634 if (varContainer && !SingleVariantPtr::dynamicCast(varContainer))
648 typename std::enable_if_t < !(std::is_base_of_v<VariantDataClass, T> || std::is_base_of_v<VariantContainerBase, T>),
T >
651 __checkPhaseMin(eDefined, __PRETTY_FUNCTION__);
653 getParameter(localParameters, key, var);
654 return var->get<
T>();
663 VariantContainerBasePtr varContainer;
665 if (varContainer && !SingleVariantPtr::dynamicCast(varContainer))
679 typename std::enable_if_t < !(std::is_base_of_v<VariantDataClass, T> || std::is_base_of_v<VariantContainerBase, T>),
T >
682 __checkPhaseMin(eDefined, __PRETTY_FUNCTION__);
684 getParameter(outputParameters, key, var);
685 return var->get<
T>();