44 = boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, GraphVertex>;
52 score::hash_map<PluginKey, int64_t> keys;
53 std::vector<const score::Addon*> not_loaded;
58 auto vx = boost::add_vertex(
GraphVertex{&addon}, m_graph);
65 auto addon_k = keys[addon.key];
66 for(
const auto& k : addon.plugin->required())
68 auto it = keys.find(k);
71 boost::add_edge(addon_k, it->second, m_graph);
75 boost::clear_vertex(addon_k, m_graph);
76 boost::remove_vertex(addon_k, m_graph);
77 not_loaded.push_back(&addon);
83 if(!not_loaded.empty())
84 qDebug() << not_loaded.size()
85 <<
"plugins were not loaded due to a dependency problem.";
89 ossia::int_vector topo_order;
90 topo_order.reserve(addons.size() - not_loaded.size());
94 boost::topological_sort(m_graph, std::back_inserter(topo_order));
95 for(
auto e : topo_order)
98 m_sorted.push_back(*m_graph[e].addon);
101 catch(
const std::exception& e)
103 qDebug() <<
"Invalid plug-in graph: " << e.what();
108 auto& sortedAddons()
const {
return m_sorted; }
112 std::vector<score::Addon> m_sorted;