Esempio n. 1
0
func CreateXmlLibrary(l bh.LibraryIf) *backend.XmlLibrary {
	fname := l.Filename()
	ret := backend.XmlLibraryNew()
	reflist := tool.StringListInit()
	for _, t := range l.SignalTypes() {
		ref := t.DefinedAt()
		_, ok := reflist.Find(ref)
		if !ok && ref != fname {
			reflist.Append(ref)
		}
	}
	for _, t := range l.NodeTypes() {
		ref := t.DefinedAt()
		_, ok := reflist.Find(ref)
		if !ok && ref != fname {
			reflist.Append(ref)
		}
		for _, impl := range t.Implementation() {
			if impl.ImplementationType() == bh.NodeTypeGraph {
				for _, lib := range impl.Graph().Libraries() {
					ref := lib.Filename()
					_, ok := reflist.Find(ref)
					if !ok && ref != fname {
						reflist.Append(ref)
					}
				}
			}
		}
	}
	for _, ref := range reflist.Strings() {
		ret.Libraries = append(ret.Libraries, *CreateXmlLibraryRef(ref))
	}
	for _, t := range l.SignalTypes() {
		ret.SignalTypes = append(ret.SignalTypes, *CreateXmlSignalType(t))
	}
	for _, t := range l.NodeTypes() {
		ret.NodeTypes = append(ret.NodeTypes, *CreateXmlNodeType(t))
	}
	return ret
}
Esempio n. 2
0
func RemoveRegisteredLibrary(lib bh.LibraryIf) {
	delete(libraries, lib.Filename())
}
Esempio n. 3
0
func RegisterLibrary(lib bh.LibraryIf) {
	libraries[lib.Filename()] = lib
}