Esempio n. 1
0
func RemoveRegisteredSignalType(st bh.SignalTypeIf) {
	name := st.TypeName()
	delete(signalTypes, name)
	_, ok := registeredSignalTypes.Find(name)
	if ok {
		registeredSignalTypes.Remove(name)
	}
}
Esempio n. 2
0
func CreateXmlSignalType(s bh.SignalTypeIf) *backend.XmlSignalType {
	var scope, mode string
	if s.Scope() == bh.Local {
		scope = "local"
	}
	if s.Mode() == bh.Synchronous {
		mode = "sync"
	}
	return backend.XmlSignalTypeNew(s.TypeName(), scope, mode, s.CType(), s.ChannelId())
}
Esempio n. 3
0
func (l *library) AddSignalType(s bh.SignalTypeIf) (ok bool) {
	for _, st := range l.signalTypes.SignalTypes() {
		if st.TypeName() == s.TypeName() {
			log.Printf(`library.AddSignalType: warning: adding
				duplicate signal type definition %s (ignored)`, s.TypeName())
			return
		}
	}
	ok = true
	l.signalTypes.Append(s)
	return
}
Esempio n. 4
0
func LibraryUsesSignalType(l bh.LibraryIf, st bh.SignalTypeIf) bool {
	for _, t := range l.SignalTypes() {
		if t.TypeName() == st.TypeName() {
			return true
		}
	}
	for _, t := range l.NodeTypes() {
		for _, impl := range t.Implementation() {
			if impl.ImplementationType() == bh.NodeTypeGraph {
				if SignalGraphTypeUsesSignalType(impl.Graph(), st) {
					return true
				}
			}
		}
	}
	return false
}
Esempio n. 5
0
func (l *library) RemoveSignalType(st bh.SignalTypeIf) {
	for _, ntName := range freesp.GetRegisteredNodeTypes() {
		nt, ok := freesp.GetNodeTypeByName(ntName)
		if !ok {
			log.Panicf("library.RemoveSignalType internal error: node type %s\n", ntName)
		}
		for _, p := range nt.InPorts() {
			if p.SignalType().TypeName() == st.TypeName() {
				log.Printf(`library.RemoveSignalType warning:
					bh.SignalTypeIf %v is still in use\n`, st)
				return
			}
		}
		for _, p := range nt.OutPorts() {
			if p.SignalType().TypeName() == st.TypeName() {
				log.Printf(`library.RemoveSignalType warning:
					bh.SignalTypeIf %v is still in use\n`, st)
				return
			}
		}
	}
	SignalTypeDestroy(st)
	l.signalTypes.Remove(st)
}
Esempio n. 6
0
func RegisterSignalType(st bh.SignalTypeIf) {
	signalTypes[st.TypeName()] = st
	registeredSignalTypes.Append(st.TypeName())
}
Esempio n. 7
0
func (t *nodeType) addOutPort(name string, pType bh.SignalTypeIf) {
	t.outPorts.Append(PortTypeNew(name, pType.TypeName(), gr.OutPort))
}
Esempio n. 8
0
func signalTypeCpmpatible(s1, s2 bh.SignalTypeIf) bool {
	if s1.TypeName() != s2.TypeName() {
		return true
	}
	if s1.CType() != s2.CType() {
		return false
	}
	if s1.Scope() != s2.Scope() {
		return false
	}
	if s1.ChannelId() != s2.ChannelId() {
		return false
	}
	if s1.Mode() != s2.Mode() {
		return false
	}
	return true
}