• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ devs::ExternalEventList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中devs::ExternalEventList的典型用法代码示例。如果您正苦于以下问题:C++ ExternalEventList类的具体用法?C++ ExternalEventList怎么用?C++ ExternalEventList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ExternalEventList类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: output

    virtual void output(
        const devs::Time& /* time */,
        devs::ExternalEventList& output ) const
    {
        if (m_phase == CONTROL) {
            typedef std::vector<std::string>::const_iterator NodeIterator;
    
            vv::Map* nodeObservations = vv::Map::create();
            for (NodeIterator it = m_interventions.begin()->second.begin(); 
                 it !=  m_interventions.begin()->second.end(); it++) {
                nodeObservations->addString(*it, "R");
                vd::ExternalEvent * ev = new vd::ExternalEvent (*it);
                ev << vd::attribute ("type", buildString("clean"));
                output.addEvent (ev);
            }
            if (getModel().existOutputPort("info_center")) {
                vd::ExternalEvent * evInfo = new vd::ExternalEvent ("info_center");
                evInfo << vd::attribute("nodesStates", nodeObservations);
                output.addEvent(evInfo);
            } else {
                delete nodeObservations;
            }
        }

    }
开发者ID:duboz,项目名称:surveillance,代码行数:25,代码来源:controller.cpp


示例2: select

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;
}
开发者ID:eric-casellas,项目名称:packages,代码行数:28,代码来源:Moore.cpp


示例3: 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();
 }
开发者ID:duboz,项目名称:surveillance,代码行数:29,代码来源:controller.cpp


示例4: output

 virtual void output(const devs::Time& /* time */,
                     devs::ExternalEventList& output) const
 {
     if (mActive) {
         output.push_back(buildEvent("yes"));
     } else {
         output.push_back(buildEvent("no"));
     }
 }
开发者ID:mikaelgrialou,项目名称:packages,代码行数:9,代码来源:PetrinetMeteo.cpp


示例5: output

 virtual void output(devs::Time /*time*/,
                     devs::ExternalEventList &output) const override
 {
     Ensures(i == 1);
     i++;
     output.emplace_back("out");
 }
开发者ID:,项目名称:,代码行数:7,代码来源:


示例6: output

 virtual void output(const devs::Time& /* time */,
                     devs::ExternalEventList& output) const
 {
     for (int i = 0; i < m_counter; ++i) {
         output.push_back(buildEvent("out"));
     }
 }
开发者ID:GG31,项目名称:packages,代码行数:7,代码来源:DevsTransform.cpp


示例7: 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;
}
开发者ID:GG31,项目名称:packages,代码行数:46,代码来源:Agent.cpp


示例8: output

void Moore::output(devs::Time time,
		   devs::ExternalEventList& output) const
{
    if (mPhase == PROCESSING) {
        OutputFuncsIterator it = mOutputFuncs.find(currentState());

        if (it != mOutputFuncs.end()) {
            (it->second)(time, output);
        } else {
            OutputsIterator ito = mOutputs.find(currentState());

            if (ito != mOutputs.end()) {
                output.emplace_back(ito->second);
            }
        }
    }
}
开发者ID:eric-casellas,项目名称:packages,代码行数:17,代码来源:Moore.cpp


示例9: output

void Mealy::output(devs::Time time,
		   devs::ExternalEventList& output) const
{
    if (mPhase == PROCESSING) {
        const devs::ExternalEventList& events = *mToProcessEvents.front();
        const devs::ExternalEvent& event = events.front();
        OutputFuncsIterator itof = mOutputFuncs.find(currentState());

        if (itof != mOutputFuncs.end()  and
            itof->second.find(event.getPortName()) != itof->second.end()) {
            (itof->second.find(event.getPortName())->second)(time, output);
        } else {
            OutputsIterator ito = mOutputs.find(currentState());

            if (ito != mOutputs.end() and
                ito->second.find(event.getPortName()) != ito->second.end()) {
                output.emplace_back(
                    ito->second.find(event.getPortName())->second);
            }
        }
    }
}
开发者ID:eric-casellas,项目名称:packages,代码行数:22,代码来源:Mealy.cpp


示例10: externalTransition

 virtual void externalTransition(const devs::ExternalEventList &events,
                                 devs::Time /* time */) override
 {
     m_counter = m_counter + events.size();
 }
开发者ID:,项目名称:,代码行数:5,代码来源:


示例11: externalTransition

 virtual void externalTransition(const devs::ExternalEventList& evts,
                                 devs::Time time) override
 {
     mDate = time;
     mNumber += evts.size();
 }
开发者ID:rtrepos,项目名称:packages,代码行数:6,代码来源:PetrinetCounter.cpp


示例12: output

 virtual void output(const devs::Time& /* time */,
                     devs::ExternalEventList& output) const
 { output.push_back(new devs::ExternalEvent("out")); }
开发者ID:GG31,项目名称:packages,代码行数:3,代码来源:PetrinetBeep.cpp


示例13: externalTransition

 void externalTransition(const devs::ExternalEventList& event,
                                 devs::Time time) override
 {
     last_wake_up_time = time;
     a = event.begin()->attributes()->toDouble().value();
 }
开发者ID:Chabrier,项目名称:packages,代码行数:6,代码来源:Perturb7.cpp



注:本文中的devs::ExternalEventList类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ dfhack::Context类代码示例发布时间:2022-05-31
下一篇:
C++ detail::workspace1类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap