本文整理汇总了C++中devs::ExternalEventList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ ExternalEventList::begin方法的具体用法?C++ ExternalEventList::begin怎么用?C++ ExternalEventList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类devs::ExternalEventList
的用法示例。
在下文中一共展示了ExternalEventList::begin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: externalTransition
virtual void externalTransition(
const devs::ExternalEventList& event ,
const devs::Time& time)
{
for (vd::ExternalEventList::const_iterator it = event.begin();
it != event.end(); ++it) {
if ((*it)->onPort("surveillance")) {
Intervention newIntervention;
value::Map infNodes = (*it)->getMapAttributeValue("infectedNodes");
for (vv::MapValue::const_iterator node = infNodes.begin();
node != infNodes.end(); node++) {
m_nodeStates[node->first] = node->second->toString().value();
newIntervention.second.push_back(node->first);
}
newIntervention.first = time.getValue() + m_delay;
m_interventions.push_back(newIntervention);
if (m_phase == IDLE)
m_phase = CONTROL;
/*
else {
vle::utils::InternalError error(
"\nControler must recieve only one surveillance repport in this version\n");
throw error;
}
*/
}
}
m_current_time = time.getValue();
}
示例2: externalTransition
void Moore::externalTransition(const devs::ExternalEventList& events,
devs::Time /* time */)
{
// mNewStates.clear();
if (events.size() > 1) {
devs::ExternalEventList sortedEvents = select(events);
devs::ExternalEventList* clonedEvents =
new devs::ExternalEventList;
devs::ExternalEventList::const_iterator it = sortedEvents.begin();
while (it != sortedEvents.end()) {
clonedEvents->emplace_back(it->getPortName());
devs::ExternalEvent& e = clonedEvents->back();
copyExternalEventAttrs(*it, e);
++it;
}
mToProcessEvents.push_back(clonedEvents);
} else {
devs::ExternalEventList::const_iterator it = events.begin();
devs::ExternalEventList* clonedEvents =
new devs::ExternalEventList;
clonedEvents->emplace_back(it->getPortName());
devs::ExternalEvent& e = clonedEvents->back();
copyExternalEventAttrs(*it, e);
mToProcessEvents.push_back(clonedEvents);
}
mPhase = PROCESSING;
}
示例3: externalTransition
void Agent::externalTransition(
const devs::ExternalEventList& events,
const devs::Time& time)
{
mCurrentTime = time;
for (devs::ExternalEventList::const_iterator it = events.begin();
it != events.end(); ++it) {
const std::string& port((*it)->getPortName());
const value::Map& atts = (*it)->getAttributes();
if (port == "ack") {
const std::string& activity(atts.getString("name"));
const std::string& order(atts.getString("value"));
if (order == "done") {
setActivityDone(activity, time);
} else if (order == "fail") {
setActivityFailed(activity, time);
} else {
throw utils::ModellingError(
fmt(_("Decision: unknown order `%1%'")) % order);
}
} else {
value::Map::const_iterator jt = atts.value().find("value");
if (jt == atts.end()) {
jt = atts.value().find("init");
}
if (jt == atts.end() or not jt->second) {
throw utils::ModellingError(
fmt(_("Decision: no value in this message: `%1%'")) %
(*it));
}
if (mPortMode) {
applyFact(port, *jt->second);
} else {
const std::string& fact((*it)->getStringAttributeValue("name"));
applyFact(fact, *jt->second);
}
}
}
mState = UpdateFact;
}
示例4: externalTransition
void externalTransition(const devs::ExternalEventList& event,
devs::Time time) override
{
last_wake_up_time = time;
a = event.begin()->attributes()->toDouble().value();
}