Go to the documentation of this file.
27 #include <ArmarXCore/interface/statechart/RemoteStateOffererIce.h>
40 #include <type_traits>
44 std::string
joinStrings(std::vector<std::string>
const&
input, std::string
const& seperator);
47 :
virtual RemoteStateOffererIceBase
65 CreateRemoteStateInstanceInput
const&
input,
66 Ice::Current
const& context)
override;
69 const std::string& stateName,
70 const RemoteStateIceBasePrx& remoteStatePrx,
71 const std::string& parentStateItentifierStr,
72 const std::string& instanceName,
73 const Ice::Current& context = Ice::emptyCurrent)
override;
77 const std::string& parentId,
78 const Ice::Current& context = Ice::emptyCurrent)
override;
82 const StringVariantContainerBaseMap& properties,
83 const Ice::Current& context = Ice::emptyCurrent)
override;
87 const ::Ice::Current& context = Ice::emptyCurrent)
override;
91 const EventBasePtr& evt,
92 const ::Ice::Current& context = Ice::emptyCurrent)
override;
96 const ::Ice::Current& context = Ice::emptyCurrent)
override;
100 const EventBasePtr& evt,
101 const ::Ice::Current& context = Ice::emptyCurrent)
override;
104 StateIceBasePtr
refetchRemoteSubstates(
int stateId, const ::Ice::Current& context = Ice::emptyCurrent)
override;
110 bool hasSubstatesRemote(
const std::string& stateName, const ::Ice::Current& context = Ice::emptyCurrent)
const override;
112 Ice::StringSeq
getAvailableStates(const ::Ice::Current& context = Ice::emptyCurrent)
override;
114 StateIceBasePtr
getStatechart(
const std::string& stateName, const ::Ice::Current& context = Ice::emptyCurrent)
override;
115 StateIceBasePtr
getStatechartInstance(
int stateId,
const Ice::Current& = Ice::emptyCurrent)
override;
119 void removeInstance(
int stateId,
const Ice::Current& = Ice::emptyCurrent)
override;
120 void issueEvent(
int receivingStateId,
const EventBasePtr& evt,
const Ice::Current& = Ice::emptyCurrent)
override;
121 void issueEventWithGlobalIdStr(
const std::string& globalStateIdStr,
const EventBasePtr& evt,
const Ice::Current& = Ice::emptyCurrent)
override;
181 template <
typename ContextType = State
chartContext>
184 ,
virtual ContextType
188 static_assert(std::is_base_of_v<StatechartContext, ContextType>,
189 "The template parameter of RemoteStateOfferer, must be a class that derives from StatechartContext or StatechartContext itself");
207 template <
typename ContextType>
210 stateName = getDefaultName();
211 ContextType::setToplevelState(
this);
214 setStatePhase(eSubstatesDefinitions);
219 onInitRemoteStateOfferer();
223 setStatePhase(oldPhase);
228 for (AbstractStateIceBasePtr state : subStateList)
234 int numberLogLevels = Component::getProperty<int>(
"ProfilingDepth").getValue();
240 ContextType::setAutoEnterToplevelState(
false);
243 template<
typename ContextType>
246 onConnectStatechartImpl();
249 template<
typename ContextType>
252 onExitStatechartImpl();
255 template<
typename ContextType>
258 if (!ContextType::getObjectScheduler()->waitForObjectStateMinimum(eManagedIceObjectStarted, 5000))
260 throw LocalException() <<
"Cannot create a remote state instance because the RemoteStateOfferer '"
261 << ContextType::getName()
262 <<
"' is still waiting for dependencies: "
263 <<
joinStrings(ContextType::getUnresolvedDependencies(),
", ");
int createRemoteStateInstance(const std::string &stateName, const RemoteStateIceBasePrx &remoteStatePrx, const std::string &parentStateItentifierStr, const std::string &instanceName, const Ice::Current &context=Ice::emptyCurrent) override
virtual void waitUntilComponentStarted()=0
bool breakRemoteState(int stateId, const EventBasePtr &evt, const ::Ice::Current &context=Ice::emptyCurrent) override
bool isRemoteStateFinished(int stateId, const ::Ice::Current &context=Ice::emptyCurrent) override
StateIceBasePtr refetchRemoteSubstates(int stateId, const ::Ice::Current &context=Ice::emptyCurrent) override
CreateRemoteStateInstanceOutput createRemoteStateInstanceNew(CreateRemoteStateInstanceInput const &input, Ice::Current const &context) override
StateParameterMap getRemoteOutputParametersById(int stateId, const ::Ice::Current &context=Ice::emptyCurrent) override
bool hasActiveSubstateRemote(int stateId, const ::Ice::Current &context=Ice::emptyCurrent) override
void run() override
Virtual function, that can be reimplemented to calculate complex operations.
virtual StateBasePtr getStatePtr(const std::string &stateName) const
StatePhase
enum that specifies the phase in which the state is currently in used to control the usage of state-f...
void removeInstance(int stateId, const Ice::Current &=Ice::emptyCurrent) override
int id
Local id of this RemoteStateOfferer, that identifies the state instance in the stateInstanceList.
virtual void onConnectRemoteStateOfferer()
Virtual function, in which the user can fetch some proxies.
Profiler::ProfilerPtr getProfiler() const
getProfiler returns an instance of armarx::Profiler
void onConnectStatechart() override
onConnectStatechart is called before armarx::StatechartContext::startStatechart() and after armarx::S...
void notifyEventBufferedDueToUnbreakableStateRemote(int stateId, bool eventBuffered, const ::Ice::Current &context=Ice::emptyCurrent) override
void issueEvent(int receivingStateId, const EventBasePtr &evt, const Ice::Current &=Ice::emptyCurrent) override
StateIdNameMap getAvailableStateInstances(const ::Ice::Current &context=Ice::emptyCurrent) override
void onExitStatechart() override
onExitStatechart can be implemented by subclasses
RemoteStatePtr addDynamicRemoteState(std::string instanceName) override
Overridden so that the user cannot use it.
std::map< int, StateBasePtr > getChildStatesByName(int parentId, std::string stateName)
Ice::StringSeq getAvailableStates(const ::Ice::Current &context=Ice::emptyCurrent) override
RemoteStateIceBasePrx callerStatePrx
Proxy to the state, that called this state.
Class that holds states, which offer functionality for other states over Ice.
StateParameterMap getRemoteInputParametersById(int stateId, const ::Ice::Current &context=Ice::emptyCurrent) override
void initState(State &state)
StateIceBasePtr getStatechart(const std::string &stateName, const ::Ice::Current &context=Ice::emptyCurrent) override
void onConnectStatechartImpl()
QMap< QString, StateParameterPtr > StateParameterMap
bool breakActiveSubstateRemotely(int stateId, const EventBasePtr &evt, const ::Ice::Current &context=Ice::emptyCurrent) override
ReaderT::InputType & input
RemoteStateWrapperPtr remoteWrappedState
Pointer to a Pseudo parent state, that contains the real state instance.
void terminate()
Initiates termination of this IceManagedObject.
Profiler::ProfilerPtr stateReporter
std::string componentName
bool hasSubstatesRemote(const std::string &stateName, const ::Ice::Current &context=Ice::emptyCurrent) const override
StateBasePtr getGlobalInstancePtr(int globalId) const
void updateGlobalStateIdRecursive(int stateId, const std::string &parentId, const Ice::Current &context=Ice::emptyCurrent) override
std::string callerIceName
Not used yet.
StateParameterMap getRemoteInputParameters(const std::string &stateName, const ::Ice::Current &context=Ice::emptyCurrent) override
virtual void onExitRemoteStateOfferer()
Virtual function, in which the user can implement some clean up.
std::map< int, RemoteStateData > stateInstanceList
Holds the instances that where requested from remotely located states.
void callRemoteState(int stateId, const StringVariantContainerBaseMap &properties, const Ice::Current &context=Ice::emptyCurrent) override
StateIceBasePtr getStatechartInstanceByGlobalIdStr(const std::string &globalStateIdStr, const Ice::Current &=Ice::emptyCurrent) override
StateParameterMap getRemoteOutputParameters(const std::string &stateName, const ::Ice::Current &context=Ice::emptyCurrent) override
void onExitStatechartImpl()
StateIceBasePtr getStatechartInstanceByGlobalIdStrRecursive(const std::string &globalStateIdStr, StateBasePtr state, int &stateCounter)
void issueEventWithGlobalIdStr(const std::string &globalStateIdStr, const EventBasePtr &evt, const Ice::Current &=Ice::emptyCurrent) override
virtual void onInitRemoteStateOfferer()=0
Pure virtual function, in which the states must be added, that should be remote-accessable.
bool isHostOfStateByGlobalIdStr(const std::string &globalStateIdStr, const Ice::Current &=Ice::emptyCurrent) override
void onInitStatechart() override
onInitStatechart this method is called when the statechart is started.
RemoteStatePtr addRemoteState(std::string stateName, std::string proxyName, std::string instanceName) override
Overridden so that the user cannot use it.
std::string getDefaultName() const override
Retrieve default name of component.
void waitUntilComponentStarted() override
virtual std::string getStateOffererName() const =0
Implement this function to specify the RemoteStateOfferer prefix.
RemoteStateData getInstance(int stateId)
HiddenTimedMutex stateInstanceListMutex
StateIceBasePtr getStatechartInstance(int stateId, const Ice::Current &=Ice::emptyCurrent) override
This file offers overloads of toIce() and fromIce() functions for STL container types.
void exitRemoteState(int stateId, const ::Ice::Current &context=Ice::emptyCurrent) override
std::string joinStrings(std::vector< std::string > const &input, std::string const &seperator)