本文整理匯總了Golang中github.com/axel-freesp/sge/interface/mapping.MappingIf.Graph方法的典型用法代碼示例。如果您正苦於以下問題:Golang MappingIf.Graph方法的具體用法?Golang MappingIf.Graph怎麽用?Golang MappingIf.Graph使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/axel-freesp/sge/interface/mapping.MappingIf
的用法示例。
在下文中一共展示了MappingIf.Graph方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: CreateXmlMapping
func CreateXmlMapping(m mp.MappingIf) (xmlm *backend.XmlMapping) {
xmlm = backend.XmlMappingNew(m.Graph().Filename(), m.Platform().Filename())
g := m.Graph().ItsType()
for _, n := range g.InputNodes() {
p, ok := m.Mapped(n.Name())
if ok {
pname := fmt.Sprintf("%s/%s", p.Arch().Name(), p.Name())
xmlm.IOMappings = append(xmlm.IOMappings, *CreateXmlIOMap(n.Name(), pname))
}
}
for _, n := range g.OutputNodes() {
p, ok := m.Mapped(n.Name())
if ok {
pname := fmt.Sprintf("%s/%s", p.Arch().Name(), p.Name())
xmlm.IOMappings = append(xmlm.IOMappings, *CreateXmlIOMap(n.Name(), pname))
}
}
for _, n := range g.ProcessingNodes() {
xmln := CreateXmlNodeMapList(m, n, n.Name())
for _, x := range xmln {
xmlm.Mappings = append(xmlm.Mappings, x)
}
}
return
}
示例2: Consistent
func (f *fileManagerMap) Consistent(m mp.MappingIf) (err error) {
nodelist := m.Graph().ItsType().Nodes()
idlist := m.MappedIds()
for _, n := range nodelist {
// check that every node has a mapping
if !findNodeInIdList(n, behaviour.NodeIdFromString("", m.Graph().Filename()), idlist) {
// TODO: add missing mapping(s)
err = fmt.Errorf("fileManagerMap.Consistent error: node %s is not fully mapped\n", n.Name())
return
}
addExpandedMappings(m, n, behaviour.NodeIdFromString("", m.Graph().Filename()))
}
for _, id := range idlist {
// check that every mapping has a node
melem, ok := m.MappedElement(id)
if !ok {
// Should never occur, nothing to recover though...
err = fmt.Errorf("fileManagerMap.Consistent error: invalid maplist\n")
return
}
n := melem.Node()
if n == nil {
// TODO: remove this mapping from mappings
err = fmt.Errorf("fileManagerMap.Consistent error: mapping %s has no node\n", id)
return
}
}
return
}