IceStateConverter.cpp
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package ArmarX::
17 * @author Clara Scherer
18 * @date 2014
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 #include <QMap>
24 #include <QString>
25 
26 #include <algorithm>
27 #include <cassert>
28 #include <string>
29 #include <utility>
30 #include <vector>
31 
32 #include <ArmarXCore/interface/statechart/RemoteStateIce.h>
33 
35 
36 #include "IceStateConverter.h"
37 #include "model/State.h"
40 
41 #include <cmath>
42 
44 {
45  topState.reset(new statechartmodel::LocalState(state, state->getStateName()));
46 }
47 
49 {
50 }
51 
52 
53 void armarx::IceStateConverter::convert(armarx::StateIceBasePtr iceBase)
54 {
55  convert(iceBase, topState);
56 }
57 
59 {
60  return topState;
61 }
62 
64 {
65  this->watcher = watcher;
66 }
67 
68 std::map<std::string, std::pair<armarx::statechartmodel::StateInstancePtr, armarx::StateIceBasePtr>> armarx::IceStateConverter::getCompleteStateMap() const
69 {
70  return completeStateMap;
71 }
72 
73 void armarx::IceStateConverter::convert(armarx::StateIceBasePtr iceBase, armarx::statechartmodel::StateInstancePtr modelState)
74 {
75  if (watcher && modelState->getStateClass())
76  {
77  if (!watcher->subscribeToState(iceBase, modelState->getStateClass()))
78  {
79  ARMARX_WARNING_S << "subscribing failed";
80  }
81  }
82  // ARMARX_LOG_S << "Converting state " << modelState->getStateName();
83 
84  if (stateEqual(iceBase, modelState))
85  {
86  updateState(iceBase, modelState);
87  }
88  else
89  {
90  ARMARX_INFO_S << "State " << iceBase->stateName << " could not be recognized - resetting";
91  resetState(iceBase, modelState);
92  }
93 
94  StateList iceSubstates = iceBase->subStateList;
95  std::sort(iceSubstates.begin(), iceSubstates.end(), &armarx::IceStateConverter::compareIceStates);
96 
97  statechartmodel::StateInstanceMap modelSubstates;
98  if (modelState->getStateClass())
99  {
100  modelSubstates = modelState->getStateClass()->getSubstates();
101  }
102 
103  assert(iceSubstates.size() == static_cast<size_t>(modelSubstates.size()));
104 
105  using modelSubstateIter = statechartmodel::StateInstanceMap::const_iterator;
106  StateList::const_iterator iceIter = iceSubstates.begin();
107  modelSubstateIter modelIter = modelSubstates.begin();
108 
109  for (; iceIter != iceSubstates.end(); iceIter++, modelIter++)
110  {
111  convert(StateIceBasePtr::dynamicCast(*iceIter), modelIter.value());
112  }
113 }
114 
115 bool armarx::IceStateConverter::stateEqual(armarx::StateIceBasePtr iceBase, armarx::statechartmodel::StateInstancePtr modelState)
116 {
117  if (!modelState)
118  {
119  return true;
120  }
121  // ARMARX_CHECK_EXPRESSION(modelState) << iceBase->stateName;
122  if (!modelState || iceBase->stateName.c_str() != modelState->getInstanceName())
123  {
124  if (!modelState->getStateClass() && iceBase->transitions.size() > 0)
125  {
126  return false;
127  }
128  if (modelState->getStateClass() && !sameTransitions(iceBase, modelState->getStateClass()))
129  {
130  return false;
131  }
132  }
133 
134  return true;
135 }
136 
137 bool armarx::IceStateConverter::sameTransitions(armarx::StateIceBasePtr iceBase, armarx::statechartmodel::StatePtr modelState)
138 {
139  if (static_cast<size_t>(modelState->getTransitions().size()) != iceBase->transitions.size())
140  {
141  return false;
142  }
143 
144  assert(static_cast<size_t>(modelState->getTransitions().size()) == iceBase->transitions.size());
145 
146  std::pair<stringVector, stringVector> sortedTransitions = sortTransitionNames(iceBase->transitions, modelState->getTransitions());
147  stringVector iceTransitions = sortedTransitions.first;
148  stringVector modelTransitions = sortedTransitions.second;
149 
150  using stringIter = stringVector::const_iterator;
151  std::pair<stringIter, stringIter> mismatch;
152  mismatch = std::mismatch<stringIter, stringIter>(iceTransitions.begin(), iceTransitions.end(), modelTransitions.begin());
153 
154  if (mismatch.first == iceTransitions.end()) //all transitions have matched
155  {
156  return true;
157  }
158 
159  return false;
160 }
161 
162 
163 void armarx::IceStateConverter::updateTransitions(armarx::StateIceBasePtr iceBase, armarx::statechartmodel::StatePtr modelState)
164 {
165  if (modelState->getTransitions().empty())
166  {
167  resetTransitions(iceBase, modelState);
168  return;
169  }
170 
171  TransitionTable iceTransitions = iceBase ->transitions;
172  statechartmodel::CTransitionList modelTransitions = modelState->getTransitions();
173 
174  //check for new transitions
175  foreach (TransitionIceBase newTrans, iceTransitions)
176  {
177  //transitions from all don't have a source state specified
178  if (!newTrans.sourceState)
179  {
180  updateTransitionFromAll(newTrans, modelState);
181  }
182  else
183  {
184  updateSingleTransition(newTrans, modelState);
185  }
186  }
187 
188  //check for old transitions
189  foreach (auto oldTrans, modelTransitions)
190  {
191  bool found = false;
192 
193  foreach (auto newTrans, iceTransitions)
194  {
195  if (newTrans.evt->eventName == oldTrans->eventName.toStdString())
196  {
197  found = true;
198  break;
199  }
200  }
201 
202  if (!found)
203  {
204  //remove the transition from the model
205  modelState->removeTransition(modelState->findTransition(oldTrans));
206  }
207  }
208 }
209 
210 void armarx::IceStateConverter::updateSubstates(armarx::StateIceBasePtr iceBase, armarx::statechartmodel::StatePtr modelState)
211 {
212  using modelSubstateIter = statechartmodel::StateInstanceMap::const_iterator;
213 
214  statechartmodel::StateInstanceMap modelSubstates = modelState->getSubstates();
215  if (modelSubstates.empty())
216  {
217  resetSubstates(iceBase, modelState);
218  return;
219  }
220 
221  StateList iceSubstates = iceBase->subStateList;
222  std::sort(iceSubstates.begin(), iceSubstates.end(), &armarx::IceStateConverter::compareIceStates);
223 
224 
225  StateList::const_iterator iceIter = iceSubstates.begin();
226  modelSubstateIter modelIter = modelSubstates.begin();
227 
228  while ((iceIter != iceSubstates.end()) || (modelIter != modelSubstates.end()))
229  {
230  // ARMARX_CHECK_EXPRESSION(modelIter.value()->getStateClass()) << (*iceIter)->stateName;
231  //TODO:StateInstance name oder Statename für Identifikation benutzen?
232  //momentan wird Name des States benutzt
233  if ((iceIter != iceSubstates.end()) && ((modelIter == modelSubstates.end()) || ((*iceIter)->stateName.c_str() < modelIter.value()->getInstanceName())))
234  //a substate from ice is missing in the model
235  {
236  //insert new substate
238  newSubstate->setStateName((*iceIter)->stateName.c_str());
239  // newSubstate->setActive(false);
240  statechartmodel::StateInstancePtr instance = statechartmodel::StateInstanceFactory::CreateFromIceType((*iceIter)->stateType, newSubstate, (*iceIter)->stateName.c_str(), modelState);
241  modelState->addSubstate(instance);
242  //name of stateInstance is initialized to be the same as the correspoding state's name
243 
244  iceIter++;
245  continue;
246  }
247 
248  if ((modelIter != modelSubstates.end()) && ((iceIter == iceSubstates.end()) || (*iceIter)->stateName.c_str() > modelIter.value()->getInstanceName()))
249  //a substate in the model is not found in ice anymore
250  {
251  //substate löschen
252  modelState->removeSubstate(modelIter.key());
253 
254  modelIter++;
255  continue;
256  }
257 
258  // if (watcher /*&& (*iceIter)->subStateList.size() > 0*/)
259  // {
260  // if (!watcher->subscribeToState(*iceIter, (*modelIter)->getStateClass()))
261  // {
262  // ARMARX_WARNING_S << "subscribing failed";
263  // }
264  // }
265 
266  iceIter++;
267  modelIter++;
268  continue;
269  }
270 }
271 
272 armarx::statechartmodel::StateParameterMap armarx::IceStateConverter::convertToModelParameterMap(armarx::StateParameterMap iceMap)
273 {
275 
276 
277  for (StateParameterMap::const_iterator iter = iceMap.begin(); iter != iceMap.end(); iter++)
278  {
280 
281  modelMap.insert((*iter).first.c_str(), param);
282  }
283 
284  return modelMap;
285 }
286 
287 std::pair<armarx::IceStateConverter::stringVector, armarx::IceStateConverter::stringVector> armarx::IceStateConverter::sortTransitionNames(armarx::TransitionTable iceTransitions,
289 {
290  stringVector eventsOfIceTransitions;
291 
292  for (TransitionTable::const_iterator iceIter = iceTransitions.begin() ; iceIter != iceTransitions.end(); iceIter++)
293  {
294  eventsOfIceTransitions.push_back((*iceIter).evt->eventName);
295  }
296 
297  std::sort(eventsOfIceTransitions.begin(), eventsOfIceTransitions.end());
298 
299  stringVector eventsOfModelTransitions;
300 
301  for (statechartmodel::CTransitionList::const_iterator modelIter = modelTransitions.begin() ; modelIter != modelTransitions.end(); modelIter++)
302  {
303  eventsOfModelTransitions.push_back((*modelIter)->eventName.toStdString());
304  }
305 
306  std::sort(eventsOfModelTransitions.begin(), eventsOfModelTransitions.end());
307 
308  return make_pair(eventsOfIceTransitions, eventsOfModelTransitions);
309 }
310 
311 bool armarx::IceStateConverter::compareIceStates(armarx::AbstractStateIceBasePtr l, armarx::AbstractStateIceBasePtr r)
312 {
313  return l->stateName < r->stateName;
314 }
315 
316 armarx::statechartmodel::StateInstancePtr armarx::IceStateConverter::findSubstateByName(statechartmodel::StatePtr state, QString name)
317 {
318  //search for stateinstance with this name among the substates of modelState
319  statechartmodel::StateInstanceMap::const_iterator substateIter = state->getSubstates().find(name);
320 
321  if (substateIter != state->getSubstates().end())
322  {
323  return *substateIter;
324  }
325 
326  ARMARX_ERROR_S << "substate " << name << " provided by ice is not found among the substates of "
327  << state->getStateName().toStdString();
329 }
330 
331 void armarx::IceStateConverter::updateStartState(armarx::StateIceBasePtr iceBase, armarx::statechartmodel::StatePtr modelState)
332 {
333  //requires that names of substates are distinct for one state
334  if (iceBase->initState && modelState->getStartState()
335  && (iceBase->initState->stateName.c_str() == modelState->getStartState()->getInstanceName()))
336  {
337  return;
338  //no need for change if both model- and ice-startState exist and have the same name.
339  }
340  else
341  {
342  resetStartState(iceBase, modelState);
343  }
344 }
345 
346 void armarx::IceStateConverter::updateActiveSubstate(armarx::StateIceBasePtr iceBase, armarx::statechartmodel::StatePtr modelState)
347 {
348  if (!modelState || !iceBase)
349  {
350  return;
351  }
352  if (iceBase->activeSubstate && modelState->getActiveSubstate()
353  && (iceBase->activeSubstate->stateName.c_str() == modelState->getActiveSubstate()->getInstanceName()))
354  {
355  return;
356  //no need to change anything if both active substates exist and are the same
357  }
358  else
359  {
360  // ARMARX_INFO_S << "Resetting ActiveSubstate of" << iceBase->stateName;
361  resetActiveSubstate(iceBase, modelState);
362  }
363 }
364 
365 void armarx::IceStateConverter::updateStateAttributes(armarx::StateIceBasePtr iceBase, armarx::statechartmodel::StateInstancePtr modelState)
366 {
367  if (iceBase->stateName.c_str() != modelState->getInstanceName())
368  {
369  resetStateAttributes(iceBase, modelState);
370  }
371 }
372 
373 void armarx::IceStateConverter::updateTransitionFromAll(armarx::TransitionIceBase newTrans, armarx::statechartmodel::StatePtr modelState)
374 {
375  // ARMARX_INFO_S << newTrans.evt->eventName << " is a transition from all.";
376 
377  statechartmodel::CTransitionList modelTransitions = modelState->getTransitions();
378 
379  if (!newTrans.destinationState)
380  {
381  ARMARX_ERROR_S << "Transitions from all cannot be detached";
382  return;
383  }
384  statechartmodel::StateInstancePtr destination = findSubstateByName(modelState, newTrans.destinationState->stateName.c_str());
385 
386  //iterate over all substates and test whether they have a fitting transition
387  foreach (statechartmodel::StateInstancePtr substate, modelState->getSubstates())
388  {
389  bool transFound = false;
390  foreach (statechartmodel::TransitionCPtr oldTrans, modelTransitions)
391  {
392  if ((newTrans.evt->eventName == oldTrans->eventName.toStdString())
393  && (substate == oldTrans->sourceState))
394  {
395  transFound = true;
396 
397  //update destination state if necessary
398  if (!(oldTrans->destinationState) || (newTrans.destinationState->stateName != oldTrans->destinationState->getInstanceName().toStdString()))
399  {
400  modelState->updateTransitionDestination(oldTrans, destination);
401  }
402 
403  break;
404  }
405  }
406 
407  if (!transFound)
408  {
409  //create new model Transition to insert
410  statechartmodel::TransitionPtr transition(new statechartmodel::Transition());
411 
412  transition->eventName = newTrans.evt->eventName.c_str();
413  transition->sourceState = substate;
414  transition->destinationState = destination;
415 
416  modelState->addTransition(transition);
417  }
418  }
419 }
420 
421 void armarx::IceStateConverter::updateSingleTransition(armarx::TransitionIceBase newTrans, armarx::statechartmodel::StatePtr modelState)
422 {
423  statechartmodel::CTransitionList modelTransitions = modelState->getTransitions();
424 
425  bool found = false;
426 
427  foreach (statechartmodel::TransitionCPtr oldTrans, modelTransitions)
428  {
429  //it is assumed that a transition is uniquely identified by its source and event
430  if ((newTrans.evt->eventName == oldTrans->eventName.toStdString()))
431  {
432  found = true;
433 
434  //update destination state if necessary
435  if (newTrans.destinationState)
436  {
437  if (!(oldTrans->destinationState) || (newTrans.destinationState->stateName != oldTrans->destinationState->getInstanceName().toStdString()))
438  {
439  modelState->updateTransitionDestination(oldTrans, findSubstateByName(modelState, newTrans.destinationState->stateName.c_str()));
440  }
441  }
442  else
443  {
444  if (oldTrans->destinationState)
445  {
446  modelState->detachTransitionDestination(oldTrans);
447  }
448  }
449 
450  break;
451  }
452  }
453 
454  if (!found)
455  {
456  //create new model Transition to insert
457  statechartmodel::TransitionPtr transition(new statechartmodel::Transition());
458  transition->eventName = newTrans.evt->eventName.c_str();
459 
460  transition->sourceState = findSubstateByName(modelState, newTrans.sourceState->stateName.c_str());
461 
462  if (newTrans.destinationState) //transitions can be detached, i.e. not have a destination state
463  {
464  transition->destinationState = findSubstateByName(modelState, newTrans.destinationState->stateName.c_str());
465  modelState->addTransition(transition);
466  }
467  else
468  {
469  modelState->addDetachedTransition(transition->eventName, transition->sourceState);
470  }
471  }
472 }
473 
474 void armarx::IceStateConverter::resetTransitions(armarx::StateIceBasePtr iceBase, armarx::statechartmodel::StatePtr modelState)
475 {
476  statechartmodel::TransitionList newTransitionList;
477  statechartmodel::TransitionList detachedTransitionList;
478 
479  for (TransitionTable::const_iterator iceIter = iceBase->transitions.begin(); iceIter != iceBase->transitions.end(); iceIter++)
480  {
481  statechartmodel::TransitionPtr transition(new statechartmodel::Transition());
482  transition->eventName = (*iceIter).evt->eventName.c_str();
483 
484  bool detached = false;
485 
486  //transitions from all have no sourceState
487  if (!((*iceIter).sourceState))
488  {
489  if (!((*iceIter).destinationState))
490  {
491  ARMARX_ERROR_S << "Transition from all states: " << transition->eventName << " doesn't have a destination state.";
492  continue;
493  }
494  statechartmodel::StateInstancePtr destination = findSubstateByName(modelState, (*iceIter).destinationState->stateName.c_str());
495 
496  foreach (statechartmodel::StateInstancePtr substate, modelState->getSubstates())
497  {
498  statechartmodel::TransitionPtr newTransition(new statechartmodel::Transition());
499  newTransition->eventName = transition->eventName;
500  newTransition->sourceState = substate;
501  newTransition->destinationState = destination;
502 
503  newTransitionList.push_back(newTransition);
504  }
505  }
506  else
507  {
508  transition->sourceState = findSubstateByName(modelState, (*iceIter).sourceState->stateName.c_str());
509 
510  if ((*iceIter).destinationState)
511  {
512  transition->destinationState = findSubstateByName(modelState, (*iceIter).destinationState->stateName.c_str());
513  }
514  else
515  {
516  detached = true;
517  }
518 
519  //TODO: also set parameter mapping
520  if (detached)
521  {
522  detachedTransitionList.push_back(transition);
523  }
524  else
525  {
526  newTransitionList.push_back(transition);
527  }
528  }
529  }
530 
531  modelState->replaceTransitions(newTransitionList);
532 
533  foreach (statechartmodel::TransitionPtr trans, detachedTransitionList)
534  {
535  modelState->addDetachedTransition(trans->eventName, trans->sourceState);
536  }
537 }
538 
539 void armarx::IceStateConverter::resetSubstates(armarx::StateIceBasePtr iceBase, armarx::statechartmodel::StatePtr modelState)
540 {
541  statechartmodel::StateInstanceMap newSubstateList;
542 
543  for (StateList::const_iterator iceIter = iceBase->subStateList.begin(); iceIter != iceBase->subStateList.end(); iceIter++)
544  {
546  newSubstate->setStateName((*iceIter)->stateName.c_str());
547  // newSubstate->setActive(false);
548  QString proxyName;
549  armarx::RemoteStateIceBasePtr remoteState = armarx::RemoteStateIceBasePtr::dynamicCast(*iceIter);
550  if (remoteState)
551  {
552  proxyName = QString::fromStdString(remoteState->proxyName);
553  }
554  statechartmodel::StateInstancePtr instance = statechartmodel::StateInstanceFactory::CreateFromIceType((*iceIter)->stateType, newSubstate, (*iceIter)->stateName.c_str(), modelState, proxyName);
555  // statechartmodel::StateInstancePtr instance(new statechartmodel::LocalState(newSubstate, (*iceIter)->stateName.c_str(), modelState));
556 
557  instance->inputParameters = (*iceIter)->inputParameters;
558  newSubstateList.insert((*iceIter)->stateName.c_str(), instance);
559 
560  if (watcher && StateIceBasePtr::dynamicCast(*iceIter)->subStateList.size() > 0)
561  {
562  if (!watcher->subscribeToState(StateIceBasePtr::dynamicCast(*iceIter), newSubstate))
563  {
564  ARMARX_INFO_S << "subscribing failed";
565  }
566  }
567  resetState(StateIceBasePtr::dynamicCast(*iceIter), instance);
568  //name of stateInstance is initialized to be the same as the correspoding state's name
569  }
570 
571  modelState->replaceSubstates(newSubstateList);
572 }
573 
574 void armarx::IceStateConverter::resetParameters(armarx::StateIceBasePtr iceBase, armarx::statechartmodel::StatePtr modelState)
575 {
576  modelState->setInputParameters(convertToModelParameterMap(iceBase->inputParameters));
577  modelState->setLocalParameters(convertToModelParameterMap(iceBase->localParameters));
578  modelState->setOutputParameters(convertToModelParameterMap(iceBase->outputParameters));
579 }
580 
581 void armarx::IceStateConverter::resetStartState(armarx::StateIceBasePtr iceBase, armarx::statechartmodel::StatePtr modelState)
582 {
583  if (iceBase->initState) //test whether ice state has an active substate
584  {
585  modelState->setStartState(findSubstateByName(modelState, iceBase->initState->stateName.c_str()));
586  }
587  else //modelState still has an active substate but iceBase doesn't
588  {
589  modelState->setStartState(statechartmodel::StateInstancePtr());
590  }
591 }
592 
593 void armarx::IceStateConverter::resetActiveSubstate(armarx::StateIceBasePtr iceBase, armarx::statechartmodel::StatePtr modelState)
594 {
595  if (iceBase->activeSubstate) //test whether ice state has an active substate
596  {
597 
598  statechartmodel::StateInstancePtr activeSubstate = findSubstateByName(modelState, iceBase->activeSubstate->stateName.c_str());
599  modelState->setActiveSubstate(activeSubstate);
600 
601  }
602  else //modelState still has an active substate but iceBase doesn't
603  {
604  modelState->setActiveSubstate(statechartmodel::StateInstancePtr());
605  }
606 }
607 
608 void armarx::IceStateConverter::resetStateAttributes(armarx::StateIceBasePtr iceBase, armarx::statechartmodel::StateInstancePtr modelState)
609 {
610  modelState->setInstanceName(iceBase->stateName.c_str());
611  if (modelState->getStateClass())
612  {
613  modelState->getStateClass()->setStateName(iceBase->stateClassName.c_str());
614  }
615  int subStateCount = modelState->getStateClass() ? modelState->getStateClass()->getSubstates().size() : 0;
616  float sizeFactor = pow(subStateCount, 0.7);
617  sizeFactor = std::max(sizeFactor, 1.0f);
618  modelState->setBoundingBox(sizeFactor * modelState->defaultBoundingSquareSize);
619 }
620 
621 void armarx::IceStateConverter::resetState(armarx::StateIceBasePtr iceBase, armarx::statechartmodel::StateInstancePtr modelState)
622 {
623  completeStateMap[iceBase->globalStateIdentifier] = std::make_pair(modelState, iceBase);
624 
625 
626  if (modelState->getStateClass())
627  {
628  auto stateClass = modelState->getStateClass();
629  resetParameters(iceBase, stateClass);
630  resetSubstates(iceBase, stateClass);
631  resetTransitions(iceBase, stateClass);
632  resetActiveSubstate(iceBase, stateClass);
633  resetStartState(iceBase, stateClass);
634  }
635 
636  resetStateAttributes(iceBase, modelState);
637 
638 }
639 
640 void armarx::IceStateConverter::updateState(armarx::StateIceBasePtr iceBase, statechartmodel::StateInstancePtr modelState)
641 {
642  updateStateAttributes(iceBase, modelState);
643 
644 
645  if (modelState->getStateClass())
646  {
647  auto stateClass = modelState->getStateClass();
648  updateSubstates(iceBase, stateClass);
649  if (!sameTransitions(iceBase, stateClass))
650  {
651  // ARMARX_INFO_S << "Updating transitions of" << iceBase->stateName;
652  updateTransitions(iceBase, stateClass);
653  }
654 
655  resetParameters(iceBase, stateClass);
656  updateActiveSubstate(iceBase, stateClass);
657  updateStartState(iceBase, stateClass);
658  }
659 }
660 
661 bool armarx::IceStateConverter::transitionEqual(armarx::TransitionIceBase iceTransition,
663 {
664  if (iceTransition.evt->eventName.c_str() == modelTransition->eventName)
665  {
666  return false;
667  }
668 
669  return true;
670 }
armarx::statechartmodel::StateParameter::FromIceStateParameter
static statechartmodel::StateParameterPtr FromIceStateParameter(armarx::StateParameterIceBasePtr param)
Definition: StateParameter.cpp:61
armarx::statechartmodel::TransitionPtr
std::shared_ptr< Transition > TransitionPtr
Definition: Transition.h:93
armarx::statechartmodel::StateInstanceFactory::CreateFromIceType
static StateInstancePtr CreateFromIceType(eStateType type, StatePtr stateClass, const QString &instanceName, StatePtr parentState=StatePtr(), const QString &proxyName="")
Definition: StateInstanceFactory.h:38
armarx::IceStateConverter::convert
void convert(StateIceBasePtr iceBase)
Converts the given ice model into a statechartmodel.
armarx::convert
armem::articulated_object::ArticulatedObject convert(const VirtualRobot::Robot &obj, const armem::Time &timestamp)
Definition: ArticulatedObjectLocalizerDynamicSimulation.cpp:194
armarx::statechartmodel::StateInstancePtr
std::shared_ptr< StateInstance > StateInstancePtr
Definition: StateInstance.h:138
armarx::IceStateConverter::~IceStateConverter
~IceStateConverter()
Definition: IceStateConverter.cpp:48
IceInternal::Handle< StateWatcher >
armarx::statechartmodel::StateInstanceMap
QMap< QString, StateInstancePtr > StateInstanceMap
Definition: State.h:50
armarx::IceStateConverter::getCompleteStateMap
std::map< std::string, std::pair< statechartmodel::StateInstancePtr, StateIceBasePtr > > getCompleteStateMap() const
Definition: IceStateConverter.cpp:68
armarx::statechartmodel::StateParameterMap
QMap< QString, StateParameterPtr > StateParameterMap
Definition: StateParameter.h:46
ARMARX_ERROR_S
#define ARMARX_ERROR_S
Definition: Logging.h:209
KITProsthesis::ProsthesisState::State
State
Definition: KITProstheticHandInterface.ice:32
LocalState.h
max
T max(T t1, T t2)
Definition: gdiam.h:48
armarx::statechartmodel::StateParameterPtr
std::shared_ptr< StateParameter > StateParameterPtr
Definition: StateParameter.h:45
IceStateConverter.h
armarx::IceStateConverter::setStateWatcher
void setStateWatcher(StateWatcherPtr watcher)
Definition: IceStateConverter.cpp:63
ARMARX_WARNING_S
#define ARMARX_WARNING_S
Definition: Logging.h:206
StateInstance.h
armarx::statechartmodel::CTransitionList
QList< TransitionCPtr > CTransitionList
Definition: State.h:49
armarx::statechartmodel::TransitionList
QList< TransitionPtr > TransitionList
Definition: State.h:48
StateInstanceFactory.h
armarx::statechartmodel::TransitionCPtr
std::shared_ptr< const Transition > TransitionCPtr
Definition: Transition.h:94
armarx::IceStateConverter::getTopState
statechartmodel::StateInstancePtr getTopState()
getTopState Returns the top state of the internal model that was converted from an ice model.
Definition: IceStateConverter.cpp:58
armarx::statechartmodel::StatePtr
std::shared_ptr< State > StatePtr
Definition: State.h:46
armarx::IceStateConverter::IceStateConverter
IceStateConverter(statechartmodel::StatePtr state=statechartmodel::StatePtr(new statechartmodel::State()))
IceStateConverter Creates a converter whose model's top state is state.
Definition: IceStateConverter.cpp:43
ARMARX_INFO_S
#define ARMARX_INFO_S
Definition: Logging.h:195
armarx::statechartmodel::LocalState
Definition: LocalState.h:31
State.h