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 }
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 }