diff options
Diffstat (limited to 'src/server/events')
24 files changed, 108 insertions, 157 deletions
diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index 386ed74d..e1854ef2 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -42,9 +42,7 @@ #include <set> #include <utility> -namespace ingen { -namespace server { -namespace events { +namespace ingen::server::events { Connect::Connect(Engine& engine, const std::shared_ptr<Interface>& client, @@ -59,7 +57,7 @@ Connect::~Connect() = default; bool Connect::pre_process(PreProcessContext& ctx) { - std::lock_guard<Store::Mutex> lock(_engine.store()->mutex()); + const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()}; Node* tail = _engine.store()->get(_msg.tail); if (!tail) { @@ -134,7 +132,7 @@ Connect::pre_process(PreProcessContext& ctx) head_block->providers().insert(tail_block); if (ctx.must_compile(*_graph)) { - if (!(_compiled_graph = compile(*_engine.maid(), *_graph))) { + if (!(_compiled_graph = compile(*_graph))) { head_block->providers().erase(tail_block); tail_block->dependants().erase(head_block); return Event::pre_process_done(Status::COMPILATION_FAILED); @@ -167,7 +165,7 @@ Connect::execute(RunContext& ctx) } _head->connect_buffers(); if (_compiled_graph) { - _graph->set_compiled_graph(std::move(_compiled_graph)); + _compiled_graph = _graph->swap_compiled_graph(std::move(_compiled_graph)); } } } @@ -175,7 +173,7 @@ Connect::execute(RunContext& ctx) void Connect::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS) { _engine.broadcaster()->message(_msg); if (!_tail_remove.empty() || !_tail_add.empty()) { @@ -195,6 +193,4 @@ Connect::undo(Interface& target) target.disconnect(_msg.tail, _msg.head); } -} // namespace events -} // namespace server -} // namespace ingen +} // namespace ingen::server::events diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp index a735b68c..4224f109 100644 --- a/src/server/events/Connect.hpp +++ b/src/server/events/Connect.hpp @@ -66,7 +66,7 @@ private: const ingen::Connect _msg; GraphImpl* _graph{nullptr}; InputPort* _head{nullptr}; - raul::managed_ptr<CompiledGraph> _compiled_graph; + std::unique_ptr<CompiledGraph> _compiled_graph; std::shared_ptr<ArcImpl> _arc; raul::managed_ptr<PortImpl::Voices> _voices; Properties _tail_remove; diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp index beb5224c..f6529da3 100644 --- a/src/server/events/Copy.cpp +++ b/src/server/events/Copy.cpp @@ -24,6 +24,7 @@ #include "PreProcessContext.hpp" #include "ingen/Interface.hpp" +#include "ingen/Node.hpp" #include "ingen/Parser.hpp" #include "ingen/Serialiser.hpp" #include "ingen/Status.hpp" @@ -34,17 +35,15 @@ #include "raul/Path.hpp" #include "raul/Symbol.hpp" -#include <boost/optional/optional.hpp> - #include <map> #include <memory> #include <mutex> +#include <optional> #include <string> +#include <string_view> #include <utility> -namespace ingen { -namespace server { -namespace events { +namespace ingen::server::events { Copy::Copy(Engine& engine, const std::shared_ptr<Interface>& client, @@ -59,7 +58,7 @@ Copy::~Copy() = default; bool Copy::pre_process(PreProcessContext& ctx) { - std::lock_guard<Store::Mutex> lock(_engine.store()->mutex()); + const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()}; if (uri_is_path(_msg.old_uri)) { // Old URI is a path within the engine @@ -138,7 +137,7 @@ Copy::engine_to_engine(PreProcessContext& ctx) _engine.store()->add(_block); // Compile graph with new block added for insertion in audio thread - _compiled_graph = ctx.maybe_compile(*_engine.maid(), *_parent); + _compiled_graph = ctx.maybe_compile(*_parent); return Event::pre_process_done(Status::SUCCESS); } @@ -165,7 +164,7 @@ Copy::engine_to_filesystem(PreProcessContext&) return Event::pre_process_done(Status::INTERNAL_ERROR); } - std::lock_guard<std::mutex> lock(_engine.world().rdf_mutex()); + const std::lock_guard<std::mutex> lock{_engine.world().rdf_mutex()}; if (ends_with(_msg.new_uri, ".ingen") || ends_with(_msg.new_uri, ".ingen/")) { _engine.world().serialiser()->write_bundle(graph, URI(_msg.new_uri)); @@ -186,13 +185,13 @@ Copy::filesystem_to_engine(PreProcessContext&) return Event::pre_process_done(Status::INTERNAL_ERROR); } - std::lock_guard<std::mutex> lock(_engine.world().rdf_mutex()); + const std::lock_guard<std::mutex> lock{_engine.world().rdf_mutex()}; // Old URI is a filesystem path and new URI is a path within the engine - const std::string src_path(_msg.old_uri.path()); - const raul::Path dst_path = uri_to_path(_msg.new_uri); - boost::optional<raul::Path> dst_parent; - boost::optional<raul::Symbol> dst_symbol; + const std::string src_path(_msg.old_uri.path()); + const raul::Path dst_path = uri_to_path(_msg.new_uri); + std::optional<raul::Path> dst_parent; + std::optional<raul::Symbol> dst_symbol; if (!dst_path.is_root()) { dst_parent = dst_path.parent(); dst_symbol = raul::Symbol(dst_path.symbol()); @@ -209,14 +208,15 @@ void Copy::execute(RunContext&) { if (_block && _compiled_graph) { - _parent->set_compiled_graph(std::move(_compiled_graph)); + _compiled_graph = + _parent->swap_compiled_graph(std::move(_compiled_graph)); } } void Copy::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS) { _engine.broadcaster()->message(_msg); } @@ -230,6 +230,4 @@ Copy::undo(Interface& target) } } -} // namespace events -} // namespace server -} // namespace ingen +} // namespace ingen::server::events diff --git a/src/server/events/Copy.hpp b/src/server/events/Copy.hpp index 8460140a..744a61c2 100644 --- a/src/server/events/Copy.hpp +++ b/src/server/events/Copy.hpp @@ -21,7 +21,6 @@ #include "types.hpp" #include "ingen/Message.hpp" -#include "raul/Maid.hpp" #include <memory> @@ -67,7 +66,7 @@ private: std::shared_ptr<BlockImpl> _old_block{nullptr}; GraphImpl* _parent{nullptr}; BlockImpl* _block{nullptr}; - raul::managed_ptr<CompiledGraph> _compiled_graph; + std::unique_ptr<CompiledGraph> _compiled_graph; }; } // namespace events diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index 23a0d35e..7f50411c 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -40,7 +40,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" @@ -48,8 +47,7 @@ #include <memory> #include <utility> -namespace ingen { -namespace server { +namespace ingen::server { class RunContext; @@ -170,7 +168,7 @@ CreateBlock::pre_process(PreProcessContext& ctx) /* Compile graph with new block added for insertion in audio thread TODO: Since the block is not connected at this point, a full compilation could be avoided and the block simply appended. */ - _compiled_graph = ctx.maybe_compile(*_engine.maid(), *_graph); + _compiled_graph = ctx.maybe_compile(*_graph); _update.put_block(_block); @@ -181,14 +179,15 @@ void CreateBlock::execute(RunContext&) { if (_status == Status::SUCCESS && _compiled_graph) { - _graph->set_compiled_graph(std::move(_compiled_graph)); + _compiled_graph = + _graph->swap_compiled_graph(std::move(_compiled_graph)); } } void CreateBlock::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS) { _update.send(*_engine.broadcaster()); } @@ -201,5 +200,4 @@ CreateBlock::undo(Interface& target) } } // namespace events -} // namespace server -} // namespace ingen +} // namespace ingen::server diff --git a/src/server/events/CreateBlock.hpp b/src/server/events/CreateBlock.hpp index 2a7a60ab..e8a49ea0 100644 --- a/src/server/events/CreateBlock.hpp +++ b/src/server/events/CreateBlock.hpp @@ -21,7 +21,6 @@ #include "Event.hpp" #include "types.hpp" -#include "raul/Maid.hpp" #include "raul/Path.hpp" #include <cstdint> @@ -70,7 +69,7 @@ private: ClientUpdate _update; GraphImpl* _graph{nullptr}; BlockImpl* _block{nullptr}; - raul::managed_ptr<CompiledGraph> _compiled_graph; + std::unique_ptr<CompiledGraph> _compiled_graph; }; } // namespace events diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp index c1a30d4d..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,19 +44,17 @@ #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) + , _properties(std::move(properties)) {} CreateGraph::~CreateGraph() = default; @@ -194,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()); @@ -221,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); @@ -237,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()); } @@ -255,6 +253,4 @@ CreateGraph::undo(Interface& target) target.del(_graph->uri()); } -} // namespace events -} // namespace server -} // namespace ingen +} // namespace ingen::server::events diff --git a/src/server/events/CreateGraph.hpp b/src/server/events/CreateGraph.hpp index 46ca3266..b083ae8c 100644 --- a/src/server/events/CreateGraph.hpp +++ b/src/server/events/CreateGraph.hpp @@ -22,7 +22,6 @@ #include "types.hpp" #include "ingen/Properties.hpp" -#include "raul/Maid.hpp" #include "raul/Path.hpp" #include <cstdint> @@ -55,7 +54,7 @@ public: int32_t id, SampleCount timestamp, raul::Path path, - const Properties& properties); + Properties properties); ~CreateGraph() override; @@ -74,7 +73,7 @@ private: ClientUpdate _update; GraphImpl* _graph{nullptr}; GraphImpl* _parent{nullptr}; - raul::managed_ptr<CompiledGraph> _compiled_graph; + std::unique_ptr<CompiledGraph> _compiled_graph; std::list<std::unique_ptr<Event>> _child_events; }; diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index 6eee6ed7..937842a7 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -45,9 +45,7 @@ #include <memory> #include <utility> -namespace ingen { -namespace server { -namespace events { +namespace ingen::server::events { CreatePort::CreatePort(Engine& engine, const std::shared_ptr<Interface>& client, @@ -212,7 +210,7 @@ CreatePort::execute(RunContext& ctx) void CreatePort::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS) { _engine.broadcaster()->put(path_to_uri(_path), _update); } @@ -224,6 +222,4 @@ CreatePort::undo(Interface& target) target.del(_graph_port->uri()); } -} // namespace events -} // namespace server -} // namespace ingen +} // namespace ingen::server::events diff --git a/src/server/events/CreatePort.hpp b/src/server/events/CreatePort.hpp index 3351adc9..6d3e9ca2 100644 --- a/src/server/events/CreatePort.hpp +++ b/src/server/events/CreatePort.hpp @@ -27,10 +27,9 @@ #include "raul/Maid.hpp" #include "raul/Path.hpp" -#include <boost/optional/optional.hpp> - #include <cstdint> #include <memory> +#include <optional> namespace ingen { @@ -81,7 +80,7 @@ private: EnginePort* _engine_port{nullptr}; ///< Driver port if on the root Properties _properties; Properties _update; - boost::optional<Flow> _flow; + std::optional<Flow> _flow; }; } // namespace events diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index aba49adb..62653752 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -48,9 +48,9 @@ #include <memory> #include <mutex> #include <string> +#include <string_view> -namespace ingen { -namespace server { +namespace ingen::server { class RunContext; @@ -104,7 +104,7 @@ Delete::pre_process(PreProcessContext& ctx) } // Take a writer lock while we modify the store - std::lock_guard<Store::Mutex> lock(_engine.store()->mutex()); + const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()}; _engine.store()->remove(iter, _removed_objects); @@ -113,14 +113,14 @@ Delete::pre_process(PreProcessContext& ctx) _disconnect_event = std::make_unique<DisconnectAll>(_engine, parent, _block.get()); _disconnect_event->pre_process(ctx); - _compiled_graph = ctx.maybe_compile(*_engine.maid(), *parent); + _compiled_graph = ctx.maybe_compile(*parent); } else if (_port) { parent->remove_port(*_port); _disconnect_event = std::make_unique<DisconnectAll>(_engine, parent, _port.get()); _disconnect_event->pre_process(ctx); - _compiled_graph = ctx.maybe_compile(*_engine.maid(), *parent); + _compiled_graph = ctx.maybe_compile(*parent); if (parent->enabled()) { _ports_array = parent->build_ports_array(*_engine.maid()); assert(_ports_array->size() == parent->num_ports_non_rt()); @@ -182,14 +182,14 @@ Delete::execute(RunContext& ctx) } if (parent && _compiled_graph) { - parent->set_compiled_graph(std::move(_compiled_graph)); + _compiled_graph = parent->swap_compiled_graph(std::move(_compiled_graph)); } } void Delete::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS && (_block || _port)) { if (_block) { _block->deactivate(); @@ -232,5 +232,4 @@ Delete::undo(Interface& target) } } // namespace events -} // namespace server -} // namespace ingen +} // namespace ingen::server diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp index 7dfb5681..87cde2c7 100644 --- a/src/server/events/Delete.hpp +++ b/src/server/events/Delete.hpp @@ -17,7 +17,6 @@ #ifndef INGEN_EVENTS_DELETE_HPP #define INGEN_EVENTS_DELETE_HPP -#include "BlockImpl.hpp" #include "ControlBindings.hpp" #include "Event.hpp" #include "GraphImpl.hpp" @@ -31,6 +30,7 @@ #include <cstdint> #include <map> #include <memory> +#include <string> #include <utility> #include <vector> @@ -40,6 +40,7 @@ class Interface; namespace server { +class BlockImpl; class CompiledGraph; class DuplexPort; class Engine; @@ -79,7 +80,7 @@ private: std::shared_ptr<DuplexPort> _port; ///< Non-null iff a port EnginePort* _engine_port{nullptr}; raul::managed_ptr<GraphImpl::Ports> _ports_array; ///< New (external) ports for Graph - raul::managed_ptr<CompiledGraph> _compiled_graph; ///< Graph's new process order + std::unique_ptr<CompiledGraph> _compiled_graph; ///< Graph's new process order std::unique_ptr<DisconnectAll> _disconnect_event; Store::Objects _removed_objects; IndexChanges _port_index_changes; diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 71d4b48f..11a0b0ff 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -45,7 +45,6 @@ #include "ingen/World.hpp" #include "ingen/paths.hpp" #include "lilv/lilv.h" -#include "raul/Maid.hpp" #include "raul/Path.hpp" #include <algorithm> @@ -53,11 +52,11 @@ #include <mutex> #include <set> #include <string> +#include <string_view> #include <utility> #include <vector> -namespace ingen { -namespace server { +namespace ingen::server { class PreProcessContext; @@ -213,7 +212,7 @@ Delta::pre_process(PreProcessContext& ctx) return Event::pre_process_done(Status::FAILURE); } - std::lock_guard<Store::Mutex> lock(_engine.store()->mutex()); + const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()}; _object = is_graph_object ? static_cast<ingen::Resource*>(_engine.store()->get(uri_to_path(_subject))) @@ -225,7 +224,7 @@ Delta::pre_process(PreProcessContext& ctx) } if (is_graph_object && !_object) { - raul::Path path(uri_to_path(_subject)); + const raul::Path path{uri_to_path(_subject)}; bool is_graph = false; bool is_block = false; @@ -397,7 +396,7 @@ Delta::pre_process(PreProcessContext& ctx) op = SpecialType::ENABLE; // FIXME: defer until all other data has been processed if (value.get<int32_t>() && !_graph->enabled()) { - if (!(_compiled_graph = compile(*_engine.maid(), *_graph))) { + if (!(_compiled_graph = compile(*_graph))) { _status = Status::COMPILATION_FAILED; } } @@ -516,7 +515,7 @@ Delta::execute(RunContext& ctx) if (_graph) { if (value.get<int32_t>()) { if (_compiled_graph) { - _graph->set_compiled_graph(std::move(_compiled_graph)); + _compiled_graph = _graph->swap_compiled_graph(std::move(_compiled_graph)); } _graph->enable(); } else { @@ -594,7 +593,7 @@ Delta::post_process() _state.reset(); } - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (_create_event) { _create_event->post_process(); @@ -674,5 +673,4 @@ Delta::get_execution() const } } // namespace events -} // namespace server -} // namespace ingen +} // namespace ingen::server diff --git a/src/server/events/Delta.hpp b/src/server/events/Delta.hpp index 7f79ae94..ed04f8c9 100644 --- a/src/server/events/Delta.hpp +++ b/src/server/events/Delta.hpp @@ -27,14 +27,13 @@ #include "ingen/Properties.hpp" #include "ingen/Resource.hpp" #include "ingen/URI.hpp" -#include "raul/Maid.hpp" - -#include <boost/optional/optional.hpp> #include <cstdint> #include <memory> +#include <optional> #include <vector> +// IWYU pragma: no_include "CompiledGraph.hpp" // IWYU pragma: no_include <algorithm> namespace ingen { @@ -46,7 +45,7 @@ struct SetProperty; namespace server { -class CompiledGraph; +class CompiledGraph; // IWYU pragma: keep class Engine; class GraphImpl; class PreProcessContext; @@ -118,7 +117,7 @@ private: ClientUpdate _update; ingen::Resource* _object{nullptr}; GraphImpl* _graph{nullptr}; - raul::managed_ptr<CompiledGraph> _compiled_graph; + std::unique_ptr<CompiledGraph> _compiled_graph; ControlBindings::Binding* _binding{nullptr}; StatePtr _state; Resource::Graph _context; @@ -129,7 +128,7 @@ private: std::vector<ControlBindings::Binding*> _removed_bindings; - boost::optional<Resource> _preset; + std::optional<Resource> _preset; bool _block{false}; }; diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index 3526ac83..e0db262a 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -47,8 +47,7 @@ #include <string> #include <utility> -namespace ingen { -namespace server { +namespace ingen::server { class RunContext; @@ -118,7 +117,7 @@ Disconnect::Impl::Impl(Engine& e, bool Disconnect::pre_process(PreProcessContext& ctx) { - std::lock_guard<Store::Mutex> lock(_engine.store()->mutex()); + const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()}; if (_msg.tail.parent().parent() != _msg.head.parent().parent() && _msg.tail.parent() != _msg.head.parent().parent() @@ -172,7 +171,7 @@ Disconnect::pre_process(PreProcessContext& ctx) dynamic_cast<PortImpl*>(tail), dynamic_cast<InputPort*>(head)); - _compiled_graph = ctx.maybe_compile(*_engine.maid(), *_graph); + _compiled_graph = ctx.maybe_compile(*_graph); return Event::pre_process_done(Status::SUCCESS); } @@ -209,7 +208,8 @@ Disconnect::execute(RunContext& ctx) if (_status == Status::SUCCESS) { if (_impl->execute(ctx, true)) { if (_compiled_graph) { - _graph->set_compiled_graph(std::move(_compiled_graph)); + _compiled_graph = + _graph->swap_compiled_graph(std::move(_compiled_graph)); } } else { _status = Status::NOT_FOUND; @@ -220,7 +220,7 @@ Disconnect::execute(RunContext& ctx) void Disconnect::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS) { _engine.broadcaster()->message(_msg); } @@ -233,5 +233,4 @@ Disconnect::undo(Interface& target) } } // namespace events -} // namespace server -} // namespace ingen +} // namespace ingen::server diff --git a/src/server/events/Disconnect.hpp b/src/server/events/Disconnect.hpp index 71ad4204..ad3d07b0 100644 --- a/src/server/events/Disconnect.hpp +++ b/src/server/events/Disconnect.hpp @@ -83,7 +83,7 @@ private: const ingen::Disconnect _msg; GraphImpl* _graph{nullptr}; std::unique_ptr<Impl> _impl; - raul::managed_ptr<CompiledGraph> _compiled_graph; + std::unique_ptr<CompiledGraph> _compiled_graph; }; } // namespace events diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index 7ae17632..5f0e9a5e 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -32,16 +32,13 @@ #include "ingen/Node.hpp" #include "ingen/Status.hpp" #include "ingen/Store.hpp" -#include "raul/Maid.hpp" #include <memory> #include <mutex> #include <set> #include <utility> -namespace ingen { -namespace server { -namespace events { +namespace ingen::server::events { DisconnectAll::DisconnectAll(Engine& engine, const std::shared_ptr<Interface>& client, @@ -132,7 +129,7 @@ DisconnectAll::pre_process(PreProcessContext& ctx) } if (!_deleting && ctx.must_compile(*_parent)) { - if (!(_compiled_graph = compile(*_engine.maid(), *_parent))) { + if (!(_compiled_graph = compile(*_parent))) { return Event::pre_process_done(Status::COMPILATION_FAILED); } } @@ -151,14 +148,14 @@ DisconnectAll::execute(RunContext& ctx) } if (_compiled_graph) { - _parent->set_compiled_graph(std::move(_compiled_graph)); + _compiled_graph = _parent->swap_compiled_graph(std::move(_compiled_graph)); } } void DisconnectAll::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS) { _engine.broadcaster()->message(_msg); } @@ -193,6 +190,4 @@ DisconnectAll::adjacent_arcs(GraphImpl* const graph) return arcs; } -} // namespace events -} // namespace server -} // namespace ingen +} // namespace ingen::server::events diff --git a/src/server/events/DisconnectAll.hpp b/src/server/events/DisconnectAll.hpp index 70da5dd6..aeb180de 100644 --- a/src/server/events/DisconnectAll.hpp +++ b/src/server/events/DisconnectAll.hpp @@ -22,7 +22,6 @@ #include "types.hpp" #include "ingen/Message.hpp" -#include "raul/Maid.hpp" #include <list> #include <memory> @@ -79,7 +78,7 @@ private: BlockImpl* _block; PortImpl* _port; Impls _impls; - raul::managed_ptr<CompiledGraph> _compiled_graph; + std::unique_ptr<CompiledGraph> _compiled_graph; bool _deleting; }; diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index 389d9e48..9efef123 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -37,9 +37,7 @@ #include <memory> #include <mutex> -namespace ingen { -namespace server { -namespace events { +namespace ingen::server::events { Get::Get(Engine& engine, const std::shared_ptr<Interface>& client, @@ -52,7 +50,7 @@ Get::Get(Engine& engine, bool Get::pre_process(PreProcessContext&) { - std::lock_guard<Store::Mutex> lock(_engine.store()->mutex()); + const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()}; const auto& uri = _msg.subject; if (uri == "ingen:/plugins") { @@ -98,7 +96,7 @@ Get::execute(RunContext&) void Get::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS && _request_client) { if (_msg.subject == "ingen:/plugins") { _engine.broadcaster()->send_plugins_to(_request_client.get(), _plugins); @@ -122,6 +120,4 @@ Get::post_process() } } -} // namespace events -} // namespace server -} // namespace ingen +} // namespace ingen::server::events diff --git a/src/server/events/Mark.cpp b/src/server/events/Mark.cpp index 27ca6630..87bc1035 100644 --- a/src/server/events/Mark.cpp +++ b/src/server/events/Mark.cpp @@ -30,9 +30,7 @@ #include <unordered_set> #include <utility> -namespace ingen { -namespace server { -namespace events { +namespace ingen::server::events { Mark::Mark(Engine& engine, const std::shared_ptr<Interface>& client, @@ -86,7 +84,7 @@ Mark::pre_process(PreProcessContext& ctx) ctx.set_in_bundle(false); if (!ctx.dirty_graphs().empty()) { for (GraphImpl* g : ctx.dirty_graphs()) { - auto cg = compile(*_engine.maid(), *g); + auto cg = compile(*g); if (cg) { _compiled_graphs.emplace(g, std::move(cg)); } @@ -103,7 +101,7 @@ void Mark::execute(RunContext&) { for (auto& g : _compiled_graphs) { - g.first->set_compiled_graph(std::move(g.second)); + g.second = g.first->swap_compiled_graph(std::move(g.second)); } } @@ -136,6 +134,4 @@ Mark::get_execution() const return Execution::NORMAL; } -} // namespace events -} // namespace server -} // namespace ingen +} // namespace ingen::server::events diff --git a/src/server/events/Mark.hpp b/src/server/events/Mark.hpp index 7ebab080..eb99c5a9 100644 --- a/src/server/events/Mark.hpp +++ b/src/server/events/Mark.hpp @@ -20,11 +20,11 @@ #include "Event.hpp" #include "types.hpp" -#include "raul/Maid.hpp" - #include <map> #include <memory> +// IWYU pragma: no_include "CompiledGraph.hpp" + namespace ingen { class Interface; @@ -33,7 +33,7 @@ struct BundleEnd; namespace server { -class CompiledGraph; +class CompiledGraph; // IWYU pragma: keep class Engine; class GraphImpl; class PreProcessContext; @@ -73,8 +73,7 @@ public: private: enum class Type { BUNDLE_BEGIN, BUNDLE_END }; - using CompiledGraphs = - std::map<GraphImpl*, raul::managed_ptr<CompiledGraph>>; + using CompiledGraphs = std::map<GraphImpl*, std::unique_ptr<CompiledGraph>>; CompiledGraphs _compiled_graphs; Type _type; diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp index 8b7ee655..3af0ce6c 100644 --- a/src/server/events/Move.cpp +++ b/src/server/events/Move.cpp @@ -29,8 +29,7 @@ #include <memory> #include <mutex> -namespace ingen { -namespace server { +namespace ingen::server { class EnginePort; @@ -47,7 +46,7 @@ Move::Move(Engine& engine, bool Move::pre_process(PreProcessContext&) { - std::lock_guard<Store::Mutex> lock(_engine.store()->mutex()); + const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()}; if (!_msg.old_path.parent().is_parent_of(_msg.new_path)) { return Event::pre_process_done(Status::PARENT_DIFFERS, _msg.new_path); @@ -79,7 +78,7 @@ Move::execute(RunContext&) void Move::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS) { _engine.broadcaster()->message(_msg); } @@ -92,5 +91,4 @@ Move::undo(Interface& target) } } // namespace events -} // namespace server -} // namespace ingen +} // namespace ingen::server diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp index 8b425571..04da7338 100644 --- a/src/server/events/SetPortValue.cpp +++ b/src/server/events/SetPortValue.cpp @@ -33,9 +33,7 @@ #include <cassert> #include <memory> -namespace ingen { -namespace server { -namespace events { +namespace ingen::server::events { /** Internal */ SetPortValue::SetPortValue(Engine& engine, @@ -56,7 +54,7 @@ SetPortValue::SetPortValue(Engine& engine, bool SetPortValue::pre_process(PreProcessContext&) { - ingen::URIs& uris = _engine.world().uris(); + const ingen::URIs& uris = _engine.world().uris(); if (_port->is_output()) { return Event::pre_process_done(Status::DIRECTION_MISMATCH, _port->path()); } @@ -94,8 +92,8 @@ SetPortValue::apply(RunContext& ctx) return; } - ingen::URIs& uris = _engine.world().uris(); - Buffer* buf = _port->buffer(0).get(); + const ingen::URIs& uris = _engine.world().uris(); + Buffer* buf = _port->buffer(0).get(); if (_buffer) { if (_port->user_buffer(ctx)) { @@ -129,7 +127,7 @@ SetPortValue::apply(RunContext& ctx) void SetPortValue::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS && !_activity) { _engine.broadcaster()->set_property( _port->uri(), @@ -138,6 +136,4 @@ SetPortValue::post_process() } } -} // namespace events -} // namespace server -} // namespace ingen +} // namespace ingen::server::events diff --git a/src/server/events/Undo.cpp b/src/server/events/Undo.cpp index 9d6fcfaa..ea8c7d69 100644 --- a/src/server/events/Undo.cpp +++ b/src/server/events/Undo.cpp @@ -28,9 +28,7 @@ #include <deque> #include <memory> -namespace ingen { -namespace server { -namespace events { +namespace ingen::server::events { Undo::Undo(Engine& engine, const std::shared_ptr<Interface>& client, @@ -89,6 +87,4 @@ Undo::post_process() respond(); } -} // namespace events -} // namespace server -} // namespace ingen +} // namespace ingen::server::events |