Go to the documentation of this file.
28 #include <ArmarXCore/interface/statechart/StatechartIce.h>
42 #define EVENTTOALL "toAll"
43 #define STATEINFO ARMARX_INFO << armarx::LogTag("State: "+ stateName)
62 virtual public StateIceBase,
73 template <
typename ContextType>
76 ContextType*
c =
dynamic_cast<ContextType*
>(
getContext());
114 LocalException(
"The state '" + state->stateName +
"' does not expect the event '" + event->eventName +
"' (EventReceiverState: '" + event->eventReceiverName +
"')")
119 std::string
name()
const override
121 return "eUnexpectedEvent";
223 bool addParameterContainer(
StateParameterMap& paramMap,
const std::string& key,
const ContainerType& containerType,
bool optional, VariantContainerBasePtr defaultValue = VariantContainerBasePtr())
const;
259 std::unique_ptr<Impl>
impl;
284 void __checkPhase(
const std::vector<StatePhase>& allowedTypes,
const char* functionName)
const;
virtual StateParameterMap & getOutputParameters()
void getParameterContainer(const StateParameterMap ¶mMap, const std::string &key, VariantContainerBasePtr &valueContainer) const
std::string getGlobalHierarchyString() const
The Variant class is described here: Variants.
ContextType * getContext() const
virtual void defineParameters()
Virtual function, in which input/local/output parameters can be specified.
virtual void deepCopy(const StateBase &sourceState, bool reset=true)
Function to copy the states with all it substates and transitions.
void setStatePhase(StatePhase newPhase)
StringVariantContainerBaseMap __getSetInputAndLocalParameters() const
Combines both maps to one map and returns a new map of only the set parameters.
virtual bool waitForInitialization(int timeoutMS=-1) const
virtual void onExit()
Virtual function, in which the behaviour of state is defined, when it is exited. Can be overridden,...
std::string name() const override
virtual void onBreak()
Virtual function, in which the behaviour of state is defined, when it is abnormally exited....
StateBase & operator=(const StateBase &source)
StatePhase
enum that specifies the phase in which the state is currently in used to control the usage of state-f...
virtual void defineState()
Virtual function, in which this state can be configured.
void __checkPhaseMin(StatePhase allowedType, const char *functionName) const
virtual StateParameterMap getInputParameters()=0
Not const because RemoteState implementation gets the current parameters via Ice and sets them.
virtual bool isInitialized() const
Returns the status of this state. Only if a state is initialized, it can be used.
void setInitialized(bool enable)
std::string getStateName() const
getStateName
static std::vector< StateBasePtr > GetActiveStateLeafs(StateBasePtr toplevelState)
Ice::Int getLocalUniqueId() const
virtual StateBasePtr createEmptyCopy() const =0
void __updateGlobalStateId()
virtual void __updateGlobalStateIdRecursive()
void setParameterContainer(StateParameterMap ¶mMap, const std::string &key, const VariantContainerBasePtr &valueContainer)
IceInternal::Handle< Variant > VariantPtr
void setStateClassName(std::string className)
setStateClassName() sets the string, that contains a stringrepresentation of this class....
std::shared_ptr< Value > value()
void reset()
Function to reset the state: clear name, clear substatesList, clear transition etc.
void __copyDefaultValuesToInput()
QMap< QString, StateParameterPtr > StateParameterMap
void inheritInputParameters()
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
bool addParameter(StateParameterMap ¶mMap, const std::string &key, VariantTypeId type, bool optional, VariantPtr defaultValue=VariantPtr()) const
virtual void run()
Virtual function, that can be reimplemented to calculate complex operations.
void __throwUnknownParameter(const StateParameterMap ¶mMap, const std::string &key) const
virtual void defineSubstates()
Virtual function, in which substates, transition and mappings can be added.
std::string getLocalHierarchyString() const
Function to get a string that contains als parent states and this state. (e.g. "Robot->Functional->Id...
Base Class for all Logging classes.
virtual StateBasePtr clone() const =0
Pure virtual function to clone of the derived class type.
void setParameter(StateParameterMap ¶mMap, const std::string &key, const Variant &variant)
void setContext(StatechartContextInterface *context)
virtual void refetchSubstates()
This functions updates the substates.
virtual void onEnter()
Virtual function, in which the behaviour of state is defined, when it is entered. Can be overridden,...
void __setParentState(StateBase *parentState)
bool addParameterContainer(StateParameterMap ¶mMap, const std::string &key, const ContainerType &containerType, bool optional, VariantContainerBasePtr defaultValue=VariantContainerBasePtr()) const
virtual bool __hasActiveSubstate()
Virtual function to indicate wheter a state has an active substate or not. To be overridden by Remote...
const std::string & getStateClassName() const
bool isParameterSet(const StateParameterMap ¶mMap, const std::string &key) const
StatePhase getStatePhase() const
~eUnexpectedEvent() noexcept override
EventPtr getTriggeredEndstateEvent() const
This function returns the event that was triggered by entering an endstate.
virtual bool __hasSubstates()
Virtual function to indicate wheter a state has substates or not. To be overridden by RemoteState to ...
void __checkPhase(StatePhase allowedType, const char *functionName) const
Helper function for checking if a function was called in valid position of the statechart.
std::unique_ptr< Impl > impl
StateBasePtr findSubstateByName(const std::string &substateName)
Utility function to find a substate of this state by the name.
This file offers overloads of toIce() and fromIce() functions for STL container types.
eUnexpectedEvent(const EventPtr event, StateIceBasePtr state)
void getParameter(const StateParameterMap ¶mMap, const std::string &key, VariantPtr &value) const
bool init(StatechartContextInterface *context, StatechartManager *manager)
Function to initialize this state. Must be called in the highest level of the hierarchy - and only th...