diff options
Diffstat (limited to 'src/server/CompiledGraph.cpp')
-rw-r--r-- | src/server/CompiledGraph.cpp | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/src/server/CompiledGraph.cpp b/src/server/CompiledGraph.cpp index f03187ae..89fc8843 100644 --- a/src/server/CompiledGraph.cpp +++ b/src/server/CompiledGraph.cpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2015-2017 David Robillard <http://drobilla.net/> + Copyright 2015-2024 David Robillard <http://drobilla.net/> Ingen is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free @@ -21,13 +21,12 @@ #include "GraphImpl.hpp" #include "ThreadManager.hpp" -#include "ingen/Atom.hpp" -#include "ingen/ColorContext.hpp" -#include "ingen/Configuration.hpp" -#include "ingen/Log.hpp" -#include "ingen/World.hpp" -#include "raul/Maid.hpp" -#include "raul/Path.hpp" +#include <ingen/Atom.hpp> +#include <ingen/ColorContext.hpp> +#include <ingen/Configuration.hpp> +#include <ingen/Log.hpp> +#include <ingen/World.hpp> +#include <raul/Path.hpp> #include <boost/intrusive/slist.hpp> @@ -36,12 +35,12 @@ #include <cstdint> #include <cstdio> #include <exception> +#include <functional> #include <limits> #include <memory> #include <utility> -namespace ingen { -namespace server { +namespace ingen::server { /** Graph contains ambiguous feedback with no delay nodes. */ class FeedbackException : public std::exception @@ -62,13 +61,11 @@ public: static bool has_provider_with_many_dependants(const BlockImpl* n) { - for (const auto* p : n->providers()) { - if (p->dependants().size() > 1) { - return true; - } - } - - return false; + return std::any_of(n->providers().begin(), + n->providers().end(), + [](const auto* p) { + return p->dependants().size() > 1; + }); } CompiledGraph::CompiledGraph(GraphImpl* graph) @@ -77,11 +74,11 @@ CompiledGraph::CompiledGraph(GraphImpl* graph) compile_graph(graph); } -raul::managed_ptr<CompiledGraph> -CompiledGraph::compile(raul::Maid& maid, GraphImpl& graph) +std::unique_ptr<CompiledGraph> +CompiledGraph::compile(GraphImpl& graph) { try { - return maid.make_managed<CompiledGraph>(&graph); + return std::unique_ptr<CompiledGraph>(new CompiledGraph(&graph)); } catch (const FeedbackException& e) { Log& log = graph.engine().log(); if (e.node && e.root) { @@ -97,13 +94,11 @@ CompiledGraph::compile(raul::Maid& maid, GraphImpl& graph) static size_t num_unvisited_dependants(const BlockImpl* block) { - size_t count = 0; - for (const BlockImpl* b : block->dependants()) { - if (b->get_mark() == BlockImpl::Mark::UNVISITED) { - ++count; - } - } - return count; + return std::count_if(block->dependants().begin(), + block->dependants().end(), + [](const auto* b) { + return b->get_mark() == BlockImpl::Mark::UNVISITED; + }); } static size_t @@ -162,7 +157,7 @@ CompiledGraph::compile_graph(GraphImpl* graph) _master = Task::simplify(std::move(_master)); if (graph->engine().world().conf().option("trace").get<int32_t>()) { - ColorContext ctx(stderr, ColorContext::Color::YELLOW); + const ColorContext ctx{stderr, ColorContext::Color::YELLOW}; dump(graph->path()); } } @@ -287,5 +282,4 @@ CompiledGraph::dump(const std::string& name) const sink(")\n"); } -} // namespace server -} // namespace ingen +} // namespace ingen::server |