38 std::unique_lock lock(updateMutex);
40 if (childs.size() != 1)
46 if ((!fired || !onlyFireOnce) && (!childs.at(0) || childs.at(0)->getValue()))
49 ARMARX_DEBUG_S <<
"Condition fulfilled, sending event " <<
event->eventName << std::endl;
52 event->properties.clear();
53 for (
const DatafieldRefBasePtr& ref : refs)
57 event->properties[r->getDataFieldIdentifier()->getIdentifierStr()] =
new SingleVariant(
data);
60 listener->begin_reportEvent(event);
62 catch (std::exception& e)
73 std::unique_lock lock(updateMutex);
75 if (childs.size() != 1)
81 if ((!fired || !onlyFireOnce) && (!childs.at(0) || childs.at(0)->getValue()))
84 ARMARX_VERBOSE_S <<
"Condition fulfilled, sending event with data " <<
event->eventName << std::endl;
88 event->properties.clear();
92 const Variant&
data = *VariantPtr::dynamicCast(
v.second);
94 ARMARX_INFO_S <<
v.first <<
" cond val: " << VariantPtr::dynamicCast(
v.second)->getOutputValueOnly();
96 for (
const DatafieldRefBasePtr& ref : refs)
99 auto id = r->getDataFieldIdentifier()->getIdentifierStr();
100 if (event->properties.count(
id) > 0)
106 ARMARX_INFO_S << r->getDataFieldIdentifier()->getIdentifierStr() <<
" val: " << r->getDataField()->getOutputValueOnly();
110 listener->begin_reportEvent(event);
112 catch (std::exception& e)
123 out <<
"Event: " <<
event->eventName <<
" - ";
125 if (childs.size() > 0)
127 out <<
"Expression: " << TermImplPtr::dynamicCast(childs.at(0));
133 type = eConditionRoot;
136 ConditionRoot::ConditionRoot(
const EventListenerInterfacePrx& listener,
const EventBasePtr& event,
const std::string& description,
bool onlyFireOnce,
const DatafieldRefList& refs)
138 type = eConditionRoot;
139 this->listener = listener->ice_collocationOptimized(
false);
141 this->description = description;
142 this->onlyFireOnce = onlyFireOnce;
148 std::list<TermImplPtr> terms;
149 std::vector<LiteralImplPtr> literals;
151 terms.push_back(TermImplPtr::dynamicCast(expression));
153 while (terms.size() != 0)
160 if (term->getType() == eLiteral)
162 literals.push_back(LiteralImplPtr::dynamicCast(term));
167 TermImplSequence childs = term->getChilds();
168 TermImplSequence::iterator iterChilds = childs.begin();
170 while (iterChilds != childs.end())
172 terms.push_back(TermImplPtr::dynamicCast(*iterChilds));