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