11 #ifndef smtk_graph_RuntimeArc_h
12 #define smtk_graph_RuntimeArc_h
14 #include "smtk/graph/Component.h"
15 #include "smtk/graph/Directionality.h"
16 #include "smtk/string/Token.h"
18 #include <unordered_set>
29 template<Directionality Direction>
30 struct SMTK_ALWAYS_EXPORT RuntimeArc
32 using FromType = Component;
33 using ToType = Component;
35 typename std::conditional<Direction == IsDirected, std::true_type, std::false_type>::type;
37 RuntimeArc() =
default;
40 const std::unordered_set<smtk::string::Token>& fromNodeSpecs,
41 const std::unordered_set<smtk::string::Token>& toNodeSpecs,
43 : m_selfType(declaredType)
44 , m_fromNodeSpecs(fromNodeSpecs)
45 , m_toNodeSpecs(toNodeSpecs)
48 for (
const auto& fromNodeSpec : fromNodeSpecs)
50 if (!fromNodeSpec.valid())
54 m_fromNodeOps.emplace_back(resource->
queryOperation(fromNodeSpec.data()));
56 for (
const auto& toNodeSpec : toNodeSpecs)
58 if (!toNodeSpec.valid())
62 m_toNodeOps.emplace_back(resource->
queryOperation(toNodeSpec.data()));
90 static bool checkNodeMatch(
93 const std::unordered_set<smtk::string::Token>& typeRules,
94 const std::vector<std::function<
bool(
const Component&)>>& opRules)
98 if (it != typeRules.end())
105 opRules.begin(), opRules.end(), [node](std::function<
bool(
const Component&)> opRule) {
106 return opRule(*node);
111 std::unordered_set<smtk::string::Token> m_fromNodeSpecs;
112 std::unordered_set<smtk::string::Token> m_toNodeSpecs;
113 std::vector<std::function<bool(
const Component&)>> m_fromNodeOps;
114 std::vector<std::function<bool(
const Component&)>> m_toNodeOps;
120 #endif // smtk_graph_RuntimeArc_h