27#include <ArmarXCore/interface/statechart/RemoteStateOffererIce.h>
44 std::string
joinStrings(std::vector<std::string>
const& input, std::string
const& seperator);
62 CreateRemoteStateInstanceOutput
64 Ice::Current
const& context)
override;
67 const RemoteStateIceBasePrx& remoteStatePrx,
68 const std::string& parentStateItentifierStr,
69 const std::string& instanceName,
70 const Ice::Current& context = Ice::emptyCurrent)
override;
73 const std::string& parentId,
74 const Ice::Current& context = Ice::emptyCurrent)
override;
77 const StringVariantContainerBaseMap& properties,
78 const Ice::Current& context = Ice::emptyCurrent)
override;
81 const ::Ice::Current& context = Ice::emptyCurrent)
override;
84 const EventBasePtr& evt,
85 const ::Ice::Current& context = Ice::emptyCurrent)
override;
88 const ::Ice::Current& context = Ice::emptyCurrent)
override;
92 const EventBasePtr& evt,
93 const ::Ice::Current& context = Ice::emptyCurrent)
override;
98 const ::Ice::Current& context = Ice::emptyCurrent)
override;
101 const ::Ice::Current& context = Ice::emptyCurrent)
override;
104 const ::Ice::Current& context = Ice::emptyCurrent)
override;
107 const ::Ice::Current& context = Ice::emptyCurrent)
override;
110 const ::Ice::Current& context = Ice::emptyCurrent)
override;
113 const ::Ice::Current& context = Ice::emptyCurrent)
override;
116 const ::Ice::Current& context = Ice::emptyCurrent)
const override;
118 const ::Ice::Current& context = Ice::emptyCurrent)
override;
124 const ::Ice::Current& context = Ice::emptyCurrent)
override;
126 const Ice::Current& = Ice::emptyCurrent)
override;
129 const Ice::Current& = Ice::emptyCurrent)
override;
131 const Ice::Current& = Ice::emptyCurrent)
override;
133 void removeInstance(
int stateId,
const Ice::Current& = Ice::emptyCurrent)
override;
135 const EventBasePtr& evt,
136 const Ice::Current& = Ice::emptyCurrent)
override;
138 const EventBasePtr& evt,
139 const Ice::Current& = Ice::emptyCurrent)
override;
143 std::string proxyName,
144 std::string instanceName)
override;
202 template <
typename ContextType = State
chartContext>
207 static_assert(std::is_base_of_v<StatechartContext, ContextType>,
208 "The template parameter of RemoteStateOfferer, must be a class that derives "
209 "from StatechartContext or StatechartContext itself");
227 template <
typename ContextType>
232 ContextType::setToplevelState(
this);
249 for (AbstractStateIceBasePtr state : subStateList)
261 ContextType::setAutoEnterToplevelState(
false);
264 template <
typename ContextType>
271 template <
typename ContextType>
278 template <
typename ContextType>
282 if (!ContextType::getObjectScheduler()->waitForObjectStateMinimum(eManagedIceObjectStarted,
285 throw LocalException()
286 <<
"Cannot create a remote state instance because the RemoteStateOfferer '"
287 << ContextType::getName() <<
"' is still waiting for dependencies: "
288 <<
joinStrings(ContextType::getUnresolvedDependencies(),
", ");
Property< PropertyType > getProperty(const std::string &name)
Profiler::ProfilerPtr getProfiler() const
getProfiler returns an instance of armarx::Profiler
void terminate()
Initiates termination of this IceManagedObject.
void setStatePhase(StatePhase newPhase)
StatePhase
enum that specifies the phase in which the state is currently in used to control the usage of state-f...
StatePhase getStatePhase() const
Profiler::ProfilerPtr stateReporter
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< RemoteState > RemoteStatePtr
std::string joinStrings(std::vector< std::string > const &input, std::string const &seperator)
IceInternal::Handle< RemoteStateWrapper > RemoteStateWrapperPtr
IceInternal::Handle< StateBase > StateBasePtr
IceInternal::Handle< StateController > StateControllerPtr
A struct that holds meta data for a remoteaccessable state instances.
RemoteStateWrapperPtr remoteWrappedState
Pointer to a Pseudo parent state, that contains the real state instance.
int id
Local id of this RemoteStateOfferer, that identifies the state instance in the stateInstanceList.
std::string callerIceName
Not used yet.
RemoteStateIceBasePrx callerStatePrx
Proxy to the state, that called this state.
CreateRemoteStateInstanceOutput createRemoteStateInstanceNew(CreateRemoteStateInstanceInput const &input, Ice::Current const &context) override
bool isRemoteStateFinished(int stateId, const ::Ice::Current &context=Ice::emptyCurrent) override
RemoteStateData getInstance(int stateId)
int createRemoteStateInstance(const std::string &stateName, const RemoteStateIceBasePrx &remoteStatePrx, const std::string &parentStateItentifierStr, const std::string &instanceName, const Ice::Current &context=Ice::emptyCurrent) override
StateIceBasePtr getStatechartInstanceByGlobalIdStr(const std::string &globalStateIdStr, const Ice::Current &=Ice::emptyCurrent) override
void removeInstance(int stateId, const Ice::Current &=Ice::emptyCurrent) override
void notifyEventBufferedDueToUnbreakableStateRemote(int stateId, bool eventBuffered, const ::Ice::Current &context=Ice::emptyCurrent) override
virtual void onConnectRemoteStateOfferer()
Virtual function, in which the user can fetch some proxies.
StateIceBasePtr refetchRemoteSubstates(int stateId, const ::Ice::Current &context=Ice::emptyCurrent) override
bool hasSubstatesRemote(const std::string &stateName, const ::Ice::Current &context=Ice::emptyCurrent) const override
void initState(State &state)
HiddenTimedMutex stateInstanceListMutex
void issueEventWithGlobalIdStr(const std::string &globalStateIdStr, const EventBasePtr &evt, const Ice::Current &=Ice::emptyCurrent) override
void exitRemoteState(int stateId, const ::Ice::Current &context=Ice::emptyCurrent) override
Ice::StringSeq getAvailableStates(const ::Ice::Current &context=Ice::emptyCurrent) override
StateParameterMap getRemoteInputParametersById(int stateId, const ::Ice::Current &context=Ice::emptyCurrent) override
void updateGlobalStateIdRecursive(int stateId, const std::string &parentId, const Ice::Current &context=Ice::emptyCurrent) override
RemoteStatePtr addDynamicRemoteState(std::string instanceName) override
Overridden so that the user cannot use it.
void issueEvent(int receivingStateId, const EventBasePtr &evt, const Ice::Current &=Ice::emptyCurrent) override
std::map< int, RemoteStateData > stateInstanceList
Holds the instances that where requested from remotely located states.
void onExitStatechartImpl()
StateIdNameMap getAvailableStateInstances(const ::Ice::Current &context=Ice::emptyCurrent) override
virtual void waitUntilComponentStarted()=0
void onConnectStatechartImpl()
bool breakRemoteState(int stateId, const EventBasePtr &evt, const ::Ice::Current &context=Ice::emptyCurrent) override
virtual void onExitRemoteStateOfferer()
Virtual function, in which the user can implement some clean up.
virtual std::string getStateOffererName() const =0
Implement this function to specify the RemoteStateOfferer prefix.
StateBasePtr getGlobalInstancePtr(int globalId) const
virtual void onInitRemoteStateOfferer()=0
Pure virtual function, in which the states must be added, that should be remote-accessable.
RemoteStatePtr addRemoteState(std::string stateName, std::string proxyName, std::string instanceName) override
Overridden so that the user cannot use it.
std::map< int, StateBasePtr > getChildStatesByName(int parentId, std::string stateName)
void callRemoteState(int stateId, const StringVariantContainerBaseMap &properties, const Ice::Current &context=Ice::emptyCurrent) override
bool breakActiveSubstateRemotely(int stateId, const EventBasePtr &evt, const ::Ice::Current &context=Ice::emptyCurrent) override
StateParameterMap getRemoteInputParameters(const std::string &stateName, const ::Ice::Current &context=Ice::emptyCurrent) override
std::string componentName
StateIceBasePtr getStatechartInstanceByGlobalIdStrRecursive(const std::string &globalStateIdStr, StateBasePtr state, int &stateCounter)
StateParameterMap getRemoteOutputParameters(const std::string &stateName, const ::Ice::Current &context=Ice::emptyCurrent) override
StateIceBasePtr getStatechartInstance(int stateId, const Ice::Current &=Ice::emptyCurrent) override
bool isHostOfStateByGlobalIdStr(const std::string &globalStateIdStr, const Ice::Current &=Ice::emptyCurrent) override
void run() override
Virtual function, that can be reimplemented to calculate complex operations.
StateIceBasePtr getStatechart(const std::string &stateName, const ::Ice::Current &context=Ice::emptyCurrent) override
bool hasActiveSubstateRemote(int stateId, const ::Ice::Current &context=Ice::emptyCurrent) override
virtual StateBasePtr getStatePtr(const std::string &stateName) const
StateParameterMap getRemoteOutputParametersById(int stateId, const ::Ice::Current &context=Ice::emptyCurrent) override
Class that holds states, which offer functionality for other states over Ice.
void onInitStatechart() override
onInitStatechart this method is called when the statechart is started.
void onExitStatechart() override
onExitStatechart can be implemented by subclasses
void waitUntilComponentStarted() override
void onConnectStatechart() override
onConnectStatechart is called before armarx::StatechartContext::startStatechart() and after armarx::S...
std::string getDefaultName() const override
Retrieve default name of component.