本文整理汇总了Golang中github.com/axel-freesp/sge/interface/mapping.MappingIf类的典型用法代码示例。如果您正苦于以下问题:Golang MappingIf类的具体用法?Golang MappingIf怎么用?Golang MappingIf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MappingIf类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
开发者ID:axel-freesp,项目名称:sge,代码行数:25,代码来源:backendconversions.go
示例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
}
开发者ID:axel-freesp,项目名称:sge,代码行数:29,代码来源:mapping.go
示例3: addExpandedMappings
func addExpandedMappings(m mp.MappingIf, n bh.NodeIf, parentId bh.NodeIdIf) {
idlist := m.MappedIds()
nId := behaviour.NodeIdNew(parentId, n.Name())
for _, id := range idlist {
if nId.String() == id.String() {
return
}
}
melem := m.AddMapping(n, nId, nil)
melem.SetExpanded(true)
for _, impl := range n.ItsType().Implementation() {
if impl.ImplementationType() == bh.NodeTypeGraph {
for _, nn := range impl.Graph().ProcessingNodes() {
addExpandedMappings(m, nn, nId)
}
}
}
}
开发者ID:axel-freesp,项目名称:sge,代码行数:18,代码来源:mapping.go
示例4: 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
}
开发者ID:axel-freesp,项目名称:sge,代码行数:44,代码来源:arch.go
示例5: 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
}
开发者ID:axel-freesp,项目名称:sge,代码行数:19,代码来源:backendconversions.go
示例6: MappingApplyHints
func MappingApplyHints(m mp.MappingIf, xmlhints *backend.XmlMappingHint) (err error) {
if m.Filename() != xmlhints.Ref {
err = fmt.Errorf("MappingApplyHints error: filename mismatch\n")
return
}
//log.Printf("MappingApplyHints: xmlhints = %v\n", xmlhints)
for _, nId := range m.MappedIds() {
melem, ok := m.MappedElement(nId)
if !ok {
log.Fatalf("MappingApplyHints internal error: %v has no mapping\n", nId)
}
log.Printf("MappingApplyHints: %v\n", nId)
xmlh, ok := findMapHint(xmlhints, nId.String())
if ok {
melem.SetExpanded(xmlh.Expanded)
log.Printf("MappingApplyHints: %v expanded: %v\n", nId, melem.Expanded())
freesp.ModePositionerApplyHints(melem, xmlh.XmlModeHint)
for i, xmlp := range xmlh.InPorts {
freesp.ModePositionerApplyHints(&melem.(*mapelem).inports[i], xmlp.XmlModeHint)
}
for i, xmlp := range xmlh.OutPorts {
freesp.ModePositionerApplyHints(&melem.(*mapelem).outports[i], xmlp.XmlModeHint)
}
}
}
return
}
开发者ID:axel-freesp,项目名称:sge,代码行数:27,代码来源:mapping.go
示例7: CreateXmlMappingHint
func CreateXmlMappingHint(m mp.MappingIf) (xmlm *backend.XmlMappingHint) {
xmlm = backend.XmlMappingHintNew(m.Filename())
for _, nId := range m.MappedIds() {
melem, ok := m.MappedElement(nId)
if !ok {
log.Fatal("CreateXmlMappingHint internal error: inconsistent maplist.\n")
}
log.Printf("CreateXmlMappingHint(%s): nId=%s, melem.mode=%v, pos=%v\n", melem.NodeId(), nId.String(), melem.ActiveMode(), melem.Position())
xmln := backend.XmlNodePosHintNew(nId.String())
empty := image.Point{}
for _, mod := range gr.ValidModes {
pos := melem.ModePosition(mod)
log.Printf("mod %v, pos=%v\n", mod, pos)
if pos != empty {
xmln.Entry = append(xmln.Entry, *backend.XmlModeHintEntryNew(string(mod), pos.X, pos.Y))
}
}
for i, p := range melem.(*mapelem).inports {
xmlp := backend.XmlPortPosHintNew(melem.(*mapelem).node.InPorts()[i].Name())
log.Printf("CreateXmlMappingHint(inports): xmlp=%s\n", xmlp.Name)
for _, mod := range gr.ValidModes {
pos := p.ModePosition(mod)
log.Printf(" mod %v, pos=%v\n", mod, pos)
if pos != empty {
xmlp.Entry = append(xmlp.Entry, *backend.XmlModeHintEntryNew(string(mod), pos.X, pos.Y))
}
}
xmln.InPorts = append(xmln.InPorts, *xmlp)
}
for i, p := range melem.(*mapelem).outports {
xmlp := backend.XmlPortPosHintNew(melem.(*mapelem).node.OutPorts()[i].Name())
log.Printf("CreateXmlMappingHint(outports): xmlp=%s\n", xmlp.Name)
for _, mod := range gr.ValidModes {
pos := p.ModePosition(mod)
log.Printf(" mod %v, pos=%v\n", mod, pos)
if pos != empty {
xmlp.Entry = append(xmlp.Entry, *backend.XmlModeHintEntryNew(string(mod), pos.X, pos.Y))
}
}
xmln.OutPorts = append(xmln.InPorts, *xmlp)
}
xmlm.MappedNodes = append(xmlm.MappedNodes, *xmln)
}
return
}
开发者ID:axel-freesp,项目名称:sge,代码行数:45,代码来源:backendconversions.go
注:本文中的github.com/axel-freesp/sge/interface/mapping.MappingIf类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论