diff options
author | David Robillard <d@drobilla.net> | 2020-08-02 13:43:01 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-08-02 13:43:49 +0200 |
commit | 019eeff6a7d051427ad62a288f350e66471a0462 (patch) | |
tree | e43854a6241ba52f244ce75aa8d500849968d4d4 /src/server | |
parent | 7eae940654c8c81c1efc8a055a13c53fab42bf91 (diff) | |
download | ingen-019eeff6a7d051427ad62a288f350e66471a0462.tar.gz ingen-019eeff6a7d051427ad62a288f350e66471a0462.tar.bz2 ingen-019eeff6a7d051427ad62a288f350e66471a0462.zip |
Remove std::unique_ptr alias
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/BlockImpl.hpp | 4 | ||||
-rw-r--r-- | src/server/Engine.cpp | 2 | ||||
-rw-r--r-- | src/server/Engine.hpp | 77 | ||||
-rw-r--r-- | src/server/JackDriver.hpp | 3 | ||||
-rw-r--r-- | src/server/LV2Block.cpp | 3 | ||||
-rw-r--r-- | src/server/LV2Block.hpp | 4 | ||||
-rw-r--r-- | src/server/RunContext.hpp | 11 | ||||
-rw-r--r-- | src/server/Worker.hpp | 19 | ||||
-rw-r--r-- | src/server/events/CreateGraph.hpp | 15 | ||||
-rw-r--r-- | src/server/events/Delete.hpp | 21 | ||||
-rw-r--r-- | src/server/events/Delta.hpp | 5 | ||||
-rw-r--r-- | src/server/events/Disconnect.hpp | 4 | ||||
-rw-r--r-- | src/server/events/Mark.cpp | 7 | ||||
-rw-r--r-- | src/server/events/Undo.cpp | 6 | ||||
-rw-r--r-- | src/server/ingen_lv2.cpp | 14 |
15 files changed, 106 insertions, 89 deletions
diff --git a/src/server/BlockImpl.hpp b/src/server/BlockImpl.hpp index 0fd44989..ffe2aaf9 100644 --- a/src/server/BlockImpl.hpp +++ b/src/server/BlockImpl.hpp @@ -107,7 +107,9 @@ public: virtual LilvState* load_preset(const URI& uri) { return nullptr; } /** Restore `state`. */ - virtual void apply_state(const UPtr<Worker>& worker, const LilvState* state) {} + virtual void + apply_state(const std::unique_ptr<Worker>& worker, const LilvState* state) + {} /** Save current state as preset. */ virtual boost::optional<Resource> diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index fb600644..ae5b297f 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -176,7 +176,7 @@ void Engine::listen() { #ifdef HAVE_SOCKET - _listener = UPtr<SocketListener>(new SocketListener(*this)); + _listener = make_unique<SocketListener>(*this); #endif } diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp index 08ecac98..445ac649 100644 --- a/src/server/Engine.hpp +++ b/src/server/Engine.hpp @@ -31,6 +31,7 @@ #include <condition_variable> #include <cstddef> #include <cstdint> +#include <memory> #include <mutex> #include <random> #include <vector> @@ -136,20 +137,20 @@ public: ingen::World& world() const { return _world; } Log& log() const; - const SPtr<Interface>& interface() const { return _interface; } - const SPtr<EventWriter>& event_writer() const { return _event_writer; } - const UPtr<AtomReader>& atom_interface() const { return _atom_interface; } - const UPtr<BlockFactory>& block_factory() const { return _block_factory; } - const UPtr<Broadcaster>& broadcaster() const { return _broadcaster; } - const UPtr<BufferFactory>& buffer_factory() const { return _buffer_factory; } - const UPtr<ControlBindings>& control_bindings() const { return _control_bindings; } - const SPtr<Driver>& driver() const { return _driver; } - const UPtr<PostProcessor>& post_processor() const { return _post_processor; } - const UPtr<Raul::Maid>& maid() const { return _maid; } - const UPtr<UndoStack>& undo_stack() const { return _undo_stack; } - const UPtr<UndoStack>& redo_stack() const { return _redo_stack; } - const UPtr<Worker>& worker() const { return _worker; } - const UPtr<Worker>& sync_worker() const { return _sync_worker; } + const SPtr<Interface>& interface() const { return _interface; } + const SPtr<EventWriter>& event_writer() const { return _event_writer; } + const std::unique_ptr<AtomReader>& atom_interface() const { return _atom_interface; } + const std::unique_ptr<BlockFactory>& block_factory() const { return _block_factory; } + const std::unique_ptr<Broadcaster>& broadcaster() const { return _broadcaster; } + const std::unique_ptr<BufferFactory>& buffer_factory() const { return _buffer_factory; } + const std::unique_ptr<ControlBindings>& control_bindings() const { return _control_bindings; } + const SPtr<Driver>& driver() const { return _driver; } + const std::unique_ptr<PostProcessor>& post_processor() const { return _post_processor; } + const std::unique_ptr<Raul::Maid>& maid() const { return _maid; } + const std::unique_ptr<UndoStack>& undo_stack() const { return _undo_stack; } + const std::unique_ptr<UndoStack>& redo_stack() const { return _redo_stack; } + const std::unique_ptr<Worker>& worker() const { return _worker; } + const std::unique_ptr<Worker>& sync_worker() const { return _sync_worker; } GraphImpl* root_graph() const { return _root_graph; } void set_root_graph(GraphImpl* graph); @@ -182,30 +183,30 @@ public: private: ingen::World& _world; - SPtr<LV2Options> _options; - UPtr<BufferFactory> _buffer_factory; - UPtr<Raul::Maid> _maid; - SPtr<Driver> _driver; - UPtr<Worker> _worker; - UPtr<Worker> _sync_worker; - UPtr<Broadcaster> _broadcaster; - UPtr<ControlBindings> _control_bindings; - UPtr<BlockFactory> _block_factory; - UPtr<UndoStack> _undo_stack; - UPtr<UndoStack> _redo_stack; - UPtr<PostProcessor> _post_processor; - UPtr<PreProcessor> _pre_processor; - UPtr<SocketListener> _listener; - SPtr<EventWriter> _event_writer; - SPtr<Interface> _interface; - UPtr<AtomReader> _atom_interface; - GraphImpl* _root_graph; - - std::vector<UPtr<Raul::RingBuffer>> _notifications; - std::vector<UPtr<RunContext>> _run_contexts; - uint64_t _cycle_start_time; - Load _run_load; - Clock _clock; + SPtr<LV2Options> _options; + std::unique_ptr<BufferFactory> _buffer_factory; + std::unique_ptr<Raul::Maid> _maid; + SPtr<Driver> _driver; + std::unique_ptr<Worker> _worker; + std::unique_ptr<Worker> _sync_worker; + std::unique_ptr<Broadcaster> _broadcaster; + std::unique_ptr<ControlBindings> _control_bindings; + std::unique_ptr<BlockFactory> _block_factory; + std::unique_ptr<UndoStack> _undo_stack; + std::unique_ptr<UndoStack> _redo_stack; + std::unique_ptr<PostProcessor> _post_processor; + std::unique_ptr<PreProcessor> _pre_processor; + std::unique_ptr<SocketListener> _listener; + SPtr<EventWriter> _event_writer; + SPtr<Interface> _interface; + std::unique_ptr<AtomReader> _atom_interface; + GraphImpl* _root_graph; + + std::vector<std::unique_ptr<Raul::RingBuffer>> _notifications; + std::vector<std::unique_ptr<RunContext>> _run_contexts; + uint64_t _cycle_start_time; + Load _run_load; + Clock _clock; std::mt19937 _rand_engine; std::uniform_real_distribution<float> _uniform_dist; diff --git a/src/server/JackDriver.hpp b/src/server/JackDriver.hpp index 34d25f65..8f5cead5 100644 --- a/src/server/JackDriver.hpp +++ b/src/server/JackDriver.hpp @@ -35,6 +35,7 @@ #include <atomic> #include <cstddef> #include <cstdint> +#include <memory> #include <string> namespace Raul { class Path; } @@ -143,7 +144,7 @@ protected: using Ports = boost::intrusive::slist<EnginePort, boost::intrusive::cache_last<true>>; - using AudioBufPtr = UPtr<float, FreeDeleter<float>>; + using AudioBufPtr = std::unique_ptr<float, FreeDeleter<float>>; Engine& _engine; Ports _ports; diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp index 0bdcacc2..c555ac4a 100644 --- a/src/server/LV2Block.cpp +++ b/src/server/LV2Block.cpp @@ -650,7 +650,8 @@ LV2Block::load_state(World& world, const FilePath& path) } void -LV2Block::apply_state(const UPtr<Worker>& worker, const LilvState* state) +LV2Block::apply_state(const std::unique_ptr<Worker>& worker, + const LilvState* state) { World& world = parent_graph()->engine().world(); SPtr<LV2_Feature> sched; diff --git a/src/server/LV2Block.hpp b/src/server/LV2Block.hpp index 00530862..0413a245 100644 --- a/src/server/LV2Block.hpp +++ b/src/server/LV2Block.hpp @@ -33,6 +33,7 @@ #include <cstdint> #include <cstdlib> #include <cstring> +#include <memory> #include <mutex> namespace ingen { @@ -80,7 +81,8 @@ public: LilvState* load_preset(const URI& uri) override; - void apply_state(const UPtr<Worker>& worker, const LilvState* state) override; + void apply_state(const std::unique_ptr<Worker>& worker, + const LilvState* state) override; boost::optional<Resource> save_preset(const URI& uri, const Properties& props) override; diff --git a/src/server/RunContext.hpp b/src/server/RunContext.hpp index cf2bfe10..10414bde 100644 --- a/src/server/RunContext.hpp +++ b/src/server/RunContext.hpp @@ -24,6 +24,7 @@ #include "raul/RingBuffer.hpp" #include <cstdint> +#include <memory> #include <thread> namespace ingen { @@ -143,11 +144,11 @@ public: protected: void run(); - Engine& _engine; ///< Engine we're running in - Raul::RingBuffer* _event_sink; ///< Port updates from process context - Task* _task; ///< Currently executing task - UPtr<std::thread> _thread; ///< Thread (null for main run context) - unsigned _id; ///< Context ID + Engine& _engine; ///< Engine we're running in + Raul::RingBuffer* _event_sink; ///< Updates from process context + Task* _task; ///< Currently executing task + std::unique_ptr<std::thread> _thread; ///< Thread (or null for main) + unsigned _id; ///< Context ID FrameTime _start; ///< Start frame of this cycle, timeline relative FrameTime _end; ///< End frame of this cycle, timeline relative diff --git a/src/server/Worker.hpp b/src/server/Worker.hpp index ae7e9f1e..cc79629c 100644 --- a/src/server/Worker.hpp +++ b/src/server/Worker.hpp @@ -24,6 +24,7 @@ #include "raul/Semaphore.hpp" #include <cstdint> +#include <memory> #include <thread> namespace ingen { @@ -59,15 +60,15 @@ public: private: SPtr<Schedule> _schedule; - Log& _log; - Raul::Semaphore _sem; - Raul::RingBuffer _requests; - Raul::RingBuffer _responses; - uint8_t* const _buffer; - const uint32_t _buffer_size; - UPtr<std::thread> _thread; - bool _exit_flag; - bool _synchronous; + Log& _log; + Raul::Semaphore _sem; + Raul::RingBuffer _requests; + Raul::RingBuffer _responses; + uint8_t* const _buffer; + const uint32_t _buffer_size; + std::unique_ptr<std::thread> _thread; + bool _exit_flag; + bool _synchronous; void run(); }; diff --git a/src/server/events/CreateGraph.hpp b/src/server/events/CreateGraph.hpp index b755d8f2..7fbf9bdc 100644 --- a/src/server/events/CreateGraph.hpp +++ b/src/server/events/CreateGraph.hpp @@ -25,6 +25,7 @@ #include <cstdint> #include <list> +#include <memory> namespace ingen { namespace server { @@ -57,13 +58,13 @@ public: private: void build_child_events(); - const Raul::Path _path; - Properties _properties; - ClientUpdate _update; - GraphImpl* _graph; - GraphImpl* _parent; - MPtr<CompiledGraph> _compiled_graph; - std::list<UPtr<Event>> _child_events; + const Raul::Path _path; + Properties _properties; + ClientUpdate _update; + GraphImpl* _graph; + GraphImpl* _parent; + MPtr<CompiledGraph> _compiled_graph; + std::list<std::unique_ptr<Event>> _child_events; }; } // namespace events diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp index f4ad278b..c556bbd9 100644 --- a/src/server/events/Delete.hpp +++ b/src/server/events/Delete.hpp @@ -25,6 +25,7 @@ #include <cstdint> #include <map> +#include <memory> #include <utility> #include <vector> @@ -61,16 +62,16 @@ private: using IndexChange = std::pair<uint32_t, uint32_t>; using IndexChanges = std::map<Raul::Path, IndexChange>; - const ingen::Del _msg; - Raul::Path _path; - SPtr<BlockImpl> _block; ///< Non-null iff a block - SPtr<DuplexPort> _port; ///< Non-null iff a port - EnginePort* _engine_port; - MPtr<GraphImpl::Ports> _ports_array; ///< New (external) ports for Graph - MPtr<CompiledGraph> _compiled_graph; ///< Graph's new process order - UPtr<DisconnectAll> _disconnect_event; - Store::Objects _removed_objects; - IndexChanges _port_index_changes; + const ingen::Del _msg; + Raul::Path _path; + SPtr<BlockImpl> _block; ///< Non-null iff a block + SPtr<DuplexPort> _port; ///< Non-null iff a port + EnginePort* _engine_port; + MPtr<GraphImpl::Ports> _ports_array; ///< New (external) ports for Graph + MPtr<CompiledGraph> _compiled_graph; ///< Graph's new process order + std::unique_ptr<DisconnectAll> _disconnect_event; + Store::Objects _removed_objects; + IndexChanges _port_index_changes; std::vector<ControlBindings::Binding*> _removed_bindings; }; diff --git a/src/server/events/Delta.hpp b/src/server/events/Delta.hpp index b5559d84..c4199262 100644 --- a/src/server/events/Delta.hpp +++ b/src/server/events/Delta.hpp @@ -27,6 +27,7 @@ #include <algorithm> #include <cstdint> +#include <memory> #include <vector> namespace ingen { @@ -95,11 +96,11 @@ private: LOADED_BUNDLE }; - using SetEvents = std::vector<UPtr<SetPortValue>>; + using SetEvents = std::vector<std::unique_ptr<SetPortValue>>; void init(); - UPtr<Event> _create_event; + std::unique_ptr<Event> _create_event; SetEvents _set_events; std::vector<SpecialType> _types; std::vector<SpecialType> _remove_types; diff --git a/src/server/events/Disconnect.hpp b/src/server/events/Disconnect.hpp index 4b5f6aea..d6a455c8 100644 --- a/src/server/events/Disconnect.hpp +++ b/src/server/events/Disconnect.hpp @@ -22,6 +22,8 @@ #include "PortImpl.hpp" #include "types.hpp" +#include <memory> + namespace ingen { namespace server { @@ -67,7 +69,7 @@ public: private: const ingen::Disconnect _msg; GraphImpl* _graph; - UPtr<Impl> _impl; + std::unique_ptr<Impl> _impl; MPtr<CompiledGraph> _compiled_graph; }; diff --git a/src/server/events/Mark.cpp b/src/server/events/Mark.cpp index 103c5b3c..d7eb1804 100644 --- a/src/server/events/Mark.cpp +++ b/src/server/events/Mark.cpp @@ -20,6 +20,7 @@ #include "PreProcessContext.hpp" #include "UndoStack.hpp" +#include <memory> #include <utility> namespace ingen { @@ -47,9 +48,9 @@ Mark::Mark(Engine& engine, void Mark::mark(PreProcessContext&) { - const UPtr<UndoStack>& stack = ((_mode == Mode::UNDO) - ? _engine.redo_stack() - : _engine.undo_stack()); + const std::unique_ptr<UndoStack>& stack = ((_mode == Mode::UNDO) + ? _engine.redo_stack() + : _engine.undo_stack()); switch (_type) { case Type::BUNDLE_BEGIN: diff --git a/src/server/events/Undo.cpp b/src/server/events/Undo.cpp index 9a60c15f..c855dbfb 100644 --- a/src/server/events/Undo.cpp +++ b/src/server/events/Undo.cpp @@ -46,8 +46,10 @@ Undo::Undo(Engine& engine, bool Undo::pre_process(PreProcessContext&) { - const UPtr<UndoStack>& stack = _is_redo ? _engine.redo_stack() : _engine.undo_stack(); - const Event::Mode mode = _is_redo ? Event::Mode::REDO : Event::Mode::UNDO; + const std::unique_ptr<UndoStack>& stack = + _is_redo ? _engine.redo_stack() : _engine.undo_stack(); + + const Event::Mode mode = _is_redo ? Event::Mode::REDO : Event::Mode::UNDO; if (stack->empty()) { return Event::pre_process_done(Status::NOT_FOUND); diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index 9b66fe7c..cc42b3ac 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -451,12 +451,12 @@ ingen_lv2_main(const SPtr<Engine>& engine, const SPtr<LV2Driver>& driver) } struct IngenPlugin { - UPtr<ingen::World> world; - SPtr<Engine> engine; - UPtr<std::thread> main; - LV2_URID_Map* map = nullptr; - int argc = 0; - char** argv = nullptr; + std::unique_ptr<ingen::World> world; + SPtr<Engine> engine; + std::unique_ptr<std::thread> main; + LV2_URID_Map* map = nullptr; + int argc = 0; + char** argv = nullptr; }; static Lib::Graphs @@ -539,7 +539,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor, auto* plugin = new IngenPlugin(); plugin->map = map; - plugin->world = UPtr<ingen::World>(new ingen::World(map, unmap, log)); + plugin->world = make_unique<ingen::World>(map, unmap, log); plugin->world->load_configuration(plugin->argc, plugin->argv); LV2_URID bufsz_max = map->map(map->handle, LV2_BUF_SIZE__maxBlockLength); |