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