本文整理汇总了C++中Composition::getConnections方法的典型用法代码示例。如果您正苦于以下问题:C++ Composition::getConnections方法的具体用法?C++ Composition::getConnections怎么用?C++ Composition::getConnections使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Composition
的用法示例。
在下文中一共展示了Composition::getConnections方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QVBoxLayout
CompositionEditor::CompositionEditor(Composition &composition, Library &library, QWidget *parent) :
QSplitter{Qt::Horizontal, parent},
draw{composition, this},
componentModel{QtListFactory::createComponentList(library.getComponents(), this)},
instances{QtListFactory::createInstanceList(composition.getInstances(), componentModel, this)},
connections{QtListFactory::createConnectionList(composition.getConnections(), this)}
{
this->addWidget(&draw);
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(new QLabel("Instances"));
layout->addWidget(&instanceView);
layout->addWidget(new QLabel("Connections"));
layout->addWidget(&connectionView);
QWidget *rightPanel = new QWidget();
rightPanel->setLayout(layout);
this->addWidget(rightPanel);
instanceView.setItemDelegateForColumn(QtNameTypeItem<IComponentInstance>::TYPE_INDEX, new ComboboxItemDelegate(modelFromTypeIndex<IComponentInstance>)); //FIXME memory leak
instanceView.setModel(instances);
connectionView.setModel(connections);
connect(&draw, SIGNAL(addInstance(Point,Composition&)), this, SIGNAL(addInstance(Point,Composition&)));
}
示例2: visit
void RizzlyPrint::visit(const Composition &composition)
{
for (const auto *inst : composition.getInstances()) {
inst->accept(*this);
}
for (const auto *con : composition.getConnections()) {
con->accept(*this);
}
}
示例3: delete_selfInstance_port_removes_dependant_connections
void CompositionTest::delete_selfInstance_port_removes_dependant_connections()
{
Component *comp1 = ComponentFactory::produce("comp1", {"in"}, {"out"});
Composition *composition = new Composition(new CompositionInstance(comp1));
comp1->setImplementation(composition);
const auto inst = composition->getSelfInstance();
auto portIn = inst->getPorts()[0];
auto portOut = inst->getPorts()[1];
auto connection = ConnectionFactory::produce(portIn, portOut);
composition->getConnections().add(connection);
ComponentPort *port = comp1->getPorts()[0];
CPPUNIT_ASSERT_EQUAL(size_t(1), composition->getConnections().size());
comp1->getPorts().remove(port);
CPPUNIT_ASSERT_EQUAL(size_t(0), composition->getConnections().size());
ComponentFactory::dispose(comp1);
}
示例4: deleteInstancePort_removes_dependant_connections
void CompositionTest::deleteInstancePort_removes_dependant_connections()
{
Component *comp1 = ComponentFactory::produce("comp1", {"in"}, {"out"});
Composition *composition = new Composition(new CompositionInstanceMock());
Instance *inst = InstanceFactory::produce(comp1, "inst", Point(0,0));
composition->getInstances().add(inst);
InstancePort *portOut = inst->getPort("out");
InstancePort *portIn = inst->getPort("in");
Connection *connection = ConnectionFactory::produce(portOut, portIn);
composition->getConnections().add(connection);
ComponentPort *port = comp1->getPorts()[0];
CPPUNIT_ASSERT_EQUAL(size_t(1), composition->getConnections().size());
comp1->getPorts().remove(port);
CPPUNIT_ASSERT_EQUAL(size_t(0), composition->getConnections().size());
CompositionFactory::dispose(composition);
ComponentFactory::dispose(comp1);
}
示例5: connection
void RizzlyPrintTest::connection()
{
std::stringstream ss;
RizzlyPrint printer(ss);
Component *component = ComponentFactory::produce("Component", {"a"}, {"b"});
Instance *instance = InstanceFactory::produce(component, "inst", Point(0,0));
Connection *connection = ConnectionFactory::produce(instance->getPorts().front(), instance->getPorts().back());
Composition *composition = new Composition(new CompositionInstanceMock());
composition->getInstances().add(instance);
composition->getConnections().add(connection);
printer.print(*composition);
std::vector<std::string> listing = asList(ss);
CPPUNIT_ASSERT_EQUAL(size_t(2), listing.size());
CPPUNIT_ASSERT_EQUAL(std::string("inst: Component;"), listing[0]);
CPPUNIT_ASSERT_EQUAL(std::string("inst.a -> inst.b;"), listing[1]);
CompositionFactory::dispose(composition);
ComponentFactory::dispose(component);
}