44 if (!eventProcessor._ptr)
46 eventProcessor =
impl->__parentState;
50 if ((eventProcessor.get() ==
impl->__parentState &&
52 (
impl->__parentState &&
impl->__parentState->activeSubstate.get() !=
this))
54 ARMARX_VERBOSE <<
"The state " << stateName <<
" is not active anymore - event '"
55 <<
event->eventName <<
"' omitted" << std::endl;
57 if (
impl->__parentState->activeSubstate)
60 <<
"Active state is now: "
61 << StateBasePtr::dynamicCast(
impl->__parentState->activeSubstate)->stateName;
72 StateControllerPtr::dynamicCast(eventProcessor);
74 if (eventController._ptr)
78 impl->manager->addEvent(event, eventController);
104 const std::string& desc)
113 if (!
impl->__parentState)
124 ConditionHandlerInterfacePrx conditionHandlerPrx = context->conditionHandlerPrx;
126 std::string uniqueEventIdentifier =
127 context->eventDistributor->registerEvent(evt, eventProcessor,
impl->visitCounter);
130 sentEvent->eventName = uniqueEventIdentifier;
132 ARMARX_DEBUG <<
"registered event: " << sentEvent->eventName
133 <<
", EventRecv:" << sentEvent->eventReceiverName <<
flush;
134 installedConditions.push_back(condition.
getImpl());
135 ConditionIdentifier condId = conditionHandlerPrx->installConditionWithDescription(
136 context->eventDistributor->getListener(),
143 __installedConditionIdentifiers.push_back(condId);
150 auto context = getContext<StatechartContext>();
158 context->conditionHandlerPrx->begin_removeCondition(conditionId);
167 ARMARX_INFO <<
"Installing Timeout Event (Timeout: " << timeoutDurationMs <<
"ms)" <<
flush;
179 if (!
impl->__parentState)
185 std::stringstream timerName;
186 timerName <<
"Timer_" << context->
getName() <<
"_" << stateName <<
"_"
187 <<
impl->localUniqueId <<
"_" << evt->eventName <<
"_" << timeoutDurationMs
192 ChannelRefPtr::dynamicCast(context->
systemObserverPrx->startTimer(timerName.str()));
193 __installedTimerChannelRefs.push_back(result.
actionId);
195 ChannelRefPtr::dynamicCast(result.
actionId)->getDataFieldIdentifier(
"elapsedMs"),
220 ARMARX_INFO <<
"Installing Counter Event (Counter Threshold: " << counterThreshold
221 <<
", InitialValue: " << initialValue <<
")" <<
flush;
233 if (!
impl->__parentState)
239 std::stringstream counterName;
240 counterName <<
"Counter_" << stateName <<
"_" <<
impl->localUniqueId <<
"_"
245 result.
actionId = ChannelRefPtr::dynamicCast(
247 __installedCounterChannelRefs.push_back(result.
actionId);
249 ChannelRefPtr::dynamicCast(result.
actionId)->getDataFieldIdentifier(
"value"),
270 StateUtility::checkEventIsHandled(
const EventPtr& event)
const
274 if (!
impl->__parentState)
279 for (
unsigned int i = 0; i <
impl->__parentState->transitions.size(); ++i)
281 TransitionIceBase& t =
impl->__parentState->transitions.at(i);
283 if (t.evt->eventName == event->eventName)
294 const StringVariantContainerBaseMap& properties)
297 evt->properties = properties;
302 StateUtility::_removeInstalledConditions()
307 ARMARX_INFO <<
"Statechart Context is NULL - cannot clear installed conditions";
310 for (
auto c : __installedConditionIdentifiers)
315 __installedConditionIdentifiers.clear();
317 for (
auto c : __installedTimerChannelRefs)
322 __installedTimerChannelRefs.clear();
324 for (
auto c : __installedCounterChannelRefs)
329 __installedCounterChannelRefs.clear();