Exemplo n.º 1
0
func (p *port) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	var prop tr.Property
	parentId := tree.Parent(cursor)
	if tree.Property(parentId).IsReadOnly() {
		prop = freesp.PropertyNew(false, false, false)
	} else {
		prop = freesp.PropertyNew(true, false, false)
	}
	var kind tr.Symbol
	if p.Direction() == gr.InPort {
		kind = tr.SymbolInputPort
	} else {
		kind = tr.SymbolOutputPort
	}
	err := tree.AddEntry(cursor, kind, p.Name(), p, prop)
	if err != nil {
		log.Fatalf("port.AddToTree: FilesTreeStore.AddEntry() failed: %s\n", err)
	}
	child := tree.Append(cursor)
	t := p.SignalType()
	t.AddToTree(tree, child)
	for _, c := range p.Connections() {
		child = tree.Append(cursor)
		p.Connection(c).AddToTree(tree, child)
	}
	return
}
Exemplo n.º 2
0
func (n *node) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	var prop tr.Property
	if isParentReadOnly(tree, cursor) {
		prop = freesp.PropertyNew(false, false, false)
	} else {
		prop = freesp.PropertyNew(true, true, true)
	}
	var image tr.Symbol
	if len(n.InPorts()) == 0 {
		image = tr.SymbolInputNode
	} else if len(n.OutPorts()) == 0 {
		image = tr.SymbolOutputNode
	} else {
		image = tr.SymbolProcessingNode
	}
	err := tree.AddEntry(cursor, image, n.Name(), n, prop)
	if err != nil {
		log.Fatalf("node.AddToTree error: AddEntry failed: %s\n", err)
	}
	child := tree.Append(cursor)
	n.ItsType().AddToTree(tree, child)
	for _, p := range n.InPorts() {
		child := tree.Append(cursor)
		p.AddToTree(tree, child)
	}
	for _, p := range n.OutPorts() {
		child := tree.Append(cursor)
		p.AddToTree(tree, child)
	}
}
Exemplo n.º 3
0
func (t *nodeType) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	var prop tr.Property
	parentId := tree.Parent(cursor)
	parent := tree.Object(parentId)
	switch parent.(type) {
	case bh.LibraryIf:
		prop = freesp.PropertyNew(true, true, true)
	case bh.NodeIf:
		prop = freesp.PropertyNew(false, false, false)
	default:
		log.Fatalf("nodeType.AddToTree error: invalid parent type %T\n", parent)
	}
	err := tree.AddEntry(cursor, tr.SymbolNodeType, t.TypeName(), t, prop)
	if err != nil {
		log.Fatalf("nodeType.AddToTree error: AddEntry failed: %s\n", err)
	}
	for _, impl := range t.Implementation() {
		child := tree.Append(cursor)
		impl.AddToTree(tree, child)
	}
	for _, pt := range t.InPorts() {
		child := tree.Append(cursor)
		pt.AddToTree(tree, child)
	}
	for _, pt := range t.OutPorts() {
		child := tree.Append(cursor)
		pt.AddToTree(tree, child)
	}
}
Exemplo n.º 4
0
func (t *iotype) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	prop := freesp.PropertyNew(true, true, true)
	err := tree.AddEntry(cursor, tr.SymbolIOType, t.Name(), t, prop)
	if err != nil {
		log.Fatalf("iotype.AddToTree error: AddEntry failed: %s\n", err)
	}
}
Exemplo n.º 5
0
func (t *signalGraph) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	prop := freesp.PropertyNew(true, false, false)
	err := tree.AddEntry(cursor, tr.SymbolSignalGraph, t.Filename(), t, prop)
	if err != nil {
		log.Fatal("LibraryIf.AddToTree error: AddEntry failed: %s", err)
	}
	t.ItsType().AddToTree(tree, cursor)
}
Exemplo n.º 6
0
func (t *signalType) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	var prop tr.Property
	parentId := tree.Parent(cursor)
	parent := tree.Object(parentId)
	switch parent.(type) {
	case bh.LibraryIf:
		prop = freesp.PropertyNew(true, true, true)
	case bh.PortIf, bh.PortTypeIf:
		prop = freesp.PropertyNew(false, false, false)
	default:
		log.Fatalf("signalType.AddToTree error: invalid parent type %T\n", parent)
	}
	err := tree.AddEntry(cursor, tr.SymbolSignalType, t.TypeName(), t, prop)
	if err != nil {
		log.Fatalf("signalType.AddToTree error: AddEntry failed: %s\n", err)
	}
}
Exemplo n.º 7
0
func (c *connection) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	text := fmt.Sprintf("%s/%s -> %s/%s", c.from.Node().Name(), c.from.Name(),
		c.to.Node().Name(), c.to.Name())
	prop := freesp.PropertyNew(false, false, true)
	err := tree.AddEntry(cursor, tr.SymbolConnection, text, c, prop)
	if err != nil {
		log.Fatalf("connection.AddToTree error: AddEntry failed: %s\n", err)
	}
}
Exemplo n.º 8
0
func (p *portType) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	var prop tr.Property
	parentId := tree.Parent(cursor)
	if tree.Property(parentId).IsReadOnly() {
		prop = freesp.PropertyNew(false, false, false)
	} else {
		prop = freesp.PropertyNew(true, true, true)
	}
	var kind tr.Symbol
	if p.Direction() == gr.InPort {
		kind = tr.SymbolInputPortType
	} else {
		kind = tr.SymbolOutputPortType
	}
	err := tree.AddEntry(cursor, kind, p.Name(), p, prop)
	if err != nil {
		log.Fatal("bh.PortTypeIf.AddToTree: FilesTreeStore.AddEntry() failed: %s\n", err)
	}
	child := tree.Append(cursor)
	p.SignalType().AddToTree(tree, child)
}
Exemplo n.º 9
0
func (c *channel) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	var symbol tr.Symbol
	if c.Direction() == gr.InPort {
		symbol = tr.SymbolInChannel
	} else {
		symbol = tr.SymbolOutChannel
	}
	prop := freesp.PropertyNew(true, true, true)
	err := tree.AddEntry(cursor, symbol, c.Name(), c, prop)
	if err != nil {
		log.Fatalf("channel.AddToTree error: AddEntry failed: %s\n", err)
	}
}
Exemplo n.º 10
0
func (p *process) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	prop := freesp.PropertyNew(true, true, true)
	err := tree.AddEntry(cursor, tr.SymbolProcess, p.Name(), p, prop)
	if err != nil {
		log.Fatalf("process.AddToTree error: AddEntry failed: %s\n", err)
	}
	for _, c := range p.InChannels() {
		child := tree.Append(cursor)
		c.AddToTree(tree, child)
	}
	for _, c := range p.OutChannels() {
		child := tree.Append(cursor)
		c.AddToTree(tree, child)
	}
}
Exemplo n.º 11
0
func (l *library) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	prop := freesp.PropertyNew(true, false, false)
	err := tree.AddEntry(cursor, tr.SymbolLibrary, l.Filename(), l, prop)
	if err != nil {
		log.Fatalf("bh.LibraryIf.AddToTree error: AddEntry failed: %s\n", err)
	}
	for _, t := range l.SignalTypes() {
		child := tree.Append(cursor)
		t.AddToTree(tree, child)
	}
	for _, t := range l.NodeTypes() {
		child := tree.Append(cursor)
		t.AddToTree(tree, child)
	}
}
Exemplo n.º 12
0
func (a *arch) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	//log.Printf("arch.AddToTree: %s\n", a.Name())
	prop := freesp.PropertyNew(true, true, true)
	err := tree.AddEntry(cursor, tr.SymbolArch, a.Name(), a, prop)
	if err != nil {
		log.Fatalf("arch.AddToTree error: AddEntry failed: %s", err)
	}
	for _, t := range a.IOTypes() {
		child := tree.Append(cursor)
		t.AddToTree(tree, child)
	}
	for _, p := range a.Processes() {
		child := tree.Append(cursor)
		p.AddToTree(tree, child)
	}
}