diff options
Diffstat (limited to 'src/server/events/CreateGraph.cpp')
-rw-r--r-- | src/server/events/CreateGraph.cpp | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp index 2a74ddf0..7a8a973d 100644 --- a/src/server/events/CreateGraph.cpp +++ b/src/server/events/CreateGraph.cpp @@ -35,7 +35,6 @@ #include "ingen/URIs.hpp" #include "ingen/World.hpp" #include "ingen/paths.hpp" -#include "raul/Maid.hpp" #include "raul/Path.hpp" #include "raul/Symbol.hpp" @@ -45,23 +44,18 @@ #include <memory> #include <utility> -namespace ingen { -namespace server { -namespace events { +namespace ingen::server::events { CreateGraph::CreateGraph(Engine& engine, const std::shared_ptr<Interface>& client, int32_t id, SampleCount timestamp, raul::Path path, - const Properties& properties) + Properties properties) : Event(engine, client, id, timestamp) , _path(std::move(path)) - , _properties(properties) - , _graph(nullptr) - , _parent(nullptr) -{ -} + , _properties(std::move(properties)) +{} CreateGraph::~CreateGraph() = default; @@ -136,11 +130,9 @@ CreateGraph::pre_process(PreProcessContext& ctx) const ingen::URIs& uris = _engine.world().uris(); - using iterator = Properties::const_iterator; - - uint32_t ext_poly = 1; - uint32_t int_poly = 1; - iterator p = _properties.find(uris.ingen_polyphony); + uint32_t ext_poly = 1; + uint32_t int_poly = 1; + const auto p = _properties.find(uris.ingen_polyphony); if (p != _properties.end() && p->second.type() == uris.forge.Int) { int_poly = p->second.get<int32_t>(); } @@ -156,7 +148,7 @@ CreateGraph::pre_process(PreProcessContext& ctx) const raul::Symbol symbol(_path.is_root() ? "graph" : _path.symbol()); // Get graph prototype - iterator t = _properties.find(uris.lv2_prototype); + auto t = _properties.find(uris.lv2_prototype); if (t == _properties.end()) { t = _properties.find(uris.lv2_prototype); } @@ -171,8 +163,10 @@ CreateGraph::pre_process(PreProcessContext& ctx) if (!ancestor) { return Event::pre_process_done(Status::PROTOTYPE_NOT_FOUND, prototype); - } else if (!(_graph = dynamic_cast<GraphImpl*>( - ancestor->duplicate(_engine, symbol, _parent)))) { + } + + if (!(_graph = dynamic_cast<GraphImpl*>( + ancestor->duplicate(_engine, symbol, _parent)))) { return Event::pre_process_done(Status::CREATION_FAILED, _path); } } else { @@ -197,7 +191,7 @@ CreateGraph::pre_process(PreProcessContext& ctx) if (_parent->enabled()) { _graph->enable(); } - _compiled_graph = ctx.maybe_compile(*_engine.maid(), *_parent); + _compiled_graph = ctx.maybe_compile(*_parent); } _graph->activate(*_engine.buffer_factory()); @@ -224,7 +218,8 @@ CreateGraph::execute(RunContext& ctx) if (_graph) { if (_parent) { if (_compiled_graph) { - _parent->set_compiled_graph(std::move(_compiled_graph)); + _compiled_graph = + _parent->swap_compiled_graph(std::move(_compiled_graph)); } } else { _engine.set_root_graph(_graph); @@ -240,7 +235,7 @@ CreateGraph::execute(RunContext& ctx) void CreateGraph::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS) { _update.send(*_engine.broadcaster()); } @@ -258,6 +253,4 @@ CreateGraph::undo(Interface& target) target.del(_graph->uri()); } -} // namespace events -} // namespace server -} // namespace ingen +} // namespace ingen::server::events |