Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert qan::Edge directly with qan::Graph::insertEdge(org, dst, ...) being org and dst qan::PortItem #66

Open
anibalanto opened this issue Sep 28, 2018 · 1 comment

Comments

@anibalanto
Copy link

Hello! This is posible?
I see that qan::PortItem inhertis from qan::NodeItem.
I thik that this idea might work:

auto node1 = graph->insertNode<CustomNode>();
auto node2 = graph->insertNode<CustomNode>();
auto in1 = graph->insertPort<CustomPort>(node1, qan::NodeItem::Dock::Left, qan::PortItem::Type::In, "IN1", "in1");
auto out1 = graph->insertPort<CustomPort>(node2, qan::NodeItem::Dock::Right, qan::PortItem::Type::Out, "OUT1", "out1");
...
auto portIn = node1->findPort("IN1");
auto portOut = node2->findPort("OUT1");
if(portIn && portOut){
    graph->insertEdge<CustomEdge>(portIn, portOut);
}
@cneben
Copy link
Owner

cneben commented Sep 29, 2018

Hello,

Thank you for the suggestion, it would be a simpler API than the actual bindEdge() interface.

Actually, it won't work because qan::PortItem has no link to the internal topology, it is just a visual node with no reference to qan::Graph topology (except a pointer to the "host node").
But insertEdge<>() could detect that src and dst arguments are actually port items, then forward the edge to src and dst host nodes and automatically bind inserted edge to correct ports. It would be a lot simpler than the actual API.

I am actually working on build system and edge generation, but I will certainly implement that interface in the near future. Keeping the report open with an "help needed" tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants