本文整理汇总了Golang中github.com/axel-freesp/sge/interface/behaviour.NodeTypeIf类的典型用法代码示例。如果您正苦于以下问题:Golang NodeTypeIf类的具体用法?Golang NodeTypeIf怎么用?Golang NodeTypeIf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NodeTypeIf类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: CleanupNodeType
func (g *Global) CleanupNodeType(nt bh.NodeTypeIf) {
for _, impl := range nt.Implementation() {
if impl.ImplementationType() == bh.NodeTypeGraph {
g.CleanupNodeTypesFromNodes(impl.Graph().Nodes())
}
}
freesp.RemoveRegisteredNodeType(nt)
}
示例2: RemoveRegisteredNodeType
func RemoveRegisteredNodeType(nt bh.NodeTypeIf) {
name := nt.TypeName()
delete(nodeTypes, name)
_, ok := registeredNodeTypes.Find(name)
if ok {
registeredNodeTypes.Remove(name)
}
}
示例3: isAutoType
func isAutoType(nt bh.NodeTypeIf) bool {
if strings.HasPrefix(nt.TypeName(), "autoInputNodeType-") {
return true
}
if strings.HasPrefix(nt.TypeName(), "autoOutputNodeType-") {
return true
}
return false
}
示例4: SignalGraphTypeUsesNodeType
func SignalGraphTypeUsesNodeType(t bh.SignalGraphTypeIf, nt bh.NodeTypeIf) bool {
for _, n := range t.Nodes() {
if n.ItsType().TypeName() == nt.TypeName() {
return true
}
for _, impl := range n.ItsType().Implementation() {
if impl.ImplementationType() == bh.NodeTypeGraph {
if SignalGraphTypeUsesNodeType(impl.Graph(), nt) {
return true
}
}
}
}
return false
}
示例5: LibraryUsesNodeType
func LibraryUsesNodeType(l bh.LibraryIf, nt bh.NodeTypeIf) bool {
for _, t := range l.NodeTypes() {
if t.TypeName() == nt.TypeName() {
return true
}
for _, impl := range t.Implementation() {
if impl.ImplementationType() == bh.NodeTypeGraph {
if SignalGraphTypeUsesNodeType(impl.Graph(), nt) {
return true
}
}
}
}
return false
}
示例6: AddNodeType
func (l *library) AddNodeType(t bh.NodeTypeIf) error {
nType, ok := freesp.GetNodeTypeByName(t.TypeName())
if ok {
log.Printf(`library.AddNodeType: warning: adding existing node
type definition %s (taking the existing one)`, t.TypeName())
} else {
nType = t.(*nodeType)
freesp.RegisterNodeType(nType)
log.Println("library.AddNodeType: registered ", t.TypeName())
}
for _, nt := range l.nodeTypes.NodeTypes() {
if nt.TypeName() == t.TypeName() {
return fmt.Errorf(`adding duplicate node type definition
%s (ignored)`, t.TypeName())
}
}
l.nodeTypes.Append(nType)
return nil
}
示例7: CreateXmlNodeType
func CreateXmlNodeType(t bh.NodeTypeIf) *backend.XmlNodeType {
ret := backend.XmlNodeTypeNew(t.TypeName())
for _, p := range t.InPorts() {
ret.InPort = append(ret.InPort, *CreateXmlNamedInPort(p))
}
for _, p := range t.OutPorts() {
ret.OutPort = append(ret.OutPort, *CreateXmlNamedOutPort(p))
}
for _, impl := range t.Implementation() {
ret.Implementation = append(ret.Implementation, *CreateXmlImplementation(impl))
}
return ret
}
示例8: NodeNew
func NodeNew(name string, ntype bh.NodeTypeIf, context bh.SignalGraphTypeIf) (ret *node, err error) {
for _, n := range context.Nodes() {
if n.Name() == name {
err = fmt.Errorf("NodeNew error: node '%s' already exists in context.", name)
return
}
}
if len(ntype.InPorts())+len(ntype.OutPorts()) == 0 {
err = fmt.Errorf("NodeNew error: type '%s' has no ports.", ntype.TypeName())
return
}
ret = &node{*gr.PathModePositionerObjectNew(), context, name, ntype,
portListInit(), portListInit(), nil, false}
for _, p := range ntype.InPorts() {
ret.addInPort(p)
}
for _, p := range ntype.OutPorts() {
ret.addOutPort(p)
}
ntype.(*nodeType).addInstance(ret)
return
}
示例9: RegisterNodeType
func RegisterNodeType(nt bh.NodeTypeIf) {
nodeTypes[nt.TypeName()] = nt
registeredNodeTypes.Append(nt.TypeName())
}