RemoteState.cpp
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package ArmarXCore::Statechart
19 * @author Mirko Waechter( mirko.waechter at kit dot edu)
20 * @date 2012
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24 #include "RemoteState.h"
25 
26 #include <fstream>
27 
28 #include <boost/interprocess/sync/file_lock.hpp>
29 #include <boost/interprocess/sync/scoped_lock.hpp>
30 
31 #include <IceUtil/IceUtil.h>
32 
36 
37 #include "StateBaseImpl.h"
38 #include "StateUtilFunctions.h"
40 
41 namespace armarx
42 {
44  {
45  stateName = "";
46  stateType = eRemoteState;
47  remoteStateId = -1;
48  proxyName = "";
49 
51  }
52 
54  IceUtil::Shared(source),
55  Ice::Object(source),
56  StateIceBase(source),
57  RemoteStateInterface(source),
58  RemoteStateIceBase(source),
59  Logging(source),
62  State(source),
64  {
65  myProxy = nullptr;
66 
67  if (false)
68  {
69  remoteStateId = source.remoteStateId;
70  }
71  else
72  {
73  remoteStateId = -1;
74  }
75 
76  stateOffererPrx = source.stateOffererPrx;
78  }
79 
82  {
83  assert(0);
84  return *this;
85  }
86 
88  {
89  if (remoteStateId >= 0 && stateOffererPrx)
90  {
91  ARMARX_DEBUG << "Removing remoteinstance" << flush;
92 
93  try
94  {
95  stateOffererPrx->removeInstance(remoteStateId);
96  }
97  catch (Ice::NotRegisteredException& e)
98  {
99  ARMARX_WARNING << "Could not remove instance of RemoteState '" << stateClassName
100  << "'; probably the remote component is not alive anymore" << flush;
101  }
102  }
103  }
104 
105  void
106  RemoteState::setStateName(const std::string& stateName)
107  {
108  if (!stateName.empty())
109  {
110  this->stateName = stateName;
111  }
112 
114  }
115 
116  void
117  RemoteState::setProxyName(const std::string& proxyName)
118  {
119  if (!proxyName.empty())
120  {
121  this->proxyName = proxyName;
122  }
123 
125  }
126 
127  void
129  {
130  usingProxy(proxyName);
131  }
132 
133  static const char* const g_lockFile = "/tmp/armarx-statechart.lock";
134  static std::once_flag g_createLockFileFlag;
135  static std::mutex g_processMutex;
136 
137  void
139  {
140  //ARMARX_INFO << "getting proxy " << proxyName << "\n" << flush;
141 
142  stateOffererPrx = getProxy<RemoteStateOffererIceBasePrx>(proxyName);
143 
144  if (!stateOffererPrx)
145  {
146  throw exceptions::local::eNullPointerException("Couldnt get remote state proxy");
147  }
148 
149  //ARMARX_INFO << "stateoffererprxy: " <<stateOffererPrx._ptr << flush;
150  myProxy = RemoteStateIceBasePrx::checkedCast(getProxy());
151 
152  // TODO: Test new state chart creation with the SecondHands demo
153 #define USE_NEW_CREATE_STATECHART_INSTANCE
154 #ifdef USE_NEW_CREATE_STATECHART_INSTANCE
155 
156  std::call_once(g_createLockFileFlag,
157  []()
158  {
159  if (!std::filesystem::exists(g_lockFile))
160  {
161  std::ofstream lockFile(g_lockFile);
162  lockFile << "ArmarX Statechart Lock File";
163  }
164  });
165 
166  boost::interprocess::file_lock file_lock(g_lockFile);
167  try
168  {
169  boost::interprocess::scoped_lock<boost::interprocess::file_lock> globalLock(file_lock);
170  std::scoped_lock localLock(g_processMutex);
171  ::usleep(20000);
172  }
173  catch (std::exception const& ex)
174  {
175  ARMARX_WARNING << "Could not lock file: '" << g_lockFile
176  << "'\n Waiting for 10 ms before calling createRemoteStateInstance for "
177  << stateClassName << ", " << stateName;
178  ::usleep(20000);
179  }
180 
181  ARMARX_IMPORTANT << "Calling stateOffererPrx->createRemoteStateInstanceNew for "
182  << stateClassName << ", " << stateName;
183 
184  CreateRemoteStateInstanceInput input;
185  input.stateClassName = stateClassName;
186  input.remoteState = myProxy;
187  input.parentStateItentifierStr = globalStateIdentifier;
188  input.instanceName = stateName;
189  input.parentStateLayout = __getParentState();
190  CreateRemoteStateInstanceOutput output;
191 
192 
193  try
194  {
195  output = stateOffererPrx->createRemoteStateInstanceNew(input);
196  }
197  catch (Ice::ConnectFailedException const& e)
198  {
199  ARMARX_WARNING << "Ice connect failed, trying again in a little bit";
200  ::usleep(1000000);
201  output = stateOffererPrx->createRemoteStateInstanceNew(input);
202  }
203  remoteStateId = output.remoteStateId;
204  inputParameters = output.inputParameters;
205  outputParameters = output.outputParameters;
206 
207  StateIceBasePtr state = output.statechartInstance;
208 #else
210  stateOffererPrx->getRemoteInputParameters(stateClassName), inputParameters);
211 
212  // ARMARX_INFO << "Getting input of " << stateClassName << "input: " << StateUtilFunctions::getDictionaryString(inputParameters);
213  // StateUtilFunctions::unsetParameters(inputParameters);
215  stateOffererPrx->getRemoteOutputParameters(stateClassName), outputParameters);
216 
217  std::call_once(g_createLockFileFlag,
218  []()
219  {
220  if (!std::filesystem::exists(g_lockFile))
221  {
222  std::ofstream lockFile(g_lockFile);
223  lockFile << "ArmarX Statechart Lock File";
224  }
225  });
226 
227  boost::interprocess::file_lock file_lock(g_lockFile);
228  try
229  {
230  boost::interprocess::scoped_lock<boost::interprocess::file_lock> globalLock(file_lock);
231  std::scoped_lock localLock(g_processMutex);
232  ::usleep(20000);
233  }
234  catch (std::exception const& ex)
235  {
236  ARMARX_WARNING << "Could not lock file: '" << g_lockFile
237  << "'\n Waiting for 10 ms before calling createRemoteStateInstance for "
238  << stateClassName << ", " << stateName;
239  ::usleep(20000);
240  }
241 
242  ARMARX_IMPORTANT << "Calling stateOffererPrx->createRemoteStateInstance for "
243  << stateClassName << ", " << stateName;
244  try
245  {
246  remoteStateId = stateOffererPrx->createRemoteStateInstance(
247  stateClassName, myProxy, globalStateIdentifier, stateName);
248  }
249  catch (Ice::ConnectFailedException const& e)
250  {
251  ARMARX_WARNING << "Ice connect failed, trying again in a little bit";
252  ::usleep(1000000);
253  remoteStateId = stateOffererPrx->createRemoteStateInstance(
254  stateClassName, myProxy, globalStateIdentifier, stateName);
255  }
256  StateIceBasePtr state = stateOffererPrx->getStatechartInstance(remoteStateId);
257 #endif
258 
259  subStateList = state->subStateList;
260  transitions = state->transitions;
261  activeSubstate = state->activeSubstate;
262  initState = state->initState;
263  }
264 
265  void
267  {
269  {
270  ARMARX_INFO << "Remote State '" << this->getStateName()
271  << "' was disconnected during execution -> sending failure event";
272  // Event only needed when this state is currently active
273  EventPtr evt = new Failure(this->getStateName());
274  __enqueueEvent(evt);
275  }
276 
277  try
278  {
279  if (remoteStateId != -1 && stateOffererPrx)
280  {
281  stateOffererPrx->removeInstance(remoteStateId);
282  }
283  }
284  catch (...)
285  {
286  }
287 
288  remoteStateId = -1;
289  stateOffererPrx = nullptr;
290  }
291 
294  {
295  RemoteStatePtr result = new RemoteState(*this);
296 
297  if (getArmarXManager())
298  {
299  getArmarXManager()->addObject(ManagedIceObjectPtr::dynamicCast(result), false);
300  // ARMARX_DEBUG << "Waiting for RemoteState '" << result->getName() << "'";
301 
302  result->getObjectScheduler()->waitForObjectStateMinimum(eManagedIceObjectStarted);
303  }
304 
305  return result;
306  }
307 
310  {
311  RemoteStatePtr result = new RemoteState();
312 
313  result->setName(result->getDefaultName());
314  result->setStateName(stateName);
315  result->setStateClassName(getStateClassName());
316  result->setProxyName(proxyName);
317 
318  getArmarXManager()->addObject(ManagedIceObjectPtr::dynamicCast(result), false);
319  return result;
320  }
321 
322  std::string
324  {
325  std::stringstream componentName;
326  componentName << "RemoteState_" << getLocalUniqueId() << "_" << proxyName << "_"
327  << globalStateIdentifier;
328  return componentName.str();
329  }
330 
331  void
333  {
334  if (!__getParentState())
335  {
336  throw exceptions::local::eNullPointerException("parentState in remoteState is NULL");
337  }
338  else
339  {
340  __getParentState()->__processBufferedEvents();
341  }
342  }
343 
344  void
345  RemoteState::remoteProcessEvent(const EventBasePtr& evt, bool buffered, const Ice::Current& c)
346  {
347  ARMARX_DEBUG << "entering remoteProcessEvent()"
348  << "\n"
349  << flush;
350 
351  if (__getParentState())
352  {
353  __getParentState()->__processEvent(EventPtr::dynamicCast(evt), buffered);
354  }
355  else
356  {
357  throw exceptions::local::eNullPointerException("parentstate of remoteState " +
358  stateName + " is NULL");
359  }
360  }
361 
362  void
363  RemoteState::remoteEnqueueEvent(const EventBasePtr& evt, const Ice::Current& c)
364  {
365  // ARMARX_LOG << eINFO << "entering remoteEnqueueEvent()" << "\n" << flush;
366  if (!__getParentState())
367  {
368  throw exceptions::local::eNullPointerException("parentstate of remoteState " +
369  stateName + " is NULL");
370  }
371 
372  __enqueueEvent(EventPtr::dynamicCast(evt));
373  }
374 
375  void
376  RemoteState::remoteFinalize(const StringVariantContainerBaseMap& properties,
377  const EventBasePtr& event,
378  const Ice::Current& c)
379  {
380  // ARMARX_LOG << eINFO << "RemoteState::finalize: " << stateName << "\n" << flush;
381  StateUtilFunctions::fillDictionary(properties, outputParameters);
382 
383  // remoteStateFinished = true;
384  if (!__getParentState())
385  {
386  throw exceptions::local::eNullPointerException("parentstate of remoteState " +
387  stateName + " is NULL");
388  }
389 
390  __finalize(EventPtr::dynamicCast(event));
391  }
392 
393  Ice::Int
395  {
396  if (!__getParentState())
397  {
398  throw exceptions::local::eNullPointerException("parentstate of remoteState " +
399  stateName + " is NULL");
400  }
401 
402  try
403  {
404  return __getParentState()->__getUnbreakableBufferSize();
405  }
406  catch (...)
407  {
408  return 0;
409  }
410  }
411 
412  bool
414  {
415  if (!__getParentState())
416  {
417  throw exceptions::local::eNullPointerException("parentstate of remoteState " +
418  stateName + " is NULL");
419  }
420 
421  try
422  {
423  return __getParentState()->__getUnbreakableBufferStati();
424  }
425  catch (...)
426  {
427  return true;
428  }
429  }
430 
431  bool
433  {
434  if (!stateOffererPrx || remoteStateId == -1)
435  {
436  return false;
437  }
438 
439  try
440  {
441  return stateOffererPrx->hasSubstatesRemote(stateClassName);
442  }
443  catch (...)
444  {
445  return false;
446  }
447  }
448 
449  bool
451  {
452  if (!stateOffererPrx || remoteStateId == -1)
453  {
454  return false;
455  }
456 
457  try
458  {
459  return stateOffererPrx->hasActiveSubstateRemote(remoteStateId);
460  }
461  catch (...)
462  {
463  return false;
464  }
465  }
466 
469  {
470  if (stateOffererPrx)
471  {
472  if (remoteStateId != -1)
473  {
474  inputParameters = stateOffererPrx->getRemoteInputParametersById(remoteStateId);
475  }
476  else
477  {
478  inputParameters = stateOffererPrx->getRemoteInputParameters(stateClassName);
479  }
480  }
481 
482  StateParameterMap result;
483  StateUtilFunctions::copyDictionary(inputParameters, result);
484  return result;
485  }
486 
489  {
490  // ARMARX_VERBOSE << "Retrieving output parameters for " << stateName ;
491  if (stateOffererPrx &&
492  getStatePhase() < eExited) // if finished, the outputparamters are already set
493  {
494  if (remoteStateId != -1)
495  {
496  outputParameters = stateOffererPrx->getRemoteOutputParametersById(remoteStateId);
497  }
498  else
499  {
500  outputParameters = stateOffererPrx->getRemoteOutputParameters(stateClassName);
501  }
502  }
503 
504  // ARMARX_VERBOSE << "params " << StateUtilFunctions::getDictionaryString(outputParameters);
505  return outputParameters;
506  }
507 
510  {
511  if (remoteStateId == -1 || !stateOffererPrx)
512  {
513  return nullptr;
514  }
515 
516  return StateBasePtr::dynamicCast(stateOffererPrx->getStatechartInstance(remoteStateId));
517  }
518 
519  bool
521  {
522  auto start = IceUtil::Time::now();
523  if (!StateBase::waitForInitialization(timeoutMS))
524  {
525  return false;
526  }
527  double waitTime = (IceUtil::Time::now() - start).toMilliSecondsDouble();
528  return getObjectScheduler()->waitForObjectStateMinimum(
529  eManagedIceObjectStarted, timeoutMS < 0 ? -1 : std::max(0.0, timeoutMS - waitTime));
530  }
531 
532  bool
534  {
535  return initialized && getState() >= eManagedIceObjectStarted;
536  }
537 
538  void
540  {
541  if (!getObjectScheduler()->waitForObjectState(eManagedIceObjectStarted, 20000))
542  {
543  // Event only needed when this state is currently active
544  ARMARX_WARNING << "Trying to enter remote state '" << stateName
545  << "', but it is not reachable yet!";
546  EventPtr evt = new Failure(this->getStateName());
547  __enqueueEvent(evt);
548  return;
549  }
550 
553  ARMARX_DEBUG << "calling a state remotely " << stateName << "\n" << flush;
554 
555  if (lock.owns_lock())
556  {
557  try
558  {
559  ARMARX_DEBUG << "input for remotestate " << stateName << " (" << remoteStateId
560  << "):\n"
561  << StateUtilFunctions::getDictionaryString(inputParameters) << "\n"
562  << flush;
563  stateOffererPrx->callRemoteState(remoteStateId,
564  StateUtilFunctions::getSetValues(inputParameters));
565  }
566  catch (Ice::Exception& e)
567  {
568  ARMARX_ERROR << "Caught exception in " << stateName
569  << "::baseOnEnter(): " << e.what() << "\n"
570  << e.ice_stackTrace() << flush;
571  }
572  catch (std::exception& e)
573  {
574  ARMARX_ERROR << "Caught exception in " << stateName
575  << "::baseOnEnter(): " << e.what() << "\n"
576  << flush;
577  }
578  }
579  else
580  {
581  ARMARX_WARNING << "failed to get lock"
582  << "\n"
583  << flush;
584  }
585 
587  }
588 
589  bool
591  {
592  HiddenTimedMutex::ScopedLock lock(StateBase::impl->__stateMutex);
593  // ARMARX_LOG << eINFO << "Entering RemoteState::baseOnBreak()" << "\n" << flush;
595 
596  //call baseOnBreak() over Ice
597 
598  if (remoteStateId == -1)
599  {
600  ARMARX_WARNING << "RemoteStateId is unknown in baseOnbreak()" << flush;
601  return true;
602  }
603 
604  //throw LocalException("RemoteStateId is unknown in baseOnbreak()");
605  bool result = stateOffererPrx->breakRemoteState(remoteStateId, evt);
606 
607  outputParameters = stateOffererPrx->getRemoteOutputParametersById(remoteStateId);
608 
609  // ARMARX_LOG << eINFO << "remotebaseonbreak returned" << "\n" << flush;
611 
612  return result;
613  }
614 
615  void
617  {
618  HiddenTimedMutex::ScopedLock lock(StateBase::impl->__stateMutex);
619 
620  // ARMARX_LOG << eINFO << "RemoteState " << stateName << "::baseOnExit()" << "\n" << flush;
621  // ARMARX_LOG << eINFO << "stateId is: " << remoteStateId << "\n" << flush;
622  if (remoteStateId >= 0 && getStatePhase() < eBreaking)
623  {
625  stateOffererPrx->exitRemoteState(remoteStateId);
626  outputParameters = stateOffererPrx->getRemoteOutputParametersById(remoteStateId);
627  }
628 
629  onExit();
631  }
632 
633  void
635  {
636  ARMARX_DEBUG << "notifying state with id " << remoteStateId
637  << " eventBuffered:" << std::string((eventBuffered) ? "true" : "false")
638  << flush;
639 
640  if (remoteStateId != -1 && stateOffererPrx)
641  {
642  stateOffererPrx->begin_notifyEventBufferedDueToUnbreakableStateRemote(remoteStateId,
643  eventBuffered);
644  }
645  }
646 
647  void
649  {
650  if (remoteStateId != -1 && stateOffererPrx)
651  {
652  StateIceBasePtr state = stateOffererPrx->refetchRemoteSubstates(remoteStateId);
653  subStateList = state->subStateList;
654  transitions = state->transitions;
655  activeSubstate = state->activeSubstate;
656  initState = state->initState;
657  }
658  }
659 
660  void
662  {
664  if (remoteStateId != -1 && stateOffererPrx)
665  {
666  auto id = getGlobalHierarchyString();
667  auto pos = id.find_last_of(">");
668  if (pos != std::string::npos)
669  {
670  id.erase(id.find_last_of(">") - 1);
671  }
672  stateOffererPrx->updateGlobalStateIdRecursive(remoteStateId, id);
673  }
674  }
675 
676  bool
678  {
679  // ARMARX_LOG << eINFO << eINFO <<"RemoteState " << stateName << "::breakActiveSubstate()" << "\n" << flush;
680  //ARMARX_LOG << eINFO << "stateId is: " << remoteStateId << "\n" << flush;
681  return stateOffererPrx->breakActiveSubstateRemotely(remoteStateId, event);
682  }
683 
684  StateIceBasePtr
685  RemoteState::getParentStateLayout(const Ice::Current&) const
686  {
687  StateControllerPtr parentState = __getParentState();
688  ARMARX_IMPORTANT << "In getParentStateLayout() for " << stateName
689  << ", parentState Ice ID: "
690  << (parentState ? parentState->ice_id() : "(null)");
691  return parentState;
692  }
693 
694 } // namespace armarx
armarx::StateBase::eEntered
@ eEntered
Definition: StateBase.h:303
armarx::ManagedIceObject::setName
void setName(std::string name)
Override name of well-known object.
Definition: ManagedIceObject.cpp:445
armarx::StateBase::getGlobalHierarchyString
std::string getGlobalHierarchyString() const
Definition: StateBase.cpp:580
armarx::StateController::__getParentState
StateControllerPtr __getParentState() const
Getter function that automatically casts the parentState member of StateBase into StateControllerPtr.
Definition: StateController.cpp:587
armarx::StateBase::eEntering
@ eEntering
Definition: StateBase.h:302
armarx::RemoteState::getOutputParameters
StateParameterMap & getOutputParameters() override
Definition: RemoteState.cpp:488
armarx::RemoteState::waitForInitialization
bool waitForInitialization(int timeoutMS) const override
Definition: RemoteState.cpp:520
armarx::StateUtilFunctions::fillDictionary
void fillDictionary(const StringVariantContainerBaseMap &source, StringVariantContainerBaseMap &destination)
Tries to fill the destination map with matching entries of the source map. Entries that could not be ...
Definition: StateUtilFunctions.cpp:164
armarx::StateController::__enqueueEvent
virtual void __enqueueEvent(const EventPtr event)
Definition: StateController.cpp:195
armarx::RemoteState::getRemoteUnbreakableBufferSize
::Ice::Int getRemoteUnbreakableBufferSize(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: RemoteState.cpp:394
armarx::StateBase::setStatePhase
void setStatePhase(StatePhase newPhase)
Definition: StateBase.cpp:933
ARMARX_IMPORTANT
#define ARMARX_IMPORTANT
Definition: Logging.h:190
armarx::HiddenTimedMutex::ScopedTryLock
boost::detail::try_lock_wrapper< HiddenTimedMutex > ScopedTryLock
Definition: Synchronization.h:140
armarx::RemoteState::setStateName
void setStateName(const std::string &stateName)
Definition: RemoteState.cpp:106
armarx::StateBase::waitForInitialization
virtual bool waitForInitialization(int timeoutMS=-1) const
Definition: StateBase.cpp:586
armarx::StateBase::onExit
virtual void onExit()
Virtual function, in which the behaviour of state is defined, when it is exited. Can be overridden,...
Definition: StateBase.cpp:528
armarx::StateController
Definition: StateController.h:55
armarx::RemoteState::remoteProcessEvent
void remoteProcessEvent(const EventBasePtr &evt, bool buffered, const ::Ice::Current &c=Ice::emptyCurrent) override
Definition: RemoteState.cpp:345
StateBaseImpl.h
armarx::RemoteState::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: RemoteState.cpp:323
armarx::RemoteState::getRemoteStatePtr
StateBasePtr getRemoteStatePtr()
Function that retrieves a copy of the remoteState. Calling functions or setting members on this insta...
Definition: RemoteState.cpp:509
armarx::RemoteState::remoteFinalize
void remoteFinalize(const StringVariantContainerBaseMap &properties, const EventBasePtr &event, const ::Ice::Current &c=Ice::emptyCurrent) override
Definition: RemoteState.cpp:376
armarx::RemoteState::_baseOnEnter
void _baseOnEnter() override
Overridden function to redirect this call to the real state in the other application.
Definition: RemoteState.cpp:539
armarx::ManagedIceObject::getArmarXManager
ArmarXManagerPtr getArmarXManager() const
Returns the ArmarX manager used to add and remove components.
Definition: ManagedIceObject.cpp:360
armarx::ManagedIceObject::getState
int getState() const
Retrieve current state of the ManagedIceObject.
Definition: ManagedIceObject.cpp:769
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
armarx::StateBase::getStateName
std::string getStateName() const
getStateName
Definition: StateBase.cpp:545
armarx::RemoteState::createEmptyCopy
StateBasePtr createEmptyCopy() const override
Definition: RemoteState.cpp:309
armarx::StateBase::getLocalUniqueId
Ice::Int getLocalUniqueId() const
Definition: StateBase.cpp:551
armarx::exceptions::local::eNullPointerException
Definition: Exception.h:49
StateUtilFunctions.h
IceUtil
Definition: Instance.h:21
armarx::StateBase::__updateGlobalStateId
void __updateGlobalStateId()
Definition: StateBase.cpp:259
StatechartObjectFactories.h
IceInternal::Handle< Event >
armarx::RemoteState::getInputParameters
StateParameterMap getInputParameters() override
Not const because RemoteState implementation gets the current parameters via Ice and sets them.
Definition: RemoteState.cpp:468
armarx::RemoteState::getParentStateLayout
StateIceBasePtr getParentStateLayout(const Ice::Current &) const override
Definition: RemoteState.cpp:685
armarx::RemoteState::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: RemoteState.cpp:138
armarx::RemoteState::RemoteState
RemoteState()
Definition: RemoteState.cpp:43
armarx::RemoteState::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: RemoteState.cpp:128
armarx::RemoteState::getRemoteUnbreakableBufferStati
bool getRemoteUnbreakableBufferStati(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: RemoteState.cpp:413
armarx::statechartmodel::StateParameterMap
QMap< QString, StateParameterPtr > StateParameterMap
Definition: StateParameter.h:46
armarx::RemoteState::__updateGlobalStateIdRecursive
void __updateGlobalStateIdRecursive() override
Definition: RemoteState.cpp:661
armarx::RemoteState::clone
StateBasePtr clone() const override
Pure virtual function to clone of the derived class type.
Definition: RemoteState.cpp:293
armarx::flush
const LogSender::manipulator flush
Definition: LogSender.h:251
ARMARX_DEBUG
#define ARMARX_DEBUG
Definition: Logging.h:184
armarx::aron::input
ReaderT::InputType & input
Definition: rw.h:12
armarx::RemoteState::~RemoteState
~RemoteState() override
Definition: RemoteState.cpp:87
armarx::StateUtilFunctions::copyDictionary
void copyDictionary(const StringVariantContainerBaseMap &source, StringVariantContainerBaseMap &destination)
Clears the destination map and copies the parameters of the source in it.
Definition: StateUtilFunctions.cpp:197
RemoteState.h
armarx::RemoteState
This Statetype is used to create a state instance that represents a state that is located in another ...
Definition: RemoteState.h:62
armarx::StateBase::eExited
@ eExited
Definition: StateBase.h:306
armarx::RemoteState::__breakActiveSubstate
bool __breakActiveSubstate(const EventPtr event) override
Overridden function to redirect this call to the real state in the other application.
Definition: RemoteState.cpp:677
armarx::RemoteState::__hasSubstates
bool __hasSubstates() override
not used at the moment
Definition: RemoteState.cpp:432
ArmarXObjectScheduler.h
max
T max(T t1, T t2)
Definition: gdiam.h:51
armarx::RemoteState::__hasActiveSubstate
bool __hasActiveSubstate() override
Overridden function to redirect this call to the real state in the other application.
Definition: RemoteState.cpp:450
armarx::RemoteState::isInitialized
bool isInitialized() const override
Returns the status of this state. Only if a state is initialized, it can be used.
Definition: RemoteState.cpp:533
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:196
armarx::RemoteState::refetchSubstates
void refetchSubstates() override
This functions updates the substates.
Definition: RemoteState.cpp:648
armarx::RemoteState::setProxyName
void setProxyName(const std::string &proxyName)
Definition: RemoteState.cpp:117
boost::source
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:661
armarx::State
Definition: State.h:53
armarx::StateBase
Definition: StateBase.h:59
armarx::StateController::__finalize
virtual void __finalize(const EventPtr event)
Function that gets called, when a state enters a FinalSubstate. Virtual function, so that RemoteState...
Definition: StateController.cpp:188
armarx::StateUtilFunctions::getDictionaryString
std::string getDictionaryString(const StringVariantContainerBaseMap &mymap)
Converts the map into a string-representation.
Definition: StateUtilFunctions.cpp:251
Ice
Definition: DBTypes.cpp:63
armarx::ManagedIceObject
The ManagedIceObject is the base class for all ArmarX objects.
Definition: ManagedIceObject.h:162
armarx::Logging
Base Class for all Logging classes.
Definition: Logging.h:239
armarx::RemoteState::__notifyEventBufferedDueToUnbreakableState
void __notifyEventBufferedDueToUnbreakableState(bool eventBuffered) override
Overridden function to redirect this call to the real state in the other application.
Definition: RemoteState.cpp:634
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:181
armarx::RemoteState::operator=
RemoteState & operator=(const RemoteState &source)
Definition: RemoteState.cpp:81
armarx::RemoteState::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: RemoteState.cpp:266
armarx::VariantType::Int
const VariantTypeId Int
Definition: Variant.h:917
armarx::StateBase::getStateClassName
const std::string & getStateClassName() const
Definition: StateBase.cpp:557
armarx::RemoteState::remoteProcessBufferedEvents
void remoteProcessBufferedEvents(const ::Ice::Current &c=Ice::emptyCurrent) override
Definition: RemoteState.cpp:332
armarx::StateBase::getStatePhase
StatePhase getStatePhase() const
Definition: StateBase.cpp:926
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:193
armarx::StateBase::eBreaking
@ eBreaking
Definition: StateBase.h:304
armarx::ManagedIceObject::getProxy
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
Definition: ManagedIceObject.cpp:407
armarx::HiddenTimedMutex::ScopedLock
boost::unique_lock< HiddenTimedMutex > ScopedLock
Definition: Synchronization.h:139
armarx::StateBase::eExiting
@ eExiting
Definition: StateBase.h:305
armarx::RemoteState::remoteEnqueueEvent
void remoteEnqueueEvent(const EventBasePtr &evt, const ::Ice::Current &c=Ice::emptyCurrent) override
Definition: RemoteState.cpp:363
armarx::StateUtilFunctions::getSetValues
StringVariantContainerBaseMap getSetValues(const StateParameterMap &paramMap)
Definition: StateUtilFunctions.cpp:56
armarx::StateBase::impl
std::unique_ptr< Impl > impl
Definition: StateBase.h:288
armarx::RemoteState::_baseOnBreak
bool _baseOnBreak(const EventPtr evt) override
Called by processEvent()-function or parentstate. Must NOT be called by user.
Definition: RemoteState.cpp:590
armarx::ManagedIceObject::usingProxy
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
Definition: ManagedIceObject.cpp:154
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::ManagedIceObject::getObjectScheduler
ArmarXObjectSchedulerPtr getObjectScheduler() const
Definition: ManagedIceObject.cpp:776
Application.h
armarx::RemoteState::_baseOnExit
void _baseOnExit() override
Overridden function to redirect this call to the real state in the other application.
Definition: RemoteState.cpp:616
FinalState.h