Пример #1
0
func (n *node) removePort(pt bh.PortTypeIf) {
	var list *portList
	if pt.Direction() == gr.InPort {
		list = &n.inPort
	} else {
		list = &n.outPort
	}
	var i int
	for i = 0; i < len(list.Ports()); i++ {
		if list.Ports()[i].Name() == pt.Name() {
			break
		}
	}
	toRemove := list.Ports()[i]
	for _, c := range toRemove.Connections() {
		c.RemoveConnection(toRemove)
	}
	list.Remove(toRemove)
}
Пример #2
0
func (t *nodeType) RemoveNamedPortType(p bh.PortTypeIf) {
	for _, impl := range t.implementation.Implementations() {
		if impl.ImplementationType() == bh.NodeTypeGraph {
			if p.Direction() == gr.InPort {
				impl.Graph().(*signalGraphType).removeInputNodeFromPortType(p)
			} else {
				impl.Graph().(*signalGraphType).removeOutputNodeFromPortType(p)
			}
		}
	}
	for _, n := range t.instances.Nodes() {
		n.(*node).removePort(p.(*portType))
	}
	var list *portTypeList
	if p.Direction() == gr.InPort {
		list = &t.inPorts
	} else {
		list = &t.outPorts
	}
	list.Remove(p)
}
Пример #3
0
func (t *nodeType) AddNamedPortType(p bh.PortTypeIf) {
	if p.Direction() == gr.InPort {
		t.inPorts.Append(p)
	} else {
		t.outPorts.Append(p)
	}
	for _, n := range t.instances.Nodes() {
		if p.Direction() == gr.InPort {
			n.(*node).addInPort(p)
		} else {
			n.(*node).addOutPort(p)
		}
	}
	for _, impl := range t.implementation.Implementations() {
		if impl.ImplementationType() == bh.NodeTypeGraph {
			if p.Direction() == gr.InPort {
				impl.Graph().(*signalGraphType).addInputNodeFromPortType(p)
			} else {
				impl.Graph().(*signalGraphType).addOutputNodeFromPortType(p)
			}
		}
	}
}