XMLState.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 ArmarX::
19 * @author Mirko Waechter ( mirko.waechter at kit dot edu)
20 * @date 2013
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24 
25 #include "XMLState.h"
29 #include <fstream>
30 
34 
37 
40 
41 #include <SimoxUtility/algorithm/string/string_tools.h>
42 
43 #include <filesystem>
44 
45 using namespace armarx;
46 using namespace rapidxml;
47 
48 
49 
50 
52 
54  XMLState(stateData)
55 
56 {
57 
58 }
59 
60 
61 
63 {
64  return XMLStateFactoryBasePtr(new NoUserCodeState(stateData));
65 }
66 
68 {
69  return "NoUserCodeState";
70 }
71 
73 {
74  return new NoUserCodeState(*this);
75 }
76 
77 VariantContainerBasePtr armarx::GetSelectedProfileValue(RapidXmlReaderNode parameterNode, StatechartProfilePtr selectedProfile, Ice::CommunicatorPtr ic, std::string defaultValueJsonString)
78 {
79  VariantContainerBasePtr result;
80  std::map<std::string, std::string> defaultValueMap;
81  for (RapidXmlReaderNode defaultValueNode : parameterNode.nodes("DefaultValue"))
82  {
83  if (defaultValueNode.has_attribute("profile"))
84  {
85  defaultValueMap.insert(std::make_pair(defaultValueNode.attribute_value("profile"), defaultValueNode.attribute_value("value")));
86  }
87  else
88  {
89  defaultValueJsonString = defaultValueNode.attribute_value("value");
90  }
91  }
92 
93  StatechartProfilePtr profile = selectedProfile;
94 
95  while (profile)
96  {
97  if (defaultValueMap.find(profile->getName()) != defaultValueMap.end())
98  {
99  defaultValueJsonString = defaultValueMap.at(profile->getName());
100  break;
101  }
102 
103  profile = profile->getParent();
104  }
105 
106  JSONObjectPtr json(new JSONObject(ic));
107 
108  if (!defaultValueJsonString.empty())
109  {
110  try
111  {
112  json->fromString(defaultValueJsonString);
113  result = VariantContainerBasePtr::dynamicCast(json->deserializeIceObject());
114 
115  if (!result)
116  {
117  ARMARX_WARNING_S << "Could not deserialize param: " << defaultValueJsonString;
118  }
119 
120  }
121  catch (JSONException& e)
122  {
123  ARMARX_WARNING_S << "Could not read default value for param: " << defaultValueJsonString;
124  }
125  }
126  return result;
127 }
128 
129 
131 {
132  name = parameterNode.attribute_value("name");
133  optional = parameterNode.attribute_value("optional") == "no" ? false : true;
134  typeStr = parameterNode.attribute_value("type");
136 
137  std::string defaultValueJsonString = parameterNode.attribute_value_or_default("default", "");
138 
139  container = GetSelectedProfileValue(parameterNode, selectedProfile, ic, defaultValueJsonString);
140 }
141 
143 {
144  return name;
145 }
146 
148 {
149  return optional;
150 }
151 
153 {
154  return typeStr;
155 }
156 
158 {
159  return typePtr;
160 }
161 
163 {
164  return container;
165 }
166 
167 
168 namespace armarx
169 {
170 
172  {
173  std::filesystem::path xmlFilepath;
179  };
180 }
181 
182 
183 
184 
186 {
187  setXMLStateData(stateData);
188 }
189 
190 void XMLState::setXMLStateData(const XMLStateConstructorParams& stateData)
191 {
192  privateStateData.reset(new PrivateXmlStateClass
193  {
194  stateData.xmlFilepath,
195  stateData.reader,
197  stateData.selectedProfile,
198  stateData.uuidToXMLMap,
199  nullptr
200  });
201 
202  if (!privateStateData->stateReader && privateStateData->xmlFilepath.empty())
203  {
204  throw LocalException("Either a xml node or a filepath must be given.");
205  }
206  else if (!privateStateData->stateReader)
207  {
208  privateStateData->stateNode = RapidXmlReader::FromFile(privateStateData->xmlFilepath.string())->getRoot("State");
209  }
210  else
211  {
212  privateStateData->stateNode = privateStateData->stateReader->getRoot("State");
213  privateStateData->xmlFilepath.clear();
214  }
215 }
216 
217 
218 
219 
221 {
222 }
223 
224 
226 {
227  return privateStateData->selectedProfile;
228 }
229 
230 
232 {
233  // ARMARX_INFO_S << "defineSubstates of " << State::getStateName();
234  if (!privateStateData->stateNode.is_valid())
235  {
236  return;
237  }
238  StatechartContext* context = StateBase::getContext<StatechartContext>();
239  if (!privateStateData->ic && context && context->getIceManager()->getCommunicator())
240  {
241  privateStateData->ic = context->getIceManager()->getCommunicator();
242  }
243 
244  this->StateBase::inputParameters = getParameters(privateStateData->stateNode.first_node("InputParameters"));
245  this->StateBase::outputParameters = getParameters(privateStateData->stateNode.first_node("OutputParameters"));
246  this->StateBase::localParameters = getParameters(privateStateData->stateNode.first_node("LocalParameters"));
247 
248 
249 }
250 
251 
253 {
254  StateParameterMap result;
255 
256  if (!parametersNode.is_valid())
257  {
258  return result;
259  }
260 
261 
262 
263  for (RapidXmlReaderNode curParameterNode : parametersNode.nodes("Parameter"))
264  {
265  StateParameterDeserialization deserialization(curParameterNode, privateStateData->ic, privateStateData->selectedProfile);
266 
267  try
268  {
269  StateBase::addParameterContainer(result, deserialization.getName(), *deserialization.getTypePtr(), deserialization.getOptional(), deserialization.getContainer());
270  // ARMARX_VERBOSE << "Adding param: " << name << ", " << VariantContainerType::allTypesToString(typePtr) << ", optional: " << optional;
271  // ARMARX_VERBOSE << "JSON: " << jsonString;
272  }
274  {
275  ARMARX_WARNING << "The type '" << deserialization.getTypeStr() << "' is unknown, Parameter '" << deserialization.getName() << "' not added";
276  }
277  }
278 
279  return result;
280 }
281 
282 
283 
285 {
286  ARMARX_DEBUG << "defineSubstates of " << State::getStateName();
287  if (!privateStateData->stateNode.is_valid())
288  {
289  ARMARX_WARNING << "stateNode is not valid!";
290 
291  return;
292  }
293 
294  const std::string stateName = privateStateData->stateNode.attribute_value("name");
295 
296  addXMLSubstates(privateStateData->stateNode.first_node("Substates"), stateName);
297 
298  addTransitions(privateStateData->stateNode.first_node("Transitions"));
299 
300  setStartState(privateStateData->stateNode.first_node("StartState"));
301 
302 }
303 
304 
305 
306 void XMLState::addXMLSubstates(RapidXmlReaderNode substatesNode, const std::string& parentStateName)
307 {
308  if (!substatesNode.is_valid())
309  {
310  return;
311  }
312 
313  for (RapidXmlReaderNode curSubstateNode = substatesNode.first_node();
314  curSubstateNode.is_valid();
315  curSubstateNode = curSubstateNode.next_sibling())
316  {
317  addXMLSubstate(curSubstateNode, parentStateName);
318 
319 
320  }
321 
322 }
323 
324 StateBasePtr XMLState::addXMLSubstate(RapidXmlReaderNode stateNode, const std::string& parentStateName)
325 {
326  ARMARX_CHECK_EXPRESSION(privateStateData->uuidToXMLMap);
327 
328  const std::string stateType = stateNode.name();
329 
330 
331 
332  StateBasePtr state;
333 
334  std::string stateTypeL = simox::alg::to_lower(stateType);
335 
336  if (stateTypeL == "localstate")
337  {
338  const std::string refuuid = stateNode.attribute_value("refuuid");
339  const std::string instanceName = stateNode.attribute_value("name");
340 
341  auto it = privateStateData->uuidToXMLMap->find(refuuid);
342 
343  if (it == privateStateData->uuidToXMLMap->end())
344  {
345  throw LocalException("Could not find local state with UUID ") << refuuid;
346  }
347 
348  RapidXmlReaderPtr substateReader = it->second;
349  const std::string stateName = substateReader->getRoot("State").attribute_value("name");
350  IceInternal::Handle<XMLState> xmlStateInstance = IceInternal::Handle<XMLState>::dynamicCast(XMLStateFactoryBase::fromName(stateName, XMLStateConstructorParams("", substateReader, privateStateData->selectedProfile, privateStateData->uuidToXMLMap, privateStateData->ic)));
351  state = StateBasePtr::dynamicCast(xmlStateInstance);
352 
353  if (!state)
354  {
355  ARMARX_DEBUG << "Using state with no code for " << stateName << " refuuid: " << refuuid << " instanceName: " << instanceName;
356  state = StateBasePtr::dynamicCast(NoUserCodeState::CreateInstance(XMLStateConstructorParams("", substateReader, privateStateData->selectedProfile, privateStateData->uuidToXMLMap, privateStateData->ic)));
357  // xmlStateInstance = IceInternal::Handle<XMLState>::dynamicCast(state);
358 
359  }
360  // xmlStateInstance->setXMLStateData(XMLStateConstructorParams("", substateReader, privateStateData->selectedProfile, privateStateData->uuidToXMLMap, privateStateData->ic));
361 
362  state->stateName = instanceName;
363  state = addState(StatePtr::dynamicCast(state));
364  ARMARX_DEBUG << "Added " << stateName << " with instanceName " << instanceName;
365 
366  }
367  else if (stateTypeL == "remotestate")
368  {
369  const std::string instanceName = stateNode.attribute_value("name");
370  const std::string refuuid = stateNode.attribute_value("refuuid");
371  const std::string proxyName = ((!privateStateData->selectedProfile->isRoot()) ? privateStateData->selectedProfile->getName() : "") + stateNode.attribute_value("proxyName");
372  ARMARX_DEBUG << "Adding remote state with refuuid " << refuuid << " and instance name: " << instanceName;
373  state = State::addRemoteState(refuuid, proxyName, instanceName);
374  }
375 
376  else if (stateTypeL == "dynamicremotestate")
377  {
378  const std::string instanceName = stateNode.attribute_value("name");
379  ARMARX_DEBUG << "Adding dynamic remote state with instance name: " << instanceName;
380  state = State::addDynamicRemoteState(instanceName);
381  }
382  else if (stateTypeL == "endstate")
383  {
384  const std::string eventName = stateNode.attribute_value("name");
385  ARMARX_DEBUG << "Adding end state with event " << eventName;
386  EventPtr evt = StateUtility::createEvent(eventName);
387  StatePtr state = FinalState<>::createState(evt);
388  state = addState(state);
389  }
390 
391  else
392  {
393  throw LocalException("Unknown state type in XML - found state type: ") << stateType;
394  }
395 
396  return state;
397 }
398 
399 
401 {
402 
403 
405 
406  if (State::findSubstateByName(state->stateName))
407  {
408  throw exceptions::local::eStatechartLogicError("There exists already a substate with name '" + state->StateBase::stateName + "' in this hierarchy level. In one hierarchy level (aka one substatelist) the names must be unique.");
409  }
410 
411  if (state->stateName.empty())
412  {
413  throw exceptions::local::eStatechartLogicError("The statename must not be empty");
414  }
415 
416 
417  state->__setParentState(this);
418  this->StateBase::subStateList.push_back(state);
419  StatechartContext* context = StateBase::getContext<StatechartContext>();
420  state->init(context, this->StateBase::impl->manager);
421 
422  return state;
423 }
424 
425 
426 
427 
428 
429 
430 void XMLState::addTransitions(const RapidXmlReaderNode& transitionsNode)
431 {
432 
433  if (!transitionsNode.is_valid())
434  {
435  ARMARX_WARNING << "transition node is not valid!";
436  return;
437  }
438 
439  for (RapidXmlReaderNode curTransitionNode = transitionsNode.first_node("Transition");
440  curTransitionNode.is_valid();
441  curTransitionNode = curTransitionNode.next_sibling("Transition"))
442  {
443  const std::string eventName = curTransitionNode.attribute_value("eventName");
444 
445  const std::string sourceStateName = curTransitionNode.attribute_value("from");
446 
447  if (!curTransitionNode.has_attribute("to"))
448  {
449  ARMARX_INFO << "Skipping detached transition " << eventName;
450  continue;
451  }
452 
453  const std::string destinationStateName = curTransitionNode.attribute_value("to");
454 
455 
456  StateBasePtr source = State::findSubstateByName(sourceStateName);
457  StateBasePtr destination = State::findSubstateByName(destinationStateName);
458 
459  if (!source)
460  {
461  throw LocalException("Could not find source state with name :") << sourceStateName;
462  }
463 
464  if (!destination)
465  {
466  throw LocalException("Could not find source state with name :") << destinationStateName;
467  }
468 
469  if (eventName.empty())
470  {
471  throw LocalException("Event name must not bet empty");
472  }
473 
474  EventPtr event = State::createEvent(eventName);
475  ARMARX_DEBUG << "Adding Transition on event " << eventName;
476  ParameterMappingPtr mappingToNextStateInput = getMapping(curTransitionNode.first_node("ParameterMappings"));
477  ParameterMappingPtr mappingsToParentsLocal = getMapping(curTransitionNode.first_node("ParameterMappingsToParentsLocal"));
478  ParameterMappingPtr mappingsToParentsOutput = getMapping(curTransitionNode.first_node("ParameterMappingsToParentsOutput"));
479 
480  State::addTransition(event, source, destination,
481  mappingToNextStateInput, mappingsToParentsLocal, mappingsToParentsOutput);
482  }
483 }
484 
485 
486 void XMLState::setStartState(const RapidXmlReaderNode& startNode)
487 {
488  if (!startNode.is_valid())
489  {
490  return;
491  }
492 
493  PMPtr mapping = getMapping(startNode.first_node("ParameterMappings"));
494  this->setInitState(State::findSubstateByName(startNode.attribute_value("substateName")),
495  mapping);
496 
497 }
498 
499 
500 ParameterMappingPtr XMLState::getMapping(const RapidXmlReaderNode& mappingNode)
501 {
502  if (!mappingNode.is_valid())
503  {
504  return nullptr;
505  }
506 
507  PMPtr mapping = PM::createMapping();
508 
509  for (RapidXmlReaderNode curMappingNode = mappingNode.first_node("ParameterMapping");
510  curMappingNode.is_valid();
511  curMappingNode = curMappingNode.next_sibling("ParameterMapping"))
512  {
513  MappingSource sourceType = PM::StringToMappingSource(curMappingNode.attribute_value("sourceType"));
514  const std::string fromParamName = curMappingNode.attribute_value("from");
515  const std::string targetParamName = curMappingNode.attribute_value("to");
516 
517  mapping->addMappingEntry(sourceType, fromParamName, targetParamName, GetSelectedProfileValue(curMappingNode, privateStateData->selectedProfile, privateStateData->ic));
518  }
519 
520  return mapping;
521 }
522 
524  : xmlFilepath(xmlFilepath),
525  reader(reader),
526  selectedProfile(selectedProfile),
527  uuidToXMLMap(uuidToXMLMap),
528  ic(ic)
529 {}
armarx::RapidXmlReaderPtr
std::shared_ptr< RapidXmlReader > RapidXmlReaderPtr
Definition: RapidXmlReader.h:66
armarx::RapidXmlReader::FromFile
static RapidXmlReaderPtr FromFile(const std::string &path)
Definition: RapidXmlReader.h:497
armarx::NoUserCodeState::CreateInstance
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
Definition: XMLState.cpp:62
armarx::ManagedIceObject::getIceManager
IceManagerPtr getIceManager() const
Returns the IceManager.
Definition: ManagedIceObject.cpp:353
cyberglove_with_calib_22dof.ic
ic
Definition: cyberglove_with_calib_22dof.py:22
armarx::StateParameterDeserialization::getTypePtr
ContainerTypePtr getTypePtr()
Definition: XMLState.cpp:157
armarx::PrivateXmlStateClass::uuidToXMLMap
StringXMLNodeMapPtr uuidToXMLMap
Definition: XMLState.cpp:177
JSONObject.h
armarx::StateParameterDeserialization::getTypeStr
std::string getTypeStr()
Definition: XMLState.cpp:152
armarx::XMLStateConstructorParams::selectedProfile
StatechartProfilePtr selectedProfile
Definition: XMLState.h:54
armarx::NoUserCodeState::GetName
static std::string GetName()
Definition: XMLState.cpp:67
armarx::StateParameterDeserialization::getName
std::string getName()
Definition: XMLState.cpp:142
armarx::XMLStateConstructorParams::XMLStateConstructorParams
XMLStateConstructorParams(const std::string &xmlFilepath, RapidXmlReaderPtr reader, StatechartProfilePtr selectedProfile, StringXMLNodeMapPtr uuidToXMLMap, Ice::CommunicatorPtr ic)
Definition: XMLState.cpp:523
StateBaseImpl.h
armarx::StateParameterDeserialization::typePtr
ContainerTypePtr typePtr
Definition: XMLState.h:87
armarx::XMLState::addState
StatePtr addState(StatePtr state)
Definition: XMLState.cpp:400
XMLState.h
armarx::ParameterMapping::createMapping
static ParameterMappingPtr createMapping()
Creates a new instance of a ParameterMapping. Since the constructors are private, this method must be...
Definition: ParameterMapping.cpp:539
armarx::StateParameterDeserialization::getContainer
VariantContainerBasePtr getContainer()
Definition: XMLState.cpp:162
armarx::JSONObject
The JSONObject class is used to represent and (de)serialize JSON objects.
Definition: JSONObject.h:43
armarx::RapidXmlReaderNode::NullNode
static RapidXmlReaderNode NullNode()
Definition: RapidXmlReader.h:119
armarx::XMLStateConstructorParams
Definition: XMLState.h:50
armarx::XMLState::defineSubstates
void defineSubstates() override
Virtual function, in which substates, transition and mappings can be added.
Definition: XMLState.cpp:284
armarx::XMLState::addXMLSubstate
StateBasePtr addXMLSubstate(RapidXmlReaderNode stateNode, const std::string &parentStateName)
Definition: XMLState.cpp:324
armarx::RapidXmlReaderNode::attribute_value
std::string attribute_value(const char *attrName) const
Definition: RapidXmlReader.h:198
armarx::AbstractFactoryMethod< XMLStateFactoryBase, XMLStateConstructorParams, XMLStateFactoryBasePtr >::fromName
static SharedPointerType fromName(const std::string &name, XMLStateConstructorParams params)
Function which can be used to retrieve an object specified by string name.
Definition: AbstractFactoryMethod.h:76
armarx::StatechartProfilePtr
std::shared_ptr< class StatechartProfile > StatechartProfilePtr
Definition: StatechartContext.h:52
armarx::StateParameterDeserialization::StateParameterDeserialization
StateParameterDeserialization(RapidXmlReaderNode const &parameterNode, Ice::CommunicatorPtr ic, StatechartProfilePtr selectedProfile)
Definition: XMLState.cpp:130
armarx::StateBase::getStateName
std::string getStateName() const
getStateName
Definition: StateBase.cpp:523
armarx::PrivateXmlStateClass::xmlFilepath
std::filesystem::path xmlFilepath
Definition: XMLState.cpp:173
armarx::NoUserCodeState::NoUserCodeState
NoUserCodeState(XMLStateConstructorParams stateData)
Definition: XMLState.cpp:53
armarx::NoUserCodeState::Registry
static SubClassRegistry Registry
Definition: XMLState.h:157
armarx::StateParameterDeserialization::container
VariantContainerBasePtr container
Definition: XMLState.h:88
armarx::StringXMLNodeMapPtr
std::shared_ptr< StringXMLNodeMap > StringXMLNodeMapPtr
Definition: XMLState.h:43
armarx::exceptions::local::eStatechartLogicError
Definition: Exception.h:30
armarx::XMLStateConstructorParams::xmlFilepath
std::string xmlFilepath
Definition: XMLState.h:52
IceInternal::Handle
Definition: forward_declarations.h:8
armarx::XMLState::~XMLState
~XMLState() override
Definition: XMLState.cpp:220
armarx::PrivateXmlStateClass::selectedProfile
StatechartProfilePtr selectedProfile
Definition: XMLState.cpp:176
armarx::RapidXmlReaderNode::name
std::string name() const
Definition: RapidXmlReader.h:349
armarx::State::setInitState
StateBasePtr setInitState(StateBasePtr initState, ParameterMappingPtr initialStateMapping=ParameterMappingPtr())
Sets the initial substate of this state.
Definition: State.cpp:319
armarx::StateParameterDeserialization::getOptional
bool getOptional()
Definition: XMLState.cpp:147
armarx::XMLState::getParameters
StateParameterMap getParameters(RapidXmlReaderNode parametersNode)
Definition: XMLState.cpp:252
armarx::PrivateXmlStateClass::stateReader
RapidXmlReaderPtr stateReader
Definition: XMLState.cpp:174
armarx::XMLState::XMLState
XMLState()
Definition: XMLState.h:101
armarx::ParameterMapping::StringToMappingSource
static MappingSource StringToMappingSource(const std::string &mappingSourceString)
Definition: ParameterMapping.cpp:295
armarx::XMLStateConstructorParams::reader
RapidXmlReaderPtr reader
Definition: XMLState.h:53
rapidxml
Definition: rapidxml.hpp:58
armarx::statechartmodel::StateParameterMap
QMap< QString, StateParameterPtr > StateParameterMap
Definition: StateParameter.h:46
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
UnknownTypeException.h
armarx::exceptions::user::UnknownTypeException
Definition: UnknownTypeException.h:36
armarx::State::addTransition
TransitionIceBase & addTransition(EventPtr event, StateIceBasePtr sourceState, StateIceBasePtr destinationState, ParameterMappingIceBasePtr mappingToNextStatesInput=nullptr, ParameterMappingIceBasePtr mappingToParentStatesLocal=nullptr, ParameterMappingIceBasePtr mappingToParentStatesOutput=nullptr)
Definition: State.cpp:232
RemoteState.h
StatechartProfiles.h
armarx::GetSelectedProfileValue
VariantContainerBasePtr GetSelectedProfileValue(RapidXmlReaderNode parameterNode, StatechartProfilePtr selectedProfile, Ice::CommunicatorPtr ic, std::string defaultValueJsonString="")
Definition: XMLState.cpp:77
armarx::FinalState::createState
static StatePtr createState(const EventPtr &event)
createState creates a finalstate instance with the specified event type.
Definition: FinalState.h:156
armarx::StateParameterDeserialization::typeStr
std::string typeStr
Definition: XMLState.h:86
IceManager.h
armarx::RapidXmlReaderNode
Definition: RapidXmlReader.h:68
armarx::XMLStateConstructorParams::uuidToXMLMap
StringXMLNodeMapPtr uuidToXMLMap
Definition: XMLState.h:55
armarx::XMLState
Definition: XMLState.h:96
boost::source
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:681
armarx::StateParameterDeserialization::optional
bool optional
Definition: XMLState.h:85
ARMARX_WARNING_S
#define ARMARX_WARNING_S
Definition: Logging.h:206
armarx::PrivateXmlStateClass::stateNode
RapidXmlReaderNode stateNode
Definition: XMLState.cpp:175
ExpressionException.h
armarx::XMLStateFactoryBasePtr
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
Definition: XMLState.h:65
armarx::StateParameterDeserialization::name
std::string name
Definition: XMLState.h:84
armarx::StateBase::eSubstatesDefinitions
@ eSubstatesDefinitions
Definition: StateBase.h:269
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_INFO
#define ARMARX_INFO
Definition: Logging.h:174
armarx::StateUtility::createEvent
EventPtr createEvent()
Utility function to create a new Event.
Definition: StateUtil.h:64
armarx::RapidXmlReaderNode::nodes
std::vector< RapidXmlReaderNode > nodes(const char *name=nullptr) const
Definition: RapidXmlReader.h:158
RapidXmlReader.h
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::RapidXmlReaderNode::is_valid
bool is_valid() const
Definition: RapidXmlReader.h:392
armarx::PrivateXmlStateClass::ic
Ice::CommunicatorPtr ic
Definition: XMLState.cpp:178
armarx::StateParameterDeserialization
Definition: XMLState.h:72
armarx::XMLState::addXMLSubstates
void addXMLSubstates(RapidXmlReaderNode substatesNode, const std::string &parentStateName)
Definition: XMLState.cpp:306
armarx::NoUserCodeState::clone
StateBasePtr clone() const override
Generates a new copy of this state with the same statename, substates, transitions,...
Definition: XMLState.cpp:72
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::XMLState::getSelectedProfile
StatechartProfilePtr getSelectedProfile() const
Definition: XMLState.cpp:225
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:186
rapidxml.hpp
armarx::XMLState::defineParameters
void defineParameters() override
Virtual function, in which input/local/output parameters can be specified.
Definition: XMLState.cpp:231
armarx::RapidXmlReaderNode::first_node
RapidXmlReaderNode first_node(const char *name=nullptr) const
Definition: RapidXmlReader.h:140
armarx::PrivateXmlStateClass
Definition: XMLState.cpp:171
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::VariantContainerType::FromString
static ContainerTypePtr FromString(const std::string &typeStr)
Definition: VariantContainer.cpp:262
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::RapidXmlReaderNode::attribute_value_or_default
std::string attribute_value_or_default(const char *attrName, const std::string &defaultValue) const
Definition: RapidXmlReader.h:225
FinalState.h