Ejemplo n.º 1
0
func CreateXmlImplementation(impl bh.ImplementationIf) *backend.XmlImplementation {
	ret := backend.XmlImplementationNew(impl.ElementName())
	if impl.ImplementationType() == bh.NodeTypeGraph {
		ret.SignalGraph = append(ret.SignalGraph, *CreateXmlSignalGraphType(impl.Graph()))
	}
	return ret
}
Ejemplo n.º 2
0
func (t *nodeType) RemoveImplementation(imp bh.ImplementationIf) {
	if imp.ImplementationType() == bh.NodeTypeGraph {
		gt := imp.Graph()
		for len(gt.Nodes()) > 0 {
			gt.RemoveNode(gt.Nodes()[0].(*node))
		}
	}
	t.implementation.Remove(imp)
}
Ejemplo n.º 3
0
func (t *nodeType) AddImplementation(imp bh.ImplementationIf) {
	if imp.ImplementationType() == bh.NodeTypeGraph {
		if imp.Graph() == nil {
			log.Fatal("nodeType.AddImplementation: missing graph")
		}
		g := imp.Graph().(*signalGraphType)
		for _, p := range t.inPorts.PortTypes() {
			g.addInputNodeFromPortType(p)
		}
		for _, p := range t.outPorts.PortTypes() {
			g.addOutputNodeFromPortType(p)
		}
	}
	t.implementation.Append(imp)
}
Ejemplo n.º 4
0
func (n node) children() (ch []bh.NodeIf) {
	nt := n.ItsType()
	var impl bh.ImplementationIf
	haveImpl := false
	for _, impl = range nt.Implementation() {
		if impl.ImplementationType() == bh.NodeTypeGraph {
			haveImpl = true
			break
		}
	}
	if !haveImpl {
		return
	}
	g := impl.Graph()
	ch = g.ProcessingNodes()
	return
}