本文整理汇总了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
}