| 80 | } |
| 81 | |
| 82 | NodeDefPtr Node::getNodeDef(const string& target, bool allowRoughMatch) const |
| 83 | { |
| 84 | if (hasNodeDefString()) |
| 85 | { |
| 86 | return resolveNameReference<NodeDef>(getNodeDefString()); |
| 87 | } |
| 88 | vector<NodeDefPtr> nodeDefs = getDocument()->getMatchingNodeDefs(getQualifiedName(getCategory())); |
| 89 | vector<NodeDefPtr> secondary = getDocument()->getMatchingNodeDefs(getCategory()); |
| 90 | vector<NodeDefPtr> roughMatches; |
| 91 | nodeDefs.insert(nodeDefs.end(), secondary.begin(), secondary.end()); |
| 92 | for (NodeDefPtr nodeDef : nodeDefs) |
| 93 | { |
| 94 | if (!targetStringsMatch(nodeDef->getTarget(), target) || |
| 95 | !nodeDef->isVersionCompatible(getVersionString()) || |
| 96 | nodeDef->getType() != getType()) |
| 97 | { |
| 98 | continue; |
| 99 | } |
| 100 | if (!hasExactInputMatch(nodeDef)) |
| 101 | { |
| 102 | if (allowRoughMatch) |
| 103 | { |
| 104 | roughMatches.push_back(nodeDef); |
| 105 | } |
| 106 | continue; |
| 107 | } |
| 108 | return nodeDef; |
| 109 | } |
| 110 | if (!roughMatches.empty()) |
| 111 | { |
| 112 | return roughMatches[0]; |
| 113 | } |
| 114 | return NodeDefPtr(); |
| 115 | } |
| 116 | |
| 117 | Edge Node::getUpstreamEdge(size_t index) const |
| 118 | { |