State.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 "State.h"
25 #include "StateBaseImpl.h"
26 
27 #include "RemoteState.h" //needed for substate copying
28 #include "DynamicRemoteState.h" //needed for substate copying
29 #include "StateUtilFunctions.h"
30 
34 
35 #include <IceUtil/UUID.h>
36 
37 #include <SimoxUtility/algorithm/string/string_tools.h>
38 
39 #include <mutex>
40 
41 namespace armarx
42 {
43  // TODO: This should probably be somewhere in SimoxUtility?
44  std::string joinStrings(std::vector<std::string> const& input, std::string const& seperator)
45  {
46  return simox::alg::join(input, seperator);
47  }
48 
49  struct State::Impl
50  {
51  std::mutex inputParameterMutex;
52  std::mutex localParameterMutex;
54  };
55 
57  : simpl(new Impl)
58  {
59  }
60 
62  IceUtil::Shared(),
63  Ice::Object(source),
64  StateIceBase(source),
65  Logging(source),
69  simpl(new Impl)
70  {
71 
72  }
73 
75  {
76  assert(0);
78  StateBase::impl->context = source.impl->context;
79  return *this;
80  }
81 
83 
85  {
86  __checkPhase(ePreDefined, __PRETTY_FUNCTION__);
87 
88  return StateBase::init(context, manager);
89  }
90 
91  unsigned int State::getId() const
92  {
93  return StateBase::impl->localUniqueId;
94  }
95 
96  std::string State::getGlobalIdString() const
97  {
98  return globalStateIdentifier;
99  }
100 
102  {
103  return StateBasePtr::dynamicCast(initState);
104  }
105 
106  bool State::isUnbreakable() const
107  {
108  return unbreakable;
109  }
110 
112  {
113  return outputParameters;
114  }
115 
116 
117 
118 
119  StatePtr State::operator [](std::string const& stateName)
120  {
121  for (size_t i = 0; i < subStateList.size(); ++i)
122  {
123  if (stateName == StateBasePtr::dynamicCast(subStateList[i])->stateName
124  || stateName == StateBasePtr::dynamicCast(subStateList[i])->globalStateIdentifier)
125  {
126  return StatePtr::dynamicCast(subStateList[i]);
127  }
128  }
129 
130  return nullptr;
131  }
132 
133 
134 
136  {
137 
138  if (findSubstateByName(pNewState->getStateName()))
139  {
140  throw exceptions::local::eStatechartLogicError("There exists already a substate with name '" + stateName + "' in this hierarchy level. In one hierarchy level (aka one substatelist) the names must be unique.");
141  }
142 
143  pNewState->__setParentState(this);
144  subStateList.push_back(pNewState);
145  pNewState->init(StateBase::impl->context, StateBase::impl->manager);
146  return pNewState;
147  }
148 
149 
151  State::addRemoteState(std::string stateName, std::string proxyName, std::string instanceName)
152  {
153  __checkPhase(eSubstatesDefinitions, __PRETTY_FUNCTION__);
154 
155  if (instanceName.empty())
156  {
157  instanceName = stateName;
158  }
159 
160  if (findSubstateByName(instanceName))
161  {
162  throw LocalException("There exists already a substate with name '" + instanceName + "' in this hierarchy level. In one hierarchy level aka one substatelist the names must be unique.");
163  }
164 
165  RemoteStatePtr pNewState = new RemoteState();
166  pNewState->setStateName(instanceName);
167  pNewState->setStateClassName(stateName);
168  pNewState->__setParentState(this);
169  pNewState->setProxyName(proxyName);
170 
171  subStateList.push_back(pNewState);
172  StatechartContext* context = StateBase::getContext<StatechartContext>();
173 
174  pNewState->StateBase::init(StateBase::impl->context, StateBase::impl->manager);
175 
176  if (!ManagedIceObjectPtr::dynamicCast(pNewState))
177  {
178  throw exceptions::local::eNullPointerException("could not cast RemoteStatePtr to ManagedIceObjectPtr");
179  }
180 
181  if (!context)
182  {
183  throw exceptions::local::eNullPointerException("statechart context ptr is NULL -> could not add state as component");
184  }
185  else
186  {
187 
188  context->getArmarXManager()->addObject(ManagedIceObjectPtr::dynamicCast(pNewState), false);
189 
190  // ARMARX_DEBUG << "Waiting for RemoteState '" << pNewState->getName() << "'";
191 
192  // pNewState->getObjectScheduler()->waitForObjectStateMinimum(eManagedIceObjectStarted, 500);
193 
194  // ARMARX_DEBUG << "RemoteState '" << pNewState->getName() << "' started.";
195  }
196 
197  return pNewState;
198  }
199 
201  {
202  __checkPhase(eSubstatesDefinitions, __PRETTY_FUNCTION__);
203 
204  if (findSubstateByName(instanceName))
205  {
206  throw LocalException("There exists already a substate with name '" + stateName + "' in this hierarchy level. In one hierarchy level aka one substatelist the names must be unique.");
207  }
208 
209  RemoteStatePtr pNewState = new DynamicRemoteState();
210 
211  pNewState->__setParentState(this);
212  pNewState->setStateName(instanceName);
213  subStateList.push_back(pNewState);
214  StatechartContext* context = StateBase::getContext<StatechartContext>();
215 
216  pNewState->StateBase::init(StateBase::impl->context, StateBase::impl->manager);
217 
218  ARMARX_CHECK_EXPRESSION(ManagedIceObjectPtr::dynamicCast(pNewState));
219  ARMARX_CHECK_EXPRESSION(context);
220 
221  context->getArmarXManager()->addObject(ManagedIceObjectPtr::dynamicCast(pNewState), false, pNewState->getName() + IceUtil::generateUUID());
222 
223  ARMARX_DEBUG << "Waiting for RemoteState " << pNewState->getName();
224 
225  pNewState->getObjectScheduler()->waitForObjectStateMinimum(eManagedIceObjectStarted);
226 
227  ARMARX_DEBUG << "RemoteState " << pNewState->getName() << "started.";
228 
229  return pNewState;
230  }
231 
232  TransitionIceBase& State::addTransition(EventPtr event, StateIceBasePtr sourceState, StateIceBasePtr destinationState, ParameterMappingIceBasePtr mappingToNextStatesInput, ParameterMappingIceBasePtr mappingToParentStatesLocal, ParameterMappingIceBasePtr mappingToParentStatesOutput)
233  {
234  __checkPhase(eSubstatesDefinitions, __PRETTY_FUNCTION__);
235  TransitionIceBase t;
236 
237  assert(sourceState._ptr);
238  assert(destinationState._ptr);
239  t.sourceState = sourceState;
240  t.evt = createEvent(event->eventName, event->properties);
241  t.destinationState = destinationState;
242 
243  if (mappingToNextStatesInput)
244  {
245  t.mappingToNextStatesInput = PMPtr::dynamicCast(mappingToNextStatesInput)->clone();
246  }
247 
248  if (mappingToParentStatesLocal)
249  {
250  t.mappingToParentStatesLocal = PMPtr::dynamicCast(mappingToParentStatesLocal)->clone();
251  }
252 
253  if (mappingToParentStatesOutput)
254  {
255  t.mappingToParentStatesOutput = PMPtr::dynamicCast(mappingToParentStatesOutput)->clone();
256  }
257 
259  throw exceptions::local::eStatechartLogicError("There already exists a transition on event '" + t.evt->eventName
260  + "' from '" + sourceState->stateName + "' to '" + destinationState->stateName + "'");
261 
262  transitions.push_back(t);
263  return *transitions.rbegin();
264  }
265 
266  void State::inheritInputFromSubstate(std::string stateName)
267  {
268  __checkPhase(eParametersDefinitions, __PRETTY_FUNCTION__);
269  StateBase::impl->inputInheritance.push_back(stateName);
270  }
271 
272 
273 
274  bool State::addToInput(const std::string& key, VariantTypeId type, bool optional, VariantPtr defaultValue)
275  {
276  __checkPhase(eParametersDefinitions, __PRETTY_FUNCTION__);
277  return addParameter(inputParameters, key, type, optional);
278  }
279 
280  bool State::addToInput(const std::string& key, const ContainerType& type, bool optional, VariantContainerBasePtr defaultValue)
281  {
282  __checkPhase(eParametersDefinitions, __PRETTY_FUNCTION__);
283  return addParameterContainer(inputParameters, key, type, optional, defaultValue);
284 
285  }
286 
287  bool State::addToOutput(const std::string& key, VariantTypeId type, bool optional)
288  {
289  __checkPhase(eParametersDefinitions, __PRETTY_FUNCTION__);
290  return addParameter(outputParameters, key, type, optional);
291  }
292 
293  bool State::addToOutput(const std::string& key, const ContainerType& type, bool optional)
294  {
295  __checkPhase(eParametersDefinitions, __PRETTY_FUNCTION__);
296 
297  return addParameterContainer(outputParameters, key, type, optional);
298  }
299  bool State::addToLocal(const std::string& key, const ContainerType& type, VariantContainerBasePtr defaultValue)
300  {
301  __checkPhase(eParametersDefinitions, __PRETTY_FUNCTION__);
302  std::unique_lock lock(simpl->localParameterMutex);
303 
304  return addParameterContainer(localParameters, key, type, true, defaultValue);
305  }
306 
307  bool State::addToLocal(const std::string& key, VariantTypeId type, VariantPtr defaultValue)
308  {
309  __checkPhase(eParametersDefinitions, __PRETTY_FUNCTION__);
310  std::unique_lock lock(simpl->localParameterMutex);
311 
312  return addParameter(localParameters, key, type, true, defaultValue);
313  }
314 
315 
316 
317 
318 
320  {
321  __checkPhase(eSubstatesDefinitions, __PRETTY_FUNCTION__);
322 
323  if (initialStateMapping)
324  {
325  this->initialStateMapping = initialStateMapping->clone();
326  }
327 
328  if (!StateIceBasePtr::dynamicCast(initState))
329  {
330  throw LocalException("Couldnt cast initstate");
331  }
332 
333  this->initState = initState;
334 
335  return initState;
336  }
337 
338  void State::setUnbreakable(bool setUnbreakable)
339  {
340  __checkPhase(eStatechartDefinitions, __PRETTY_FUNCTION__);
341  unbreakable = setUnbreakable;
342  }
343 
344  void State::setUseRunFunction(bool useRunFuntion)
345  {
346  StateBase::impl->__useRunFunction = useRunFuntion;
347  }
348 
350  {
351  __checkPhase(eEntering, __PRETTY_FUNCTION__);
352  StateBase::impl->cancelEnteringSubstates = true;
353  }
354 
355  void State::setStateName(const std::string& newName)
356  {
357  stateName = newName;
358  }
359 
360  void State::setStateClassNameFromTypeName(const std::string& typeName)
361  {
362  std::string className = simox::alg::replace_all(typeName, ":", "_");
363  setStateClassName(className);
364  }
365 
367  {
368  StateParameterMap result;
369  std::unique_lock lock(simpl->inputParameterMutex);
370  StateUtilFunctions::copyDictionary(inputParameters, result);
371  return result;
372  }
373 
374  VariantPtr State::getInput(const std::string& key) const
375  {
376  __checkPhaseMin(eDefined, __PRETTY_FUNCTION__);
377  std::unique_lock lock(simpl->inputParameterMutex);
378 
379 
380  VariantPtr var;
381  getParameter(inputParameters, key, var);
382  return var->clone();
383  }
384 
386  {
387  return localParameters;
388  }
389 
390  void State::setInput(const std::string& key, const Variant& value)
391  {
392  __checkPhaseMin(eDefined, __PRETTY_FUNCTION__);
393  std::unique_lock lock(simpl->inputParameterMutex);
394 
396  {
397  throw LocalException("Input parameter '" + key + "' in state '" + stateName + "'' is already set and cannot be changed.");
398  }
399 
400  setParameter(inputParameters, key, value);
401  }
402 
403  void State::setInput(std::string const& key, const VariantContainerBase& valueList)
404  {
405  __checkPhaseMin(eDefined, __PRETTY_FUNCTION__);
406  std::unique_lock lock(simpl->inputParameterMutex);
407 
409  {
410  throw LocalException("Input parameter '" + key + "' in state '" + stateName + "'' is already set and cannot be changed.");
411  }
412 
413  setParameterContainer(inputParameters, key, valueList);
414  }
415 
416 
417  void State::setLocal(std::string const& key, const Variant& value)
418  {
419  __checkPhaseMin(eDefined, __PRETTY_FUNCTION__);
420  std::unique_lock lock(simpl->localParameterMutex);
421 
423  }
424 
425  void State::setLocal(std::string const& key, const VariantContainerBase& valueList)
426  {
427  __checkPhaseMin(eDefined, __PRETTY_FUNCTION__);
428  std::unique_lock lock(simpl->localParameterMutex);
429 
430  setParameterContainer(getLocalParameters(), key, valueList);
431  }
432 
433 
434  void State::setOutput(std::string const& key, const Variant& value)
435  {
436  __checkPhaseMin(eDefined, __PRETTY_FUNCTION__);
437  std::unique_lock lock(simpl->outputParameterMutex);
438 
440  }
441 
442  void State::setOutput(std::string const& key, const VariantContainerBase& valueList)
443  {
444  __checkPhaseMin(eDefined, __PRETTY_FUNCTION__);
445  std::unique_lock lock(simpl->outputParameterMutex);
446 
447  setParameterContainer(getOutputParameters(), key, valueList);
448  }
449 
451  {
452  StateBasePtr result = new State(*this);
453  //result->deepCopy(shared_from_this,false);
454  return result;
455  }
456 
458  {
459  StateBasePtr result = new State();
460  //result->deepCopy(shared_from_this,false);
461  return result;
462  }
463 
464 
465 
466 
467 
468 
469  // SingleTypeVariantListPtr
470  // State::getInputList(std::string key){
471  // __checkPhaseMin(eDefined, __PRETTY_FUNCTION__);
472  // std::unique_lock lock(inputParameterMutex);
473  // SingleTypeVariantListPtr varList;
474  // getParameter(inputParameters, key, varList);
475  // return varList;
476  // }
477 
478  VariantContainerBasePtr
479  State::getLocalContainer(std::string const& key)
480  {
481  __checkPhaseMin(eDefined, __PRETTY_FUNCTION__);
482  std::unique_lock lock(simpl->localParameterMutex);
483 
484  VariantContainerBasePtr varList;
485  getParameterContainer(localParameters, key, varList);
486  return VariantContainerBasePtr::dynamicCast(varList);
487  }
488 
489  bool State::isInputParameterSet(const std::string& key) const
490  {
491  return isParameterSet(inputParameters, key);
492  }
493 
494  bool State::isLocalParameterSet(const std::string& key) const
495  {
496  return isParameterSet(localParameters, key);
497  }
498 
499  bool State::isOutputParameterSet(const std::string& key) const
500  {
501  return isParameterSet(outputParameters, key);
502  }
503 
504  template <>
505  StatePtr
506  State::addState<State>(std::string const& stateName)
507  {
508  __checkPhase(eSubstatesDefinitions, __PRETTY_FUNCTION__);
509 
510  if (findSubstateByName(stateName))
511  {
512  throw exceptions::local::eStatechartLogicError("There already exists a substate with name '" + stateName + "' in this hierarchy level. In one hierarchy level (aka one substatelist) the names must be unique.");
513  }
514 
515  if (stateName.empty())
516  {
517  throw exceptions::local::eStatechartLogicError("The statename must not be empty");
518  }
519 
520  StatePtr pNewState = new State();
521  pNewState->stateName = stateName;
522  pNewState->__setParentState(this);
523  subStateList.push_back(pNewState);
524  StatechartContext* context = StateBase::getContext<StatechartContext>();
525  pNewState->init(context, StateBase::impl->manager);
526 
527  return pNewState;
528  }
529 
530 
531 
532 }
armarx::State::isOutputParameterSet
bool isOutputParameterSet(const std::string &key) const
Definition: State.cpp:499
armarx::StateBase::getParameterContainer
void getParameterContainer(const StateParameterMap &paramMap, const std::string &key, VariantContainerBasePtr &valueContainer) const
Definition: StateBase.cpp:714
armarx::State::Impl::localParameterMutex
std::mutex localParameterMutex
Definition: State.cpp:52
armarx::Variant
The Variant class is described here: Variants.
Definition: Variant.h:224
armarx::State::getOutputParameters
StateParameterMap & getOutputParameters() override
getter function to get the map of output parameters
Definition: State.cpp:111
armarx::StateBase::eEntering
@ eEntering
Definition: StateBase.h:272
armarx::State::Impl
Definition: State.cpp:49
armarx::StateController
Definition: StateController.h:55
armarx::State::isUnbreakable
bool isUnbreakable() const
Definition: State.cpp:106
armarx::StateBase::eStatechartDefinitions
@ eStatechartDefinitions
Definition: StateBase.h:268
StateBaseImpl.h
armarx::State::setOutput
void setOutput(std::string const &key, const Variant &value)
setOuput() sets an output parameter of this state.
Definition: State.cpp:434
armarx::State::setUseRunFunction
void setUseRunFunction(bool useRunFuntion)
setUseRunFunction can be used to configurate whether the thread with the async.
Definition: State.cpp:344
armarx::StateBase::operator=
StateBase & operator=(const StateBase &source)
Definition: StateBase.cpp:98
armarx::State::getInput
std::enable_if_t< std::is_base_of_v< VariantDataClass, T >, IceInternal::Handle< T > > getInput(const std::string &key) const
getInput can be used to access a specific input parameter.
Definition: State.h:598
armarx::StateBase::__checkPhaseMin
void __checkPhaseMin(StatePhase allowedType, const char *functionName) const
Definition: StateBase.cpp:225
armarx::State::Impl::inputParameterMutex
std::mutex inputParameterMutex
Definition: State.cpp:51
armarx::ManagedIceObject::getArmarXManager
ArmarXManagerPtr getArmarXManager() const
Returns the ArmarX manager used to add and remove components.
Definition: ManagedIceObject.cpp:348
armarx::State::~State
~State() override
Definition: State.cpp:82
armarx::StatechartContextInterface
Definition: StatechartContextInterface.h:46
armarx::exceptions::local::eNullPointerException
Definition: Exception.h:42
StateUtilFunctions.h
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
IceUtil
Definition: Instance.h:21
armarx::State::setLocal
void setLocal(std::string const &key, const Variant &value)
setLocal() sets a local parameter.
Definition: State.cpp:417
armarx::exceptions::local::eStatechartLogicError
Definition: Exception.h:30
armarx::StateBase::eDefined
@ eDefined
Definition: StateBase.h:271
armarx::State::setStateName
void setStateName(const std::string &newName)
Definition: State.cpp:355
armarx::State::isInputParameterSet
bool isInputParameterSet(const std::string &key) const
Checks whether a given input parameter is set or not.
Definition: State.cpp:489
armarx::State::addState
StateBasePtr addState(StateBasePtr pNewState)
Definition: State.cpp:135
armarx::State::getGlobalIdString
std::string getGlobalIdString() const
Getter for the global state identifier string.
Definition: State.cpp:96
armarx::State::createEmptyCopy
StateBasePtr createEmptyCopy() const override
Generates a new copy of this state with the same overidden functions. stateName, substates,...
Definition: State.cpp:457
armarx::StateController::__checkExistenceOfTransition
bool __checkExistenceOfTransition(const TransitionIceBase &transition)
Definition: StateController.cpp:631
IceInternal::Handle< StateBase >
armarx::StateBase::setParameterContainer
void setParameterContainer(StateParameterMap &paramMap, const std::string &key, const VariantContainerBasePtr &valueContainer)
Definition: StateBase.cpp:685
armarx::State::cancelSubstates
void cancelSubstates()
Use this function in the onEnter() function, if you want to avoid that the substates (i....
Definition: State.cpp:349
armarx::State::setInitState
StateBasePtr setInitState(StateBasePtr initState, ParameterMappingPtr initialStateMapping=ParameterMappingPtr())
Sets the initial substate of this state.
Definition: State.cpp:319
armarx::StateBase::setStateClassName
void setStateClassName(std::string className)
setStateClassName() sets the string, that contains a stringrepresentation of this class....
Definition: StateBase.cpp:824
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
armarx::State::addToLocal
bool addToLocal(const std::string &key, VariantTypeId type, VariantPtr defaultValue=VariantPtr())
Adds a key,type-pair to the local parameters.
Definition: State.cpp:307
armarx::statechartmodel::StateParameterMap
QMap< QString, StateParameterPtr > StateParameterMap
Definition: StateParameter.h:46
armarx::State::getLocalParameters
StateParameterMap & getLocalParameters()
Getter for the local parameter map.
Definition: State.cpp:385
State.h
armarx::StatechartContext
This class contains a statechart and provides the interfaces to distributed components.
Definition: StatechartContext.h:89
ARMARX_DEBUG
#define ARMARX_DEBUG
Definition: Logging.h:177
armarx::aron::input
ReaderT::InputType & input
Definition: rw.h:19
armarx::State::setUnbreakable
void setUnbreakable(bool setUnbreakable=true)
With this function the state can be made unbreakable.
Definition: State.cpp:338
armarx::State::addTransition
TransitionIceBase & addTransition(EventPtr event, StateIceBasePtr sourceState, StateIceBasePtr destinationState, ParameterMappingIceBasePtr mappingToNextStatesInput=nullptr, ParameterMappingIceBasePtr mappingToParentStatesLocal=nullptr, ParameterMappingIceBasePtr mappingToParentStatesOutput=nullptr)
Definition: State.cpp:232
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::State::State
State()
Definition: State.cpp:56
armarx::State::addToInput
bool addToInput(const std::string &key, const ContainerType &type, bool optional, VariantContainerBasePtr defaultValue=VariantContainerBasePtr())
Adds a key,type-pair to the input parameters.
Definition: State.cpp:280
ArmarXObjectScheduler.h
armarx::State::clone
StateBasePtr clone() const override
Generates a new copy of this state with the same statename, substates, transitions,...
Definition: State.cpp:450
armarx::State::getLocalContainer
VariantContainerBasePtr getLocalContainer(std::string const &key)
Definition: State.cpp:479
armarx::VariantTypeId
Ice::Int VariantTypeId
Definition: Variant.h:44
boost::source
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:681
armarx::StateBase::addParameter
bool addParameter(StateParameterMap &paramMap, const std::string &key, VariantTypeId type, bool optional, VariantPtr defaultValue=VariantPtr()) const
Definition: StateBase.cpp:585
armarx::State
Definition: State.h:54
armarx::State::inheritInputFromSubstate
void inheritInputFromSubstate(std::string stateName)
Definition: State.cpp:266
armarx::StateBase
Definition: StateBase.h:61
ExpressionException.h
armarx::StateUtility
Definition: StateUtil.h:47
armarx::StateBase::ePreDefined
@ ePreDefined
Definition: StateBase.h:267
armarx::StateBase::eSubstatesDefinitions
@ eSubstatesDefinitions
Definition: StateBase.h:269
Ice
Definition: DBTypes.cpp:64
armarx::Logging
Base Class for all Logging classes.
Definition: Logging.h:232
ARMARX_CHECK_EXPRESSION
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
Definition: ExpressionException.h:73
armarx::State::addDynamicRemoteState
virtual RemoteStatePtr addDynamicRemoteState(std::string instanceName)
Function to add a new dynamic remote substate to this state.
Definition: State.cpp:200
armarx::StateBase::setParameter
void setParameter(StateParameterMap &paramMap, const std::string &key, const Variant &variant)
Definition: StateBase.cpp:662
armarx::State::getId
unsigned int getId() const
Returns an id to this state, that is guaranteed to be unique in this process.
Definition: State.cpp:91
armarx::StateController::RemoteState
friend class RemoteState
Definition: StateController.h:257
armarx::State::setStateClassNameFromTypeName
void setStateClassNameFromTypeName(const std::string &typeName)
Definition: State.cpp:360
armarx::StateUtility::createEvent
EventPtr createEvent()
Utility function to create a new Event.
Definition: StateUtil.h:64
armarx::StateBase::addParameterContainer
bool addParameterContainer(StateParameterMap &paramMap, const std::string &key, const ContainerType &containerType, bool optional, VariantContainerBasePtr defaultValue=VariantContainerBasePtr()) const
Definition: StateBase.cpp:602
armarx::StateBase::isParameterSet
bool isParameterSet(const StateParameterMap &paramMap, const std::string &key) const
Definition: StateBase.cpp:731
armarx::StateBase::getStatePhase
StatePhase getStatePhase() const
Definition: StateBase.cpp:844
armarx::State::addRemoteState
virtual RemoteStatePtr addRemoteState(std::string stateName, std::string proxyName, std::string instanceName="")
Function to add a new remote substate to this state.
Definition: State.cpp:151
armarx::State::addToOutput
bool addToOutput(const std::string &key, VariantTypeId type, bool optional)
Adds a key,type-pair to the output parameters.
Definition: State.cpp:287
armarx::State::getInitState
StateBasePtr getInitState() const
Getter for the initial state. The initial state is automatically entered, when this state is entered.
Definition: State.cpp:101
armarx::State::operator=
State & operator=(const State &source)
Definition: State.cpp:74
armarx::StateBase::eParametersDefinitions
@ eParametersDefinitions
Definition: StateBase.h:270
armarx::State::getInputParameters
StateParameterMap getInputParameters() override
Returns a new copy of the inputparameters-dictionary, so that the caller cannot modify them (const wo...
Definition: State.cpp:366
armarx::State::setInput
void setInput(std::string const &key, const Variant &value)
setInput() sets an input parameter.
Definition: State.cpp:390
armarx::StateBase::__checkPhase
void __checkPhase(StatePhase allowedType, const char *functionName) const
Helper function for checking if a function was called in valid position of the statechart.
Definition: StateBase.cpp:134
armarx::StateBase::impl
std::unique_ptr< Impl > impl
Definition: StateBase.h:258
armarx::State::isLocalParameterSet
bool isLocalParameterSet(const std::string &key) const
Definition: State.cpp:494
DynamicRemoteState.h
armarx::StateBase::findSubstateByName
StateBasePtr findSubstateByName(const std::string &substateName)
Utility function to find a substate of this state by the name.
Definition: StateBase.cpp:788
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::StatechartManager
Definition: StatechartManager.h:42
Application.h
armarx::State::Impl::outputParameterMutex
std::mutex outputParameterMutex
Definition: State.cpp:53
armarx::StateBase::getParameter
void getParameter(const StateParameterMap &paramMap, const std::string &key, VariantPtr &value) const
Definition: StateBase.cpp:801
armarx::StateController::DynamicRemoteState
friend class DynamicRemoteState
Definition: StateController.h:258
armarx::joinStrings
std::string joinStrings(std::vector< std::string > const &input, std::string const &seperator)
Definition: State.cpp:44
armarx::StateBase::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: StateBase.cpp:420