当前位置: 首页>>代码示例>>C++>>正文


C++ CoupledModel::findModel方法代码示例

本文整理汇总了C++中CoupledModel::findModel方法的典型用法代码示例。如果您正苦于以下问题:C++ CoupledModel::findModel方法的具体用法?C++ CoupledModel::findModel怎么用?C++ CoupledModel::findModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CoupledModel的用法示例。


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

示例1: test_bug_rename_port

void test_bug_rename_port()
{
    auto ctx = vle::utils::make_context();
    vpz::Vpz file(ctx->getTemplate("unittest.vpz").string());

    CoupledModel* top =
        dynamic_cast<CoupledModel*>(file.project().model().node());
    Ensures(top);
    EnsuresEqual(top->existInternalConnection("top1", "out", "top2",
                                                     "in"), true);
    CoupledModel* top1 =
        dynamic_cast<CoupledModel*>(top->findModel("top1"));
    Ensures(top1);

    CoupledModel* top2 =
        dynamic_cast<CoupledModel*>(top->findModel("top2"));
    Ensures(top2);

    EnsuresEqual(top->existInternalConnection("top2", "out", "top1",
                                                     "in"), true);

    EnsuresEqual(top2->existOutputPort("out"), true);
    top2->delOutputPort("out");
    EnsuresEqual(top2->existOutputPort("out"), false);

    EnsuresEqual(top->existInternalConnection("top2", "out", "top1",
                                                     "in"), false);

    EnsuresEqual(top1->existInputPort("in"), true);
    EnsuresNotThrow(top1->delInputPort("in"), std::exception);
    EnsuresEqual(top1->existInputPort("in"), false);

    EnsuresEqual(top->existInternalConnection("top2", "out", "top1",
                                                     "in"), false);
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例2: test_clone2

void test_clone2()
{
    auto ctx = vle::utils::make_context();
    vpz::Vpz file(ctx->getTemplate("unittest.vpz").string());

    CoupledModel* oldtop = dynamic_cast < CoupledModel* >(
        file.project().model().node());
    Ensures(oldtop);

    CoupledModel* top = dynamic_cast < CoupledModel* >(oldtop->clone());
    Ensures(top);
    CoupledModel* top1(dynamic_cast < CoupledModel*
                       >(top->findModel("top1")));
    Ensures(top1);
    CoupledModel* top2(dynamic_cast < CoupledModel*
                       >(top->findModel("top2")));
    Ensures(top2);

    AtomicModel* f(dynamic_cast < AtomicModel* >(top2->findModel("f")));
    Ensures(f);
    AtomicModel* g(dynamic_cast < AtomicModel* >(top2->findModel("g")));
    Ensures(g);

    delete top;
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例3: file

void
test_rename_model()
{
    auto ctx = vle::utils::make_context();

    vpz::Vpz file(VPZ_TEST_DIR "/unittest.vpz");

    CoupledModel* top =
      dynamic_cast<CoupledModel*>(file.project().model().node());
    Ensures(top);

    if (not top)
        return;

    EnsuresNotThrow(vpz::BaseModel::rename(top, "new_top"), std::exception);

    AtomicModel* d = dynamic_cast<AtomicModel*>(top->findModel("d"));
    Ensures(d);

    if (not d)
        return;

    EnsuresThrow(vpz::BaseModel::rename(d, "e"), utils::DevsGraphError);
    EnsuresNotThrow(vpz::BaseModel::rename(d, "new_d"), std::exception);

    CoupledModel* top1 = dynamic_cast<CoupledModel*>(top->findModel("top1"));
    Ensures(top1);

    if (not top1)
        return;

    EnsuresThrow(vpz::BaseModel::rename(top1, "top2"), utils::DevsGraphError);
    EnsuresNotThrow(vpz::BaseModel::rename(top1, "new_top1"), std::exception);
}
开发者ID:Chabrier,项目名称:vle,代码行数:34,代码来源:test8.cpp

示例4: test_rename_model

void test_rename_model()
{
    auto ctx = vle::utils::make_context();
    vpz::Vpz file(ctx->getTemplate("unittest.vpz").string());

    CoupledModel* top =
        dynamic_cast<CoupledModel*>(file.project().model().node());
    Ensures(top);
    EnsuresNotThrow(vpz::BaseModel::rename(top, "new_top"), std::exception);

    AtomicModel* d = dynamic_cast<AtomicModel*>(top->findModel("d"));
    EnsuresThrow(vpz::BaseModel::rename(d, "e"), utils::DevsGraphError);
    EnsuresNotThrow(vpz::BaseModel::rename(d, "new_d"), std::exception);

    CoupledModel * top1 = dynamic_cast<CoupledModel*>(top->findModel("top1"));
    EnsuresThrow(vpz::BaseModel::rename(top1, "top2"), utils::DevsGraphError);
    EnsuresNotThrow(vpz::BaseModel::rename(top1, "new_top1"), std::exception);
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例5: test_rename_port

void test_rename_port()
{
    auto ctx = vle::utils::make_context();
    vpz::Vpz file(ctx->getTemplate("unittest.vpz").string());

    CoupledModel* top =
        dynamic_cast<CoupledModel*>(file.project().model().node());
    Ensures(top);
    EnsuresEqual(top->existInternalConnection("top1", "out", "top2",
                                                     "in"), true);

    //Atomic Model
    AtomicModel* d = dynamic_cast<AtomicModel*>(top->findModel("d"));
    Ensures(d);
    EnsuresEqual(d->existInputPort("in"), true);
    EnsuresEqual(d->existOutputPort("out"), true);
    EnsuresEqual(top->existInternalConnection("top1", "out", "d",
                                                     "in"), true);

    //Atomic Model -- Input Port
    d->renameInputPort("in", "new_in");
    EnsuresEqual(d->existInputPort("in"), false);
    EnsuresEqual(top->existInternalConnection("top1", "out", "d",
                                                     "in"), false);
    EnsuresEqual(d->existInputPort("new_in"), true);
    EnsuresEqual(top->existInternalConnection("top1", "out", "d",
                                                     "new_in"), true);

    //Atomic Model -- Output Port
    d->renameOutputPort("out", "new_out");
    EnsuresEqual(d->existOutputPort("out"), false);
    EnsuresEqual(d->existOutputPort("new_out"), true);

    //Coupled Model
    CoupledModel* top1 =
        dynamic_cast<CoupledModel*>(top->findModel("top1"));
    Ensures(top1);

    //Coupled Model -- Input Port
    EnsuresEqual(top1->existInputPort("in"), true);
    EnsuresEqual(top->existInternalConnection("top2", "out", "top1",
                                                     "in"), true);
    EnsuresEqual(top1->existInputConnection("in", "x", "in"), true);

    top1->renameInputPort("in", "new_in");
    EnsuresEqual(top1->existInputPort("in"), false);
    EnsuresEqual(top->existInternalConnection("top2", "out", "top1",
                                                     "in"), false);
    EnsuresEqual(top1->existInputConnection("in", "x", "in"), false);
    EnsuresEqual(top1->existInputPort("new_in"), true);
    EnsuresEqual(top->existInternalConnection("top2", "out", "top1",
                                                     "new_in"), true);
    EnsuresEqual(top1->existInputConnection("new_in", "x", "in"), true);
    EnsuresEqual(top1->nbInputConnection("new_in", "x", "in"), 1);

    //Coupled Model -- Output Port
    EnsuresEqual(top1->existOutputPort("out"), true);
    EnsuresEqual(top->existInternalConnection("top1", "out", "e",
                                                     "in1"), true);
    EnsuresEqual(top->existInternalConnection("top1", "out", "e",
                                                     "in2"), true);
    EnsuresEqual(top1->existOutputConnection("x", "out", "out"),
                        true);

    top1->renameOutputPort("out", "new_out");
    EnsuresEqual(top1->existOutputPort("out"), false);
    EnsuresEqual(top->existInternalConnection("top1", "out", "e",
                                                     "in1"), false);
    EnsuresEqual(top->existInternalConnection("top1", "out", "e",
                                                     "in2"), false);
    EnsuresEqual(top1->existOutputConnection("x", "out", "out"),
                        false);
    EnsuresEqual(top1->existOutputPort("new_out"), true);
    EnsuresEqual(top->existInternalConnection("top1", "new_out", "e",
                                                     "in1"), true);
    EnsuresEqual(top->existInternalConnection("top1", "new_out", "e",
                                                     "in2"), true);
    EnsuresEqual(top1->existOutputConnection("x", "out", "new_out"),
                        true);
    EnsuresEqual(top1->nbOutputConnection("x", "out", "new_out"), 1);
}
开发者ID:,项目名称:,代码行数:81,代码来源:


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