RemoteStateOfferer.cpp
Go to the documentation of this file.
1 #include "RemoteStateOfferer.h"
2 
4 
5 namespace armarx
6 {
7 
9  {
10  }
11 
13  {
14  }
15 
17  const CreateRemoteStateInstanceInput& input,
18  const Ice::Current& /*context*/)
19  {
20  CreateRemoteStateInstanceOutput result;
21 
22  StateBasePtr statePtr = getStatePtr(input.stateClassName);
23  // Can this even happen?
24  // You would get a segfault in getRemoteInputParameters() since this method does not check
25  if (!statePtr)
26  {
27  std::stringstream msg;
28  msg << "Could not find (public) state: " << input.stateClassName;
30 
31  for (const auto& entry : (*impl->stateInstancesPtr))
32  {
33  StateBase* state = entry.second;
34 
35  if (stateName == state->getStateName())
36  {
37  msg << "- but found a state instance with same name - maybe you forgot to make the state public?";
38  break;
39  }
40  }
41 
42  throw LocalException(msg.str());
43  }
44 
45  // getRemoteInputParameters()
46  result.inputParameters = statePtr->inputParameters;
47  // getRemoteOutputParameters()
48  result.outputParameters = statePtr->outputParameters;
49 
50  // createRemoteStateInstance
51  {
53 
54  StatePtr newState = StatePtr::dynamicCast(statePtr->clone());
55  if (!newState)
56  {
57  throw exceptions::local::eNullPointerException("Could not cast from StateBasePtr to StatePtr");
58  }
59 
60  if (!input.instanceName.empty())
61  {
62  newState->setStateName(input.instanceName);
63  }
64 
65  RemoteStateWrapperPtr newWrappedState = new RemoteStateWrapper(newState, input.remoteState, input.parentStateLayout);
66  RemoteStateData remoteStateData;
67  remoteStateData.callerIceName = "";
68  remoteStateData.callerStatePrx = input.remoteState;
69  remoteStateData.remoteWrappedState = newWrappedState;
70  remoteStateData.id = newState->getLocalUniqueId();
71  {
73  stateInstanceList[remoteStateData.id] = remoteStateData;
74  }
75 
76  newWrappedState->globalStateIdentifier = input.parentStateItentifierStr;
77  newState->__setParentState(newWrappedState._ptr);
78 
79  result.remoteStateId = remoteStateData.id;
80 
81  // getRemoteStateInstance()
82  {
83  StatePtr state = newState;
84  state->refetchSubstates();
85  result.statechartInstance = state;
86  }
87  }
88 
89  return result;
90  }
91 
93  const std::string& stateName,
94  const RemoteStateIceBasePrx& remoteStatePrx,
95  const std::string& parentStateItentifierStr,
96  const std::string& instanceName,
97  const Ice::Current& /*context*/)
98  {
100 
101  //look for state with stateName
102  StateBasePtr statePtr = getStatePtr(stateName);
103 
104  if (!statePtr)
105  {
106  std::stringstream msg;
107  msg << "Could not find (public) state: " << stateName;
109 
110  for (const auto& entry : (*impl->stateInstancesPtr))
111  {
112  StateBase* state = entry.second;
113 
114  if (stateName == state->getStateName())
115  {
116  msg << "- but found a state instance with same name - maybe you forgot to make the state public?";
117  break;
118  }
119  }
120 
121  throw LocalException(msg.str());
122  }
123 
124  // if(!RemoteAccessableStatePtr::dynamicCast(statePtr))
125  // throw throw UserException("The state "+ statePtr->stateName + " must be derived of armarx::RemoteAccessableState");
126  ARMARX_DEBUG << "entering createRemoteStateInstance() with " << parentStateItentifierStr << " stateclass: " << statePtr->stateClassName << " statename: " << statePtr->stateName << flush;
127  StatePtr newState = StatePtr::dynamicCast(statePtr->clone());
128 
129  if (!newState)
130  {
131  throw exceptions::local::eNullPointerException("Could not cast from StateBasePtr to StatePtr");
132  }
133 
134  if (!instanceName.empty())
135  {
136  newState->setStateName(instanceName);
137  }
138 
139  ARMARX_DEBUG << "RemoteStateInstanceName: " << newState->getStateName() << " instanceName=" << instanceName;
140  RemoteStateWrapperPtr newWrappedState = new RemoteStateWrapper(newState, remoteStatePrx);
141  RemoteStateData remoteStateData;
142  remoteStateData.callerIceName = "";
143  remoteStateData.callerStatePrx = remoteStatePrx;
144  remoteStateData.remoteWrappedState = newWrappedState;
145  remoteStateData.id = newState->getLocalUniqueId();
146  {
148  stateInstanceList[remoteStateData.id] = remoteStateData;
149  }
150 
151  newWrappedState->globalStateIdentifier = parentStateItentifierStr;
152  newState->__setParentState(newWrappedState._ptr);
153 
154 
155  return remoteStateData.id;
156  }
157 
158  void RemoteStateOffererBase::updateGlobalStateIdRecursive(int stateId, const std::string& parentId, const Ice::Current& context)
159  {
161 
162  StatePtr state = wrapper->realState;
163  if (state)
164  {
165  state->__getParentState()->globalStateIdentifier = parentId;
166  state->__updateGlobalStateIdRecursive();
167  }
168  }
169 
170  void RemoteStateOffererBase::callRemoteState(int stateId, const StringVariantContainerBaseMap& properties, const Ice::Current& context)
171  {
172  StatePtr state = getInstance(stateId).remoteWrappedState->realState;
173 
174  if (state->getStatePhase() >= eExited)
175  {
176  state->setStatePhase(eDefined);
177  }
178 
179  state->enter(properties);
180  }
181 
182  void RemoteStateOffererBase::exitRemoteState(int stateId, const ::Ice::Current& context)
183  {
184  getInstance(stateId).remoteWrappedState->realState->_baseOnExit();
185  }
186 
187  bool RemoteStateOffererBase::breakRemoteState(int stateId, const EventBasePtr& evt, const Ice::Current& context)
188  {
189  ARMARX_DEBUG << "breaking remote state id " << stateId << "\n" << flush;
190  bool result = true;
191  RemoteStateData stateData;
192 
193  try
194  {
195  stateData = getInstance(stateId);
196  result = stateData.remoteWrappedState->realState->_baseOnBreak(EventPtr::dynamicCast(evt));
197  }
198  catch (const LocalException&)
199  {
200  ARMARX_ERROR << "Could not find state with id " << stateId << " - thus cannot break it" << flush;
201  return true;
202  }
203 
204  return result;
205  }
206 
207  bool RemoteStateOffererBase::isRemoteStateFinished(int stateId, const Ice::Current& context)
208  {
209  return getInstance(stateId).remoteWrappedState->realState->isFinished();
210  }
211 
212  bool RemoteStateOffererBase::breakActiveSubstateRemotely(int stateId, const EventBasePtr& evt, const Ice::Current& context)
213  {
214  return getInstance(stateId).remoteWrappedState->realState->__breakActiveSubstate(EventPtr::dynamicCast(evt));
215  }
216 
217  void RemoteStateOffererBase::notifyEventBufferedDueToUnbreakableStateRemote(int stateId, bool eventBuffered, const Ice::Current& context)
218  {
219  StateControllerPtr statePtr = StateControllerPtr::dynamicCast(getGlobalInstancePtr(stateId));
220 
221  statePtr->__notifyEventBufferedDueToUnbreakableState(eventBuffered);
222  }
223 
224  StateIceBasePtr RemoteStateOffererBase::refetchRemoteSubstates(int stateId, const Ice::Current& context)
225  {
227 
228  std::scoped_lock lock(wrapper->mutex);
229  StatePtr state = wrapper->realState;
230  state->refetchSubstates();
231  return new StateIceBase(*state);
232  }
233 
234  StateParameterMap RemoteStateOffererBase::getRemoteInputParameters(const std::string& stateName, const Ice::Current& context)
235  {
236  StateBasePtr statePtr = getStatePtr(stateName);
237  return statePtr->inputParameters;
238  }
239 
240  StateParameterMap RemoteStateOffererBase::getRemoteOutputParameters(const std::string& stateName, const Ice::Current& context)
241  {
242  StateBasePtr statePtr = getStatePtr(stateName);
243  return statePtr->outputParameters;
244  }
245 
247  {
248  return getInstance(stateId).remoteWrappedState->realState->inputParameters;
249  }
250 
252  {
253  RemoteStateData entry = getInstance(stateId);
254  return entry.remoteWrappedState->realState->outputParameters;
255  }
256 
257  bool RemoteStateOffererBase::hasSubstatesRemote(const std::string& stateName, const Ice::Current& context) const
258  {
259  StateBasePtr statePtr = getStatePtr(stateName);
260 
261  if (statePtr->subStateList.size() > 0)
262  {
263  return true;
264  }
265 
266  return false;
267  }
268 
269  bool RemoteStateOffererBase::hasActiveSubstateRemote(int stateId, const Ice::Current& context)
270  {
271  return getInstance(stateId).remoteWrappedState->realState->__hasActiveSubstate();
272  }
273 
274  Ice::StringSeq RemoteStateOffererBase::getAvailableStates(const Ice::Current& context)
275  {
276  Ice::StringSeq result;
277 
278  for (unsigned int i = 0; i < subStateList.size(); ++i)
279  {
280  result.push_back(StateBasePtr::dynamicCast(subStateList.at(i))->stateName);
281  }
282 
283  return result;
284  }
285 
286  StateIdNameMap RemoteStateOffererBase::getAvailableStateInstances(const Ice::Current& context)
287  {
288  StateIdNameMap result;
290  typename std::map<int, RemoteStateData>::iterator it = stateInstanceList.begin();
291 
292  for (; it != stateInstanceList.end(); ++it)
293  {
294  result[it->second.remoteWrappedState->realState->getLocalUniqueId()] = it->second.remoteWrappedState->realState->getGlobalHierarchyString();
295  }
296 
297  return result;
298  }
299 
300  StateIceBasePtr RemoteStateOffererBase::getStatechart(const std::string& stateName, const Ice::Current& context)
301  {
302  StateBasePtr state = getStatePtr(stateName);
303  HiddenTimedMutex::ScopedLock lock(impl->__stateMutex);
304  return state;
305  }
306 
307  StateIceBasePtr RemoteStateOffererBase::getStatechartInstance(int stateId, const Ice::Current&)
308  {
309  StatePtr state = getInstance(stateId).remoteWrappedState->realState;
310  state->refetchSubstates();
311  return state;
312  }
313 
314  StateIceBasePtr RemoteStateOffererBase::getStatechartInstanceByGlobalIdStr(const std::string& globalStateIdStr, const Ice::Current&)
315  {
316  StateIceBasePtr result;
317  int stateCount = 0;
318  {
320  typename std::map<int, RemoteStateData>::iterator it = stateInstanceList.begin();
321 
322  for (; it != stateInstanceList.end(); ++it)
323  {
324  StateBasePtr curState = StateBasePtr::dynamicCast(it->second.remoteWrappedState->realState);
325 
326  if (curState->globalStateIdentifier == globalStateIdStr)
327  {
328 
329  stateCount++;
330 
331  if (stateCount == 1)
332  {
333  result = curState;
334  }
335  }
336 
337  if (stateCount == 0)
338  {
339  result = getStatechartInstanceByGlobalIdStrRecursive(globalStateIdStr, curState, stateCount);
340  }
341  }
342  }
343 
344  if (stateCount > 1)
345  {
346  ARMARX_WARNING << "Found more than one state with globalStateIdStr '" << globalStateIdStr << "'. Returning first found occurence." << flush;
347  }
348 
349  StateBasePtr state = StateBasePtr::dynamicCast(result);
350  if (state)
351  {
352  state->refetchSubstates();
353  }
354  else
355  {
356  ARMARX_WARNING << "Could not find state instance with id str '" << globalStateIdStr << "'";
357  }
358  return state;
359  }
360 
361  bool RemoteStateOffererBase::isHostOfStateByGlobalIdStr(const std::string& globalStateIdStr, const Ice::Current&)
362  {
364  std::queue<StateBasePtr> stateList;
365  StateBasePtr statePtr;
366  for (auto& instancePair : stateInstanceList)
367  {
368  stateList.push(instancePair.second.remoteWrappedState->realState);
369  }
370  ARMARX_DEBUG << "Query: " << globalStateIdStr;
371  do
372  {
373  if (stateList.size() > 0)
374  {
375  statePtr = stateList.front();
376  stateList.pop();
377  }
378  if (statePtr)
379  {
380  ARMARX_DEBUG << "Checking " << statePtr->getGlobalHierarchyString();
381  }
382  RemoteStatePtr remoteState = RemoteStatePtr::dynamicCast(statePtr);
383  //first add all subchildren to list
384  if (statePtr && !remoteState) // dont inspect remote states
385  {
386  for (unsigned int i = 0; i < statePtr->subStateList.size(); i++)
387  {
388  stateList.push(StateBasePtr::dynamicCast(statePtr->subStateList.at(i)));
389  }
390  }
391  if (statePtr && statePtr->getGlobalHierarchyString() == globalStateIdStr)
392  {
393  return true;
394  }
395  }
396  while (stateList.size() > 0);
397 
398  return false;
399  }
400 
401  void RemoteStateOffererBase::removeInstance(int stateId, const Ice::Current&)
402  {
403  try
404  {
405  RemoteStateData entry = getInstance(stateId);
406  ARMARX_DEBUG << "removing instance of state '" << entry.remoteWrappedState->realState->stateName << "' \n" << flush;
407  entry.remoteWrappedState->realState->clearSelfPointer();
408  entry.remoteWrappedState->realState->disableRunFunction();
410  stateInstanceList.erase(stateId);
411  }
412  catch (LocalException& e)
413  {
414  ARMARX_WARNING << "Couldn't find state with id " << stateId << ". Hence, it could not be removed.\n" << flush;
415  }
416  }
417 
418  void RemoteStateOffererBase::issueEvent(int receivingStateId, const EventBasePtr& event, const Ice::Current&)
419  {
420  ARMARX_VERBOSE << "received external event '" << event->eventName << "' for state '" << event->eventReceiverName << "'" << flush;
421  ARMARX_VERBOSE << "Event Dict Size: " << event->properties.size() << "\n" << StateUtilFunctions::getDictionaryString(event->properties) << flush;
422  StateControllerPtr statePtr = StateControllerPtr::dynamicCast(getGlobalInstancePtr(receivingStateId));
423 
424  try
425  {
426  if (impl->manager)
427  {
428  impl->manager->addEvent(EventPtr::dynamicCast(event), statePtr);
429  }
430  }
431  catch (LocalException& local)
432  {
433  ARMARX_ERROR << "Caught Exception in issueEvent: " << local.what() << flush;
434  }
435  catch (const IceUtil::Exception& exception)
436  {
437  // Handle local (run-time) exceptions
439  << "caught ice exception: " << exception.what()
440  << "\nBacktrace: " << exception.ice_stackTrace()
441  << flush;
442  }
443  }
444 
445  void RemoteStateOffererBase::issueEventWithGlobalIdStr(const std::string& globalStateIdStr, const EventBasePtr& evt, const Ice::Current&)
446  {
447  try
448  {
449  int id = StateBasePtr::dynamicCast(getStatechartInstanceByGlobalIdStr(globalStateIdStr))->getLocalUniqueId();
450  issueEvent(id, evt);
451  }
452  catch (Ice::Exception& e)
453  {
454  ARMARX_ERROR << "Caught Ice::exception: " << e.what() << std::endl << e.ice_stackTrace();
455  }
456  }
457 
458  RemoteStatePtr RemoteStateOffererBase::addRemoteState(std::string stateName, std::string proxyName, std::string instanceName)
459  {
460  throw exceptions::local::eStatechartLogicError("You cannot add remoteStates directly to the RemoteStateOfferer. You can only add them to substates.");
461  }
462 
464  {
465  throw exceptions::local::eStatechartLogicError("You cannot add dynamicRemoteStates directly to the RemoteStateOfferer. You can only add them to substates.");
466  }
467 
469  {
471  typename std::map<int, RemoteStateData>::iterator it = stateInstanceList.find(stateId);
472 
473  if (it == stateInstanceList.end())
474  {
475  std::stringstream str;
476  str << "Could not find state with id '" << stateId << "'\n";
477  str << "Known states:\n";
478 
479  for (it = stateInstanceList.begin(); it != stateInstanceList.end(); ++it)
480  {
481  RemoteStateData& data = it->second;
482  str << "\t" << data.remoteWrappedState->stateName << " id: " << data.remoteWrappedState->getLocalUniqueId() << flush;
483  }
484 
485  throw LocalException(str.str());
486  }
487 
488  return it->second;
489  }
490 
492  {
494  typename std::map<int, StateBase*>::iterator it = impl->stateInstancesPtr->find(globalId);
495 
496  if (it != impl->stateInstancesPtr->end())
497  {
498  return it->second;
499  }
500 
501  std::stringstream str;
502  str << "Could not find state with id '" << globalId << "'";
503  throw LocalException(str.str());
504 
505  return nullptr;
506  }
507 
508  StateBasePtr RemoteStateOffererBase::getStatePtr(const std::string& stateName) const
509  {
510  bool found = false;
511  StateBasePtr statePtr = nullptr;
512 
513  for (unsigned int i = 0; i < subStateList.size(); i++)
514  {
515 
516  StateBasePtr state = StateBasePtr::dynamicCast(subStateList.at(i));
517  ARMARX_CHECK_NOT_NULL(state);
518  if (state->stateName == stateName)
519  {
520  statePtr = state;
521  found = true;
522  break;
523  }
524  }
525 
526  if (!found)
527  {
528  ARMARX_ERROR << "Could not find state with name '" << stateName << "'" << flush;
529  // throw LocalException("Could not find state with name '" + stateName + "'");
530  }
531 
532  return statePtr;
533  }
534 
535  std::map<int, StateBasePtr> RemoteStateOffererBase::getChildStatesByName(int parentId, std::string stateName)
536  {
537  StateBasePtr statePtr = getInstance(parentId).remoteWrappedState->realState;
538  std::map<int, StateBasePtr> stateList;
539  std::map<int, StateBasePtr> result;
540 
541  do
542  {
543  //first add all subchildren to list
544  for (unsigned int i = 0; i < statePtr->subStateList.size(); i++)
545  {
546  stateList.insert(std::pair<int, StateBasePtr> (StateBasePtr::dynamicCast(statePtr->subStateList.at(i))->getLocalUniqueId(), StateBasePtr::dynamicCast(statePtr->subStateList.at(i))));
547  }
548 
549  if (parentId != statePtr->getLocalUniqueId())// dont add parentstate
550  {
551  if (StateBasePtr::dynamicCast(statePtr)->stateName == stateName)
552  {
553  result.insert(std::pair<int, StateBasePtr> (statePtr->getLocalUniqueId(), statePtr));
554  }
555 
556  stateList.erase(statePtr->getLocalUniqueId());
557  }
558 
559  if (stateList.size() > 0)
560  {
561  statePtr = stateList.begin()->second;
562  }
563  }
564  while (stateList.size() > 0);
565 
566  return result;
567  }
568 
569  StateIceBasePtr RemoteStateOffererBase::getStatechartInstanceByGlobalIdStrRecursive(const std::string& globalStateIdStr, StateBasePtr state, int& stateCounter)
570  {
571  StateIceBasePtr result;
572  StateList::iterator it = state->subStateList.begin();
573 
574  for (; it != state->subStateList.end(); ++it)
575  {
576  StateBasePtr curState = StateBasePtr::dynamicCast(*it);
577 
578  if (curState->globalStateIdentifier == globalStateIdStr)
579  {
580  stateCounter++;
581 
582  if (stateCounter == 1)
583  {
584  result = curState;
585  }
586  }
587 
588  if (stateCounter == 0)
589  {
590  result = getStatechartInstanceByGlobalIdStrRecursive(globalStateIdStr, curState, stateCounter);
591  }
592  }
593 
594  return result;
595  }
596 
598  {
599  ARMARX_DEBUG << "Starting RemoteStateOfferer ";
601  }
602 
604  {
606 
607  for (size_t i = 0; i < subStateList.size(); i++)
608  {
609  StateControllerPtr c = StateControllerPtr::dynamicCast(subStateList.at(i));
610 
611  if (c)
612  {
613  c->disableRunFunction();
614  }
615  }
616 
617  subStateList.clear();
618 
619  for (auto& e : stateInstanceList)
620  {
621  StateControllerPtr c = StateControllerPtr::dynamicCast(e.second.remoteWrappedState->realState);
622 
623  if (c)
624  {
625  c->disableRunFunction();
626  }
627  }
628 
629  stateInstanceList.clear();
630  }
631 
633  {
634  }
635 
637  {
638  state.init(impl->context, impl->manager);
639  }
640 
641 }
armarx::RemoteStateOffererBase::createRemoteStateInstance
int createRemoteStateInstance(const std::string &stateName, const RemoteStateIceBasePrx &remoteStatePrx, const std::string &parentStateItentifierStr, const std::string &instanceName, const Ice::Current &context=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:92
ARMARX_VERBOSE
#define ARMARX_VERBOSE
Definition: Logging.h:180
armarx::RemoteStateOffererBase::waitUntilComponentStarted
virtual void waitUntilComponentStarted()=0
str
std::string str(const T &t)
Definition: UserAssistedSegmenterGuiWidgetController.cpp:42
armarx::RemoteStateOffererBase::breakRemoteState
bool breakRemoteState(int stateId, const EventBasePtr &evt, const ::Ice::Current &context=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:187
armarx::RemoteStateOffererBase::isRemoteStateFinished
bool isRemoteStateFinished(int stateId, const ::Ice::Current &context=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:207
armarx::RemoteStateOffererBase::refetchRemoteSubstates
StateIceBasePtr refetchRemoteSubstates(int stateId, const ::Ice::Current &context=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:224
armarx::RemoteStateWrapper
Definition: RemoteStateWrapper.h:50
armarx::RemoteStateOffererBase::createRemoteStateInstanceNew
CreateRemoteStateInstanceOutput createRemoteStateInstanceNew(CreateRemoteStateInstanceInput const &input, Ice::Current const &context) override
Definition: RemoteStateOfferer.cpp:16
armarx::RemoteStateOffererBase::getRemoteOutputParametersById
StateParameterMap getRemoteOutputParametersById(int stateId, const ::Ice::Current &context=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:251
armarx::RemoteStateOffererBase::hasActiveSubstateRemote
bool hasActiveSubstateRemote(int stateId, const ::Ice::Current &context=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:269
armarx::RemoteStateOffererBase::run
void run() override
Virtual function, that can be reimplemented to calculate complex operations.
Definition: RemoteStateOfferer.cpp:632
armarx::RemoteStateOffererBase::getStatePtr
virtual StateBasePtr getStatePtr(const std::string &stateName) const
Definition: RemoteStateOfferer.cpp:508
StateBaseImpl.h
ARMARX_CHECK_NOT_NULL
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
Definition: ExpressionException.h:206
armarx::RemoteStateOffererBase::removeInstance
void removeInstance(int stateId, const Ice::Current &=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:401
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::StateBase::getStateName
std::string getStateName() const
getStateName
Definition: StateBase.cpp:523
armarx::RemoteStateOffererBase::RemoteStateData::id
int id
Local id of this RemoteStateOfferer, that identifies the state instance in the stateInstanceList.
Definition: RemoteStateOfferer.h:135
armarx::exceptions::local::eNullPointerException
Definition: Exception.h:42
armarx::RemoteStateOffererBase::onConnectRemoteStateOfferer
virtual void onConnectRemoteStateOfferer()
Virtual function, in which the user can fetch some proxies.
Definition: RemoteStateOfferer.cpp:8
armarx::State::init
bool init(StatechartContextInterface *context, StatechartManager *manager)
Function to initialize this state. Must be called in the highest level of the hierarchy - and only th...
Definition: State.cpp:84
armarx::RemoteStateOffererBase::notifyEventBufferedDueToUnbreakableStateRemote
void notifyEventBufferedDueToUnbreakableStateRemote(int stateId, bool eventBuffered, const ::Ice::Current &context=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:217
armarx::RemoteStateOffererBase::issueEvent
void issueEvent(int receivingStateId, const EventBasePtr &evt, const Ice::Current &=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:418
armarx::RemoteStateOffererBase::getAvailableStateInstances
StateIdNameMap getAvailableStateInstances(const ::Ice::Current &context=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:286
armarx::exceptions::local::eStatechartLogicError
Definition: Exception.h:30
armarx::StateBase::eDefined
@ eDefined
Definition: StateBase.h:271
armarx::RemoteStateOffererBase::addDynamicRemoteState
RemoteStatePtr addDynamicRemoteState(std::string instanceName) override
Overridden so that the user cannot use it.
Definition: RemoteStateOfferer.cpp:463
armarx::RemoteStateOffererBase::getChildStatesByName
std::map< int, StateBasePtr > getChildStatesByName(int parentId, std::string stateName)
Definition: RemoteStateOfferer.cpp:535
armarx::RemoteStateOffererBase::getAvailableStates
Ice::StringSeq getAvailableStates(const ::Ice::Current &context=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:274
IceInternal::Handle< StateBase >
armarx::RemoteStateOffererBase::RemoteStateData::callerStatePrx
RemoteStateIceBasePrx callerStatePrx
Proxy to the state, that called this state.
Definition: RemoteStateOfferer.h:139
armarx::RemoteStateOffererBase::getRemoteInputParametersById
StateParameterMap getRemoteInputParametersById(int stateId, const ::Ice::Current &context=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:246
armarx::RemoteStateOffererBase::initState
void initState(State &state)
Definition: RemoteStateOfferer.cpp:636
armarx::RemoteStateOffererBase::getStatechart
StateIceBasePtr getStatechart(const std::string &stateName, const ::Ice::Current &context=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:300
armarx::RemoteStateOffererBase::onConnectStatechartImpl
void onConnectStatechartImpl()
Definition: RemoteStateOfferer.cpp:597
armarx::statechartmodel::StateParameterMap
QMap< QString, StateParameterPtr > StateParameterMap
Definition: StateParameter.h:46
armarx::RemoteStateOffererBase::breakActiveSubstateRemotely
bool breakActiveSubstateRemotely(int stateId, const EventBasePtr &evt, const ::Ice::Current &context=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:212
armarx::flush
const LogSender::manipulator flush
Definition: LogSender.h:251
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
ARMARX_DEBUG
#define ARMARX_DEBUG
Definition: Logging.h:177
armarx::aron::input
ReaderT::InputType & input
Definition: rw.h:19
armarx::RemoteStateOffererBase::RemoteStateData::remoteWrappedState
RemoteStateWrapperPtr remoteWrappedState
Pointer to a Pseudo parent state, that contains the real state instance.
Definition: RemoteStateOfferer.h:141
armarx::StateBase::eExited
@ eExited
Definition: StateBase.h:276
armarx::RemoteStateOffererBase::hasSubstatesRemote
bool hasSubstatesRemote(const std::string &stateName, const ::Ice::Current &context=Ice::emptyCurrent) const override
Definition: RemoteStateOfferer.cpp:257
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:189
armarx::RemoteStateOffererBase::getGlobalInstancePtr
StateBasePtr getGlobalInstancePtr(int globalId) const
Definition: RemoteStateOfferer.cpp:491
armarx::State
Definition: State.h:54
armarx::RemoteStateOffererBase::updateGlobalStateIdRecursive
void updateGlobalStateIdRecursive(int stateId, const std::string &parentId, const Ice::Current &context=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:158
armarx::StateBase
Definition: StateBase.h:61
armarx::RemoteStateOffererBase::RemoteStateData::callerIceName
std::string callerIceName
Not used yet.
Definition: RemoteStateOfferer.h:137
armarx::RemoteStateOffererBase::getRemoteInputParameters
StateParameterMap getRemoteInputParameters(const std::string &stateName, const ::Ice::Current &context=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:234
armarx::RemoteStateOffererBase::RemoteStateData
Definition: RemoteStateOfferer.h:132
armarx::StateUtilFunctions::getDictionaryString
std::string getDictionaryString(const StringVariantContainerBaseMap &mymap)
Converts the map into a string-representation.
Definition: StateUtilFunctions.cpp:232
armarx::RemoteStateOffererBase::onExitRemoteStateOfferer
virtual void onExitRemoteStateOfferer()
Virtual function, in which the user can implement some clean up.
Definition: RemoteStateOfferer.cpp:12
armarx::RemoteStateOffererBase::stateInstanceList
std::map< int, RemoteStateData > stateInstanceList
Holds the instances that where requested from remotely located states.
Definition: RemoteStateOfferer.h:161
armarx::RemoteStateOffererBase::callRemoteState
void callRemoteState(int stateId, const StringVariantContainerBaseMap &properties, const Ice::Current &context=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:170
armarx::RemoteStateOffererBase::getStatechartInstanceByGlobalIdStr
StateIceBasePtr getStatechartInstanceByGlobalIdStr(const std::string &globalStateIdStr, const Ice::Current &=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:314
armarx::RemoteStateOffererBase::getRemoteOutputParameters
StateParameterMap getRemoteOutputParameters(const std::string &stateName, const ::Ice::Current &context=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:240
armarx::RemoteStateOffererBase::onExitStatechartImpl
void onExitStatechartImpl()
Definition: RemoteStateOfferer.cpp:603
armarx::RemoteStateOffererBase::getStatechartInstanceByGlobalIdStrRecursive
StateIceBasePtr getStatechartInstanceByGlobalIdStrRecursive(const std::string &globalStateIdStr, StateBasePtr state, int &stateCounter)
Definition: RemoteStateOfferer.cpp:569
armarx::RemoteStateOffererBase::issueEventWithGlobalIdStr
void issueEventWithGlobalIdStr(const std::string &globalStateIdStr, const EventBasePtr &evt, const Ice::Current &=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:445
armarx::RemoteStateOffererBase::isHostOfStateByGlobalIdStr
bool isHostOfStateByGlobalIdStr(const std::string &globalStateIdStr, const Ice::Current &=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:361
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:186
armarx::RemoteStateOffererBase::addRemoteState
RemoteStatePtr addRemoteState(std::string stateName, std::string proxyName, std::string instanceName) override
Overridden so that the user cannot use it.
Definition: RemoteStateOfferer.cpp:458
armarx::HiddenTimedMutex::ScopedLock
boost::unique_lock< HiddenTimedMutex > ScopedLock
Definition: Synchronization.h:122
armarx::StateBase::impl
std::unique_ptr< Impl > impl
Definition: StateBase.h:258
armarx::RemoteStateOffererBase::getInstance
RemoteStateData getInstance(int stateId)
Definition: RemoteStateOfferer.cpp:468
armarx::RemoteStateOffererBase::stateInstanceListMutex
HiddenTimedMutex stateInstanceListMutex
Definition: RemoteStateOfferer.h:159
armarx::RemoteStateOffererBase::getStatechartInstance
StateIceBasePtr getStatechartInstance(int stateId, const Ice::Current &=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:307
RemoteStateOfferer.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::RemoteStateOffererBase::exitRemoteState
void exitRemoteState(int stateId, const ::Ice::Current &context=Ice::emptyCurrent) override
Definition: RemoteStateOfferer.cpp:182
armarx::StateBase::Impl::__StateInstancesMutex
static HiddenTimedMutex * __StateInstancesMutex
Definition: StateBaseImpl.h:39