本文整理汇总了Golang中github.com/axel-freesp/sge/interface/mapping.MappingIf.Mapped方法的典型用法代码示例。如果您正苦于以下问题:Golang MappingIf.Mapped方法的具体用法?Golang MappingIf.Mapped怎么用?Golang MappingIf.Mapped使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/axel-freesp/sge/interface/mapping.MappingIf
的用法示例。
在下文中一共展示了MappingIf.Mapped方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ArchMappingNew
func ArchMappingNew(userObj pf.ArchIf, nodes []NodeIf, mapping mp.MappingIf) *Arch {
var processes []ProcessIf
var Children []ContainerChild
for _, up := range userObj.Processes() {
var mappedNodes []NodeIf
var mappedIds []bh.NodeIdIf
for _, nId := range mapping.MappedIds() {
m, ok := mapping.Mapped(nId.String())
if ok && m == up {
log.Printf("ArchMappingNew(p=%s): nId=%s", up.Name(), nId.String())
n, ok := findNodeInTree(nodes, nId.String())
if ok && !n.UserObj().Expanded() {
mappedNodes = append(mappedNodes, n)
mappedIds = append(mappedIds, nId)
}
}
}
p := ProcessMappingNew(mappedNodes, mappedIds, up)
processes = append(processes, p)
Children = append(Children, p)
}
config := DrawConfig{ColorInit(ColorOption(ArchNormal)),
ColorInit(ColorOption(ArchHighlight)),
ColorInit(ColorOption(ArchSelected)),
ColorInit(ColorOption(BoxFrame)),
ColorInit(ColorOption(Text)),
image.Point{archPortOutBorder, archPortOutBorder}}
cconfig := ContainerConfig{archPortWidth, archPortHeight, archMinWidth, archMinHeight}
a := &Arch{ContainerInit(Children, config, userObj, cconfig), userObj,
make(map[pf.ChannelIf]*ContainerPort), processes, gr.PositionModeMapping, mapping}
a.init()
/*
for _, n := range nodes {
melem, ok := mapping.MappedElement(n.UserObj())
if !ok {
log.Printf("ArchMappingNew warning: node %s not mapped.\n", n.Name())
continue
}
n.SetPosition(melem.PathModePosition("", gr.PositionModeMapping))
}
*/
a.initMappingPorts()
return a
}
示例3: CreateXmlNodeMapList
func CreateXmlNodeMapList(m mp.MappingIf, n bh.NodeIf, path string) (xmln []backend.XmlNodeMap) {
p, ok := m.Mapped(n.Name())
if ok { // entire node is mapped to p:
pname := fmt.Sprintf("%s/%s", p.Arch().Name(), p.Name())
xmln = append(xmln, *CreateXmlNodeMap(path, pname))
}
nt := n.ItsType()
for _, impl := range nt.Implementation() {
if impl.ImplementationType() == bh.NodeTypeGraph {
for _, nn := range impl.Graph().ProcessingNodes() {
xmlnn := CreateXmlNodeMapList(m, nn, fmt.Sprintf("%s/%s", path, nn.Name()))
for _, x := range xmlnn {
xmln = append(xmln, x)
}
}
}
}
return
}