diff options
Diffstat (limited to 'include/ingen')
26 files changed, 239 insertions, 216 deletions
diff --git a/include/ingen/DataAccess.hpp b/include/ingen/DataAccess.hpp index 49bb6102..1763c54f 100644 --- a/include/ingen/DataAccess.hpp +++ b/include/ingen/DataAccess.hpp @@ -21,7 +21,6 @@ #include "ingen/Node.hpp" #include "ingen/Store.hpp" #include "ingen/World.hpp" -#include "ingen/memory.hpp" #include "lilv/lilv.h" #include "lv2/core/lv2.h" #include "lv2/data-access/data-access.h" @@ -41,7 +40,7 @@ struct DataAccess : public ingen::LV2Features::Feature const char* uri() const override { return "http://lv2plug.in/ns/ext/data-access"; } - SPtr<LV2_Feature> feature(World& world, Node* node) override { + std::shared_ptr<LV2_Feature> feature(World& world, Node* node) override { Node* store_node = world.store()->get(node->path()); if (!store_node) { return nullptr; diff --git a/include/ingen/EngineBase.hpp b/include/ingen/EngineBase.hpp index f74612ac..1b6b105a 100644 --- a/include/ingen/EngineBase.hpp +++ b/include/ingen/EngineBase.hpp @@ -18,11 +18,11 @@ #define INGEN_ENGINEBASE_HPP #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include <chrono> #include <cstddef> #include <cstdint> +#include <memory> namespace ingen { @@ -132,12 +132,13 @@ public: /** Register a client to receive updates about engine changes. */ - virtual void register_client(const SPtr<Interface>& client) = 0; + virtual void register_client(const std::shared_ptr<Interface>& client) = 0; /** Unregister a client. */ - virtual bool unregister_client(const SPtr<Interface>& client) = 0; + virtual bool + unregister_client(const std::shared_ptr<Interface>& client) = 0; }; } // namespace ingen diff --git a/include/ingen/InstanceAccess.hpp b/include/ingen/InstanceAccess.hpp index 500f4902..ef8b3be0 100644 --- a/include/ingen/InstanceAccess.hpp +++ b/include/ingen/InstanceAccess.hpp @@ -21,7 +21,6 @@ #include "ingen/Node.hpp" #include "ingen/Store.hpp" #include "ingen/World.hpp" -#include "ingen/memory.hpp" #include "lilv/lilv.h" #include "lv2/core/lv2.h" @@ -34,7 +33,7 @@ struct InstanceAccess : public ingen::LV2Features::Feature { const char* uri() const override { return "http://lv2plug.in/ns/ext/instance-access"; } - SPtr<LV2_Feature> feature(World& world, Node* node) override { + std::shared_ptr<LV2_Feature> feature(World& world, Node* node) override { Node* store_node = world.store()->get(node->path()); if (!store_node) { return nullptr; diff --git a/include/ingen/Interface.hpp b/include/ingen/Interface.hpp index 98c0d4cd..68de5684 100644 --- a/include/ingen/Interface.hpp +++ b/include/ingen/Interface.hpp @@ -26,9 +26,9 @@ #include "ingen/Resource.hpp" #include "ingen/Status.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include <cstdint> +#include <memory> #include <string> namespace Raul { @@ -55,9 +55,9 @@ public: virtual URI uri() const = 0; - virtual SPtr<Interface> respondee() const { return nullptr; } + virtual std::shared_ptr<Interface> respondee() const { return nullptr; } - virtual void set_respondee(const SPtr<Interface>& respondee) {} + virtual void set_respondee(const std::shared_ptr<Interface>& respondee) {} virtual void message(const Message& msg) = 0; diff --git a/include/ingen/LV2Features.hpp b/include/ingen/LV2Features.hpp index 792ee9d9..e00e869c 100644 --- a/include/ingen/LV2Features.hpp +++ b/include/ingen/LV2Features.hpp @@ -18,10 +18,10 @@ #define INGEN_LV2FEATURES_HPP #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "lv2/core/lv2.h" #include "raul/Noncopyable.hpp" +#include <memory> #include <string> #include <vector> @@ -43,10 +43,10 @@ public: virtual const char* uri() const = 0; - virtual SPtr<LV2_Feature> feature(World& world, - Node* block) = 0; + virtual std::shared_ptr<LV2_Feature> + feature(World& world, Node* block) = 0; -protected: + protected: static void free_feature(LV2_Feature* feature); }; @@ -56,7 +56,8 @@ protected: const char* uri() const override { return _uri; } - SPtr<LV2_Feature> feature(World& world, Node* block) override { + std::shared_ptr<LV2_Feature> feature(World& world, Node* block) override + { return nullptr; } @@ -65,7 +66,7 @@ protected: class FeatureArray : public Raul::Noncopyable { public: - using FeatureVector = std::vector<SPtr<LV2_Feature>>; + using FeatureVector = std::vector<std::shared_ptr<LV2_Feature>>; explicit FeatureArray(FeatureVector& features); @@ -78,13 +79,13 @@ protected: LV2_Feature** _array; }; - void add_feature(const SPtr<Feature>& feature); + void add_feature(const std::shared_ptr<Feature>& feature); bool is_supported(const std::string& uri) const; - SPtr<FeatureArray> lv2_features(World& world, Node* node) const; + std::shared_ptr<FeatureArray> lv2_features(World& world, Node* node) const; private: - using Features = std::vector<SPtr<Feature>>; + using Features = std::vector<std::shared_ptr<Feature>>; Features _features; }; diff --git a/include/ingen/Log.hpp b/include/ingen/Log.hpp index 96f03ae2..ae8e7539 100644 --- a/include/ingen/Log.hpp +++ b/include/ingen/Log.hpp @@ -20,7 +20,6 @@ #include "ingen/LV2Features.hpp" #include "ingen/fmt.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "lv2/core/lv2.h" #include "lv2/log/log.h" #include "lv2/urid/urid.h" @@ -28,6 +27,7 @@ #include <cstdarg> #include <cstdio> #include <functional> +#include <memory> #include <string> #include <utility> @@ -46,7 +46,8 @@ public: struct Feature : public LV2Features::Feature { const char* uri() const override { return LV2_LOG__log; } - SPtr<LV2_Feature> feature(World& world, Node* block) override; + std::shared_ptr<LV2_Feature> + feature(World& world, Node* block) override; struct Handle { LV2_Log_Log lv2_log; diff --git a/include/ingen/Node.hpp b/include/ingen/Node.hpp index fd96d628..1a6b102a 100644 --- a/include/ingen/Node.hpp +++ b/include/ingen/Node.hpp @@ -19,12 +19,12 @@ #include "ingen/Resource.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "ingen/paths.hpp" #include "lilv/lilv.h" #include <cstdint> #include <map> +#include <memory> #include <string> #include <utility> @@ -62,7 +62,7 @@ public: }; using ArcsKey = std::pair<const Node*, const Node*>; - using Arcs = std::map<ArcsKey, SPtr<Arc>>; + using Arcs = std::map<ArcsKey, std::shared_ptr<Arc>>; // Graphs only Arcs& arcs() { return _arcs; } diff --git a/include/ingen/QueuedInterface.hpp b/include/ingen/QueuedInterface.hpp index c54d2b01..e1818232 100644 --- a/include/ingen/QueuedInterface.hpp +++ b/include/ingen/QueuedInterface.hpp @@ -20,6 +20,7 @@ #include "ingen/Interface.hpp" #include "ingen/Message.hpp" +#include <memory> #include <mutex> #include <vector> @@ -32,7 +33,10 @@ namespace ingen { class QueuedInterface : public Interface { public: - explicit QueuedInterface(SPtr<Interface> sink) : _sink(std::move(sink)) {} + explicit QueuedInterface(std::shared_ptr<Interface> sink) + : _sink(std::move(sink)) + { + } URI uri() const override { return URI("ingen:/QueuedInterface"); } @@ -53,12 +57,12 @@ public: } } - const SPtr<Interface>& sink() const { return _sink; } + const std::shared_ptr<Interface>& sink() const { return _sink; } private: - std::mutex _mutex; - SPtr<Interface> _sink; - std::vector<Message> _messages; + std::mutex _mutex; + std::shared_ptr<Interface> _sink; + std::vector<Message> _messages; }; } // namespace ingen diff --git a/include/ingen/Resource.hpp b/include/ingen/Resource.hpp index 481e4c30..e4a7972e 100644 --- a/include/ingen/Resource.hpp +++ b/include/ingen/Resource.hpp @@ -24,6 +24,7 @@ #include "raul/Deletable.hpp" #include <cassert> +#include <utility> namespace ingen { diff --git a/include/ingen/Serialiser.hpp b/include/ingen/Serialiser.hpp index 103a4822..fd5b50b3 100644 --- a/include/ingen/Serialiser.hpp +++ b/include/ingen/Serialiser.hpp @@ -20,7 +20,6 @@ #include "ingen/FilePath.hpp" #include "ingen/Properties.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "sord/sordmm.hpp" #include <memory> @@ -48,8 +47,8 @@ public: virtual ~Serialiser(); /** Write a graph and all its contents as a complete bundle. */ - virtual void write_bundle(const SPtr<const Node>& graph, - const URI& uri); + virtual void + write_bundle(const std::shared_ptr<const Node>& graph, const URI& uri); /** Begin a serialization to a string. * @@ -78,15 +77,15 @@ public: * * @throw std::logic_error */ - virtual void serialise(const SPtr<const Node>& object, - Property::Graph context = Property::Graph::DEFAULT); + virtual void serialise(const std::shared_ptr<const Node>& object, + Property::Graph context = Property::Graph::DEFAULT); /** Serialize an arc. * * @throw std::logic_error */ - virtual void serialise_arc(const Sord::Node& parent, - const SPtr<const Arc>& arc); + virtual void serialise_arc(const Sord::Node& parent, + const std::shared_ptr<const Arc>& arc); /** Finish serialization. * diff --git a/include/ingen/SocketReader.hpp b/include/ingen/SocketReader.hpp index c9bc2a21..a8a98ddc 100644 --- a/include/ingen/SocketReader.hpp +++ b/include/ingen/SocketReader.hpp @@ -18,10 +18,10 @@ #define INGEN_SOCKETREADER_HPP #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "serd/serd.h" #include "sord/sord.h" +#include <memory> #include <thread> namespace Raul { class Socket; } @@ -35,9 +35,9 @@ class World; class INGEN_API SocketReader { public: - SocketReader(World& world, - Interface& iface, - SPtr<Raul::Socket> sock); + SocketReader(World& world, + Interface& iface, + std::shared_ptr<Raul::Socket> sock); virtual ~SocketReader(); @@ -69,15 +69,15 @@ private: const SerdNode* object_datatype, const SerdNode* object_lang); - World& _world; - Interface& _iface; - SerdEnv* _env; - SordInserter* _inserter; - SordNode* _msg_node; - SPtr<Raul::Socket> _socket; - int _socket_error; - bool _exit_flag; - std::thread _thread; + World& _world; + Interface& _iface; + SerdEnv* _env; + SordInserter* _inserter; + SordNode* _msg_node; + std::shared_ptr<Raul::Socket> _socket; + int _socket_error; + bool _exit_flag; + std::thread _thread; }; } // namespace ingen diff --git a/include/ingen/SocketWriter.hpp b/include/ingen/SocketWriter.hpp index 458520a3..63f2f86f 100644 --- a/include/ingen/SocketWriter.hpp +++ b/include/ingen/SocketWriter.hpp @@ -20,9 +20,9 @@ #include "ingen/Message.hpp" #include "ingen/TurtleWriter.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include <cstddef> +#include <memory> namespace Raul { class Socket; @@ -39,17 +39,17 @@ class URIs; class INGEN_API SocketWriter : public TurtleWriter { public: - SocketWriter(URIMap& map, - URIs& uris, - const URI& uri, - SPtr<Raul::Socket> sock); + SocketWriter(URIMap& map, + URIs& uris, + const URI& uri, + std::shared_ptr<Raul::Socket> sock); void message(const Message& message) override; size_t text_sink(const void* buf, size_t len) override; protected: - SPtr<Raul::Socket> _socket; + std::shared_ptr<Raul::Socket> _socket; }; } // namespace ingen diff --git a/include/ingen/Store.hpp b/include/ingen/Store.hpp index fd801b02..46bec770 100644 --- a/include/ingen/Store.hpp +++ b/include/ingen/Store.hpp @@ -18,12 +18,12 @@ #define INGEN_STORE_HPP #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "raul/Deletable.hpp" #include "raul/Noncopyable.hpp" #include "raul/Path.hpp" #include <map> +#include <memory> #include <mutex> #include <utility> @@ -36,9 +36,10 @@ class Node; /** Store of objects in the graph hierarchy. * @ingroup IngenShared */ -class INGEN_API Store : public Raul::Noncopyable - , public Raul::Deletable - , public std::map< const Raul::Path, SPtr<Node> > { +class INGEN_API Store : public Raul::Noncopyable, + public Raul::Deletable, + public std::map<const Raul::Path, std::shared_ptr<Node>> +{ public: void add(Node* o); @@ -48,13 +49,13 @@ public: } using const_range = std::pair<const_iterator, const_iterator>; - using Objects = std::map<Raul::Path, SPtr<Node>>; + using Objects = std::map<Raul::Path, std::shared_ptr<Node>>; using Mutex = std::recursive_mutex; iterator find_descendants_end(Store::iterator parent); const_iterator find_descendants_end(Store::const_iterator parent) const; - const_range children_range(const SPtr<const Node>& o) const; + const_range children_range(const std::shared_ptr<const Node>& o) const; /** Remove the object at `top` and all its children from the store. * diff --git a/include/ingen/Tee.hpp b/include/ingen/Tee.hpp index a56f4dfe..46062493 100644 --- a/include/ingen/Tee.hpp +++ b/include/ingen/Tee.hpp @@ -19,9 +19,9 @@ #include "ingen/Interface.hpp" #include "ingen/Message.hpp" -#include "ingen/memory.hpp" #include <cstddef> +#include <memory> #include <mutex> #include <utility> #include <vector> @@ -32,15 +32,16 @@ namespace ingen { class Tee : public Interface { public: - using Sinks = std::vector<SPtr<Interface>>; + using Sinks = std::vector<std::shared_ptr<Interface>>; explicit Tee(Sinks sinks) : _sinks(std::move(sinks)) {} - SPtr<Interface> respondee() const override { + std::shared_ptr<Interface> respondee() const override { return _sinks.front()->respondee(); } - void set_respondee(const SPtr<Interface>& respondee) override { + void set_respondee(const std::shared_ptr<Interface>& respondee) override + { _sinks.front()->set_respondee(respondee); } diff --git a/include/ingen/URIMap.hpp b/include/ingen/URIMap.hpp index cfd6d6d8..8b93e216 100644 --- a/include/ingen/URIMap.hpp +++ b/include/ingen/URIMap.hpp @@ -25,6 +25,7 @@ #include "raul/Noncopyable.hpp" #include <cstdint> +#include <memory> #include <mutex> #include <string> #include <unordered_map> @@ -53,8 +54,10 @@ public: const char* uri() const override { return _feature.URI; } - SPtr<LV2_Feature> feature(World&, Node*) override { - return SPtr<LV2_Feature>(&_feature, NullDeleter<LV2_Feature>); + std::shared_ptr<LV2_Feature> feature(World&, Node*) override + { + return std::shared_ptr<LV2_Feature>(&_feature, + NullDeleter<LV2_Feature>); } private: @@ -93,15 +96,22 @@ public: const LV2_URID_Unmap& urid_unmap() const { return _urid_unmap_feature->data(); } LV2_URID_Unmap& urid_unmap() { return _urid_unmap_feature->data(); } - SPtr<URIDMapFeature> urid_map_feature() { return _urid_map_feature; } - SPtr<URIDUnmapFeature> urid_unmap_feature() { return _urid_unmap_feature; } + std::shared_ptr<URIDMapFeature> urid_map_feature() + { + return _urid_map_feature; + } + + std::shared_ptr<URIDUnmapFeature> urid_unmap_feature() + { + return _urid_unmap_feature; + } private: friend struct URIDMapFeature; friend struct URIDUnMapFeature; - SPtr<URIDMapFeature> _urid_map_feature; - SPtr<URIDUnmapFeature> _urid_unmap_feature; + std::shared_ptr<URIDMapFeature> _urid_map_feature; + std::shared_ptr<URIDUnmapFeature> _urid_unmap_feature; std::mutex _mutex; std::unordered_map<std::string, LV2_URID> _map; diff --git a/include/ingen/World.hpp b/include/ingen/World.hpp index 5c056ef7..a138a95c 100644 --- a/include/ingen/World.hpp +++ b/include/ingen/World.hpp @@ -18,11 +18,11 @@ #define INGEN_WORLD_HPP #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "lv2/log/log.h" #include "lv2/urid/urid.h" #include "raul/Noncopyable.hpp" +#include <memory> #include <mutex> #include <string> @@ -89,10 +89,10 @@ public: virtual bool run_module(const char* name); /** A function to create a new remote Interface. */ - using InterfaceFactory = - SPtr<Interface> (*)(World& world, - const URI& engine_uri, - const SPtr<Interface>& respondee); + using InterfaceFactory = std::shared_ptr<Interface> (*)( + World& world, + const URI& engine_uri, + const std::shared_ptr<Interface>& respondee); /** Register an InterfaceFactory (for module implementations). */ virtual void add_interface_factory(const std::string& scheme, @@ -103,22 +103,23 @@ public: * @param respondee The Interface that will receive responses to commands * and broadcasts, if applicable. */ - virtual SPtr<Interface> new_interface(const URI& engine_uri, - const SPtr<Interface>& respondee); + virtual std::shared_ptr<Interface> + new_interface(const URI& engine_uri, + const std::shared_ptr<Interface>& respondee); /** Run a script. */ virtual bool run(const std::string& mime_type, const std::string& filename); - virtual void set_engine(const SPtr<EngineBase>& e); - virtual void set_interface(const SPtr<Interface>& i); - virtual void set_store(const SPtr<Store>& s); + virtual void set_engine(const std::shared_ptr<EngineBase>& e); + virtual void set_interface(const std::shared_ptr<Interface>& i); + virtual void set_store(const std::shared_ptr<Store>& s); - virtual SPtr<EngineBase> engine(); - virtual SPtr<Interface> interface(); - virtual SPtr<Parser> parser(); - virtual SPtr<Serialiser> serialiser(); - virtual SPtr<Store> store(); + virtual std::shared_ptr<EngineBase> engine(); + virtual std::shared_ptr<Interface> interface(); + virtual std::shared_ptr<Parser> parser(); + virtual std::shared_ptr<Serialiser> serialiser(); + virtual std::shared_ptr<Store> store(); virtual int& argc(); virtual char**& argv(); diff --git a/include/ingen/client/ArcModel.hpp b/include/ingen/client/ArcModel.hpp index 582314ca..05f104e4 100644 --- a/include/ingen/client/ArcModel.hpp +++ b/include/ingen/client/ArcModel.hpp @@ -20,10 +20,10 @@ #include "ingen/Arc.hpp" #include "ingen/client/PortModel.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "raul/Path.hpp" #include <cassert> +#include <memory> namespace ingen { namespace client { @@ -37,8 +37,8 @@ class ClientStore; class INGEN_API ArcModel : public Arc { public: - SPtr<PortModel> tail() const { return _tail; } - SPtr<PortModel> head() const { return _head; } + std::shared_ptr<PortModel> tail() const { return _tail; } + std::shared_ptr<PortModel> head() const { return _head; } const Raul::Path& tail_path() const override { return _tail->path(); } const Raul::Path& head_path() const override { return _head->path(); } @@ -46,7 +46,7 @@ public: private: friend class ClientStore; - ArcModel(SPtr<PortModel> tail, SPtr<PortModel> head) + ArcModel(std::shared_ptr<PortModel> tail, std::shared_ptr<PortModel> head) : _tail(std::move(tail)) , _head(std::move(head)) { @@ -57,8 +57,8 @@ private: assert(_tail->path() != _head->path()); } - const SPtr<PortModel> _tail; - const SPtr<PortModel> _head; + const std::shared_ptr<PortModel> _tail; + const std::shared_ptr<PortModel> _head; }; } // namespace client diff --git a/include/ingen/client/BlockModel.hpp b/include/ingen/client/BlockModel.hpp index ac034242..8c1645d9 100644 --- a/include/ingen/client/BlockModel.hpp +++ b/include/ingen/client/BlockModel.hpp @@ -21,10 +21,10 @@ #include "ingen/client/ObjectModel.hpp" #include "ingen/client/PluginModel.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include <algorithm> #include <cstdint> +#include <memory> #include <string> #include <vector> @@ -50,60 +50,60 @@ public: GraphType graph_type() const override { return Node::GraphType::BLOCK; } - using Ports = std::vector<SPtr<const PortModel>>; + using Ports = std::vector<std::shared_ptr<const PortModel>>; - SPtr<const PortModel> get_port(const Raul::Symbol& symbol) const; - SPtr<const PortModel> get_port(uint32_t index) const; + std::shared_ptr<const PortModel> get_port(const Raul::Symbol& symbol) const; + std::shared_ptr<const PortModel> get_port(uint32_t index) const; Node* port(uint32_t index) const override; - const URI& plugin_uri() const { return _plugin_uri; } - const Resource* plugin() const override { return _plugin.get(); } - Resource* plugin() { return _plugin.get(); } - SPtr<PluginModel> plugin_model() const { return _plugin; } - uint32_t num_ports() const override { return _ports.size(); } - const Ports& ports() const { return _ports; } + const URI& plugin_uri() const { return _plugin_uri; } + const Resource* plugin() const override { return _plugin.get(); } + Resource* plugin() { return _plugin.get(); } + std::shared_ptr<PluginModel> plugin_model() const { return _plugin; } + uint32_t num_ports() const override { return _ports.size(); } + const Ports& ports() const { return _ports; } - void default_port_value_range(const SPtr<const PortModel>& port, - float& min, - float& max, - uint32_t srate = 1) const; + void default_port_value_range(const std::shared_ptr<const PortModel>& port, + float& min, + float& max, + uint32_t srate = 1) const; - void port_value_range(const SPtr<const PortModel>& port, - float& min, - float& max, - uint32_t srate = 1) const; + void port_value_range(const std::shared_ptr<const PortModel>& port, + float& min, + float& max, + uint32_t srate = 1) const; std::string label() const; - std::string port_label(const SPtr<const PortModel>& port) const; + std::string port_label(const std::shared_ptr<const PortModel>& port) const; // Signals - INGEN_SIGNAL(new_port, void, SPtr<const PortModel>) - INGEN_SIGNAL(removed_port, void, SPtr<const PortModel>) + INGEN_SIGNAL(new_port, void, std::shared_ptr<const PortModel>) + INGEN_SIGNAL(removed_port, void, std::shared_ptr<const PortModel>) protected: friend class ClientStore; BlockModel(URIs& uris, URI plugin_uri, const Raul::Path& path); - BlockModel(URIs& uris, - const SPtr<PluginModel>& plugin, - const Raul::Path& path); + BlockModel(URIs& uris, + const std::shared_ptr<PluginModel>& plugin, + const Raul::Path& path); explicit BlockModel(const Raul::Path& path); - void add_child(const SPtr<ObjectModel>& c) override; - bool remove_child(const SPtr<ObjectModel>& c) override; - void add_port(const SPtr<PortModel>& pm); - void remove_port(const SPtr<PortModel>& port); + void add_child(const std::shared_ptr<ObjectModel>& c) override; + bool remove_child(const std::shared_ptr<ObjectModel>& c) override; + void add_port(const std::shared_ptr<PortModel>& pm); + void remove_port(const std::shared_ptr<PortModel>& port); void remove_port(const Raul::Path& port_path); - void set(const SPtr<ObjectModel>& model) override; + void set(const std::shared_ptr<ObjectModel>& model) override; virtual void clear(); - Ports _ports; ///< Vector of ports - URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown) - SPtr<PluginModel> _plugin; ///< The plugin this block is an instance of + Ports _ports; ///< Vector of ports + URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown) + std::shared_ptr<PluginModel> _plugin; ///< Plugin this is an instance of private: mutable uint32_t _num_values; ///< Size of _min_values and _max_values diff --git a/include/ingen/client/ClientStore.hpp b/include/ingen/client/ClientStore.hpp index 77042109..6fa040b2 100644 --- a/include/ingen/client/ClientStore.hpp +++ b/include/ingen/client/ClientStore.hpp @@ -23,10 +23,10 @@ #include "ingen/URI.hpp" #include "ingen/client/signal.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "raul/Path.hpp" #include <map> +#include <memory> namespace Raul { class Path; @@ -57,24 +57,25 @@ class INGEN_API ClientStore : public Store , public Interface , public INGEN_TRACKABLE { public: - ClientStore( - URIs& uris, - Log& log, - const SPtr<SigClientInterface>& emitter = SPtr<SigClientInterface>()); + ClientStore(URIs& uris, + Log& log, + const std::shared_ptr<SigClientInterface>& emitter = + std::shared_ptr<SigClientInterface>()); URI uri() const override { return URI("ingen:/clients/store"); } - SPtr<const ObjectModel> object(const Raul::Path& path) const; - SPtr<const PluginModel> plugin(const URI& uri) const; - SPtr<const Resource> resource(const URI& uri) const; + std::shared_ptr<const ObjectModel> object(const Raul::Path& path) const; + std::shared_ptr<const PluginModel> plugin(const URI& uri) const; + std::shared_ptr<const Resource> resource(const URI& uri) const; void clear(); - using Plugins = std::map<const URI, SPtr<PluginModel>>; + using Plugins = std::map<const URI, std::shared_ptr<PluginModel>>; - SPtr<const Plugins> plugins() const { return _plugins; } - SPtr<Plugins> plugins() { return _plugins; } - void set_plugins(SPtr<Plugins> p) { _plugins = std::move(p); } + std::shared_ptr<const Plugins> plugins() const { return _plugins; } + std::shared_ptr<Plugins> plugins() { return _plugins; } + + void set_plugins(std::shared_ptr<Plugins> p) { _plugins = std::move(p); } URIs& uris() { return _uris; } @@ -97,33 +98,33 @@ public: void operator()(const SetProperty&); void operator()(const Undo&) {} - INGEN_SIGNAL(new_object, void, SPtr<ObjectModel>) - INGEN_SIGNAL(new_plugin, void, SPtr<PluginModel>) + INGEN_SIGNAL(new_object, void, std::shared_ptr<ObjectModel>) + INGEN_SIGNAL(new_plugin, void, std::shared_ptr<PluginModel>) INGEN_SIGNAL(plugin_deleted, void, URI) private: - SPtr<ObjectModel> _object(const Raul::Path& path); - SPtr<PluginModel> _plugin(const URI& uri); - SPtr<PluginModel> _plugin(const Atom& uri); - SPtr<Resource> _resource(const URI& uri); + std::shared_ptr<ObjectModel> _object(const Raul::Path& path); + std::shared_ptr<PluginModel> _plugin(const URI& uri); + std::shared_ptr<PluginModel> _plugin(const Atom& uri); + std::shared_ptr<Resource> _resource(const URI& uri); - void add_object(const SPtr<ObjectModel>& object); - SPtr<ObjectModel> remove_object(const Raul::Path& path); + void add_object(const std::shared_ptr<ObjectModel>& object); + std::shared_ptr<ObjectModel> remove_object(const Raul::Path& path); - void add_plugin(const SPtr<PluginModel>& pm); + void add_plugin(const std::shared_ptr<PluginModel>& pm); - SPtr<GraphModel> connection_graph(const Raul::Path& tail_path, + std::shared_ptr<GraphModel> connection_graph(const Raul::Path& tail_path, const Raul::Path& head_path); // Slots for SigClientInterface signals bool attempt_connection(const Raul::Path& tail_path, const Raul::Path& head_path); - URIs& _uris; - Log& _log; - SPtr<SigClientInterface> _emitter; + URIs& _uris; + Log& _log; + std::shared_ptr<SigClientInterface> _emitter; - SPtr<Plugins> _plugins; ///< Map, keyed by plugin URI + std::shared_ptr<Plugins> _plugins; ///< Map, keyed by plugin URI }; } // namespace client diff --git a/include/ingen/client/GraphModel.hpp b/include/ingen/client/GraphModel.hpp index 190c08eb..3ddf2342 100644 --- a/include/ingen/client/GraphModel.hpp +++ b/include/ingen/client/GraphModel.hpp @@ -22,9 +22,9 @@ #include "ingen/client/BlockModel.hpp" #include "ingen/client/signal.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include <cstdint> +#include <memory> namespace ingen { namespace client { @@ -43,18 +43,18 @@ public: GraphType graph_type() const override { return Node::GraphType::GRAPH; } - SPtr<ArcModel> get_arc(const ingen::Node* tail, - const ingen::Node* head); + std::shared_ptr<ArcModel> + get_arc(const ingen::Node* tail, const ingen::Node* head); bool enabled() const; bool polyphonic() const; uint32_t internal_poly() const; // Signals - INGEN_SIGNAL(new_block, void, SPtr<BlockModel>) - INGEN_SIGNAL(removed_block, void, SPtr<BlockModel>) - INGEN_SIGNAL(new_arc, void, SPtr<ArcModel>) - INGEN_SIGNAL(removed_arc, void, SPtr<ArcModel>) + INGEN_SIGNAL(new_block, void, std::shared_ptr<BlockModel>) + INGEN_SIGNAL(removed_block, void, std::shared_ptr<BlockModel>) + INGEN_SIGNAL(new_arc, void, std::shared_ptr<ArcModel>) + INGEN_SIGNAL(removed_arc, void, std::shared_ptr<ArcModel>) private: friend class ClientStore; @@ -67,11 +67,11 @@ private: } void clear() override; - void add_child(const SPtr<ObjectModel>& c) override; - bool remove_child(const SPtr<ObjectModel>& o) override; - void remove_arcs_on(const SPtr<PortModel>& p); + void add_child(const std::shared_ptr<ObjectModel>& c) override; + bool remove_child(const std::shared_ptr<ObjectModel>& o) override; + void remove_arcs_on(const std::shared_ptr<PortModel>& p); - void add_arc(const SPtr<ArcModel>& arc); + void add_arc(const std::shared_ptr<ArcModel>& arc); void remove_arc(const ingen::Node* tail, const ingen::Node* head); }; diff --git a/include/ingen/client/ObjectModel.hpp b/include/ingen/client/ObjectModel.hpp index a1e603f6..73e2080e 100644 --- a/include/ingen/client/ObjectModel.hpp +++ b/include/ingen/client/ObjectModel.hpp @@ -26,10 +26,11 @@ #include "ingen/URIs.hpp" #include "ingen/client/signal.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "raul/Path.hpp" #include "raul/Symbol.hpp" +#include <memory> + namespace ingen { class Atom; @@ -60,14 +61,14 @@ public: const Raul::Path& path() const override { return _path; } const Raul::Symbol& symbol() const override { return _symbol; } - SPtr<ObjectModel> parent() const { return _parent; } - bool polyphonic() const; + std::shared_ptr<ObjectModel> parent() const { return _parent; } + bool polyphonic() const; Node* graph_parent() const override { return _parent.get(); } // Signals - INGEN_SIGNAL(new_child, void, SPtr<ObjectModel>) - INGEN_SIGNAL(removed_child, void, SPtr<ObjectModel>) + INGEN_SIGNAL(new_child, void, std::shared_ptr<ObjectModel>) + INGEN_SIGNAL(removed_child, void, std::shared_ptr<ObjectModel>) INGEN_SIGNAL(property, void, const URI&, const Atom&) INGEN_SIGNAL(property_removed, void, const URI&, const Atom&) INGEN_SIGNAL(destroyed, void) @@ -80,13 +81,13 @@ protected: ObjectModel(const ObjectModel& copy); void set_path(const Raul::Path& p) override; - virtual void set_parent(const SPtr<ObjectModel>& p); - virtual void add_child(const SPtr<ObjectModel>& c) {} - virtual bool remove_child(const SPtr<ObjectModel>& c) { return true; } + virtual void set_parent(const std::shared_ptr<ObjectModel>& p); + virtual void add_child(const std::shared_ptr<ObjectModel>& c) {} + virtual bool remove_child(const std::shared_ptr<ObjectModel>& c) { return true; } - virtual void set(const SPtr<ObjectModel>& o); + virtual void set(const std::shared_ptr<ObjectModel>& o); - SPtr<ObjectModel> _parent; + std::shared_ptr<ObjectModel> _parent; private: Raul::Path _path; diff --git a/include/ingen/client/PluginModel.hpp b/include/ingen/client/PluginModel.hpp index 9c5acc78..24024a1b 100644 --- a/include/ingen/client/PluginModel.hpp +++ b/include/ingen/client/PluginModel.hpp @@ -22,13 +22,13 @@ #include "ingen/World.hpp" #include "ingen/client/signal.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "lilv/lilv.h" #include "raul/Symbol.hpp" #include "sord/sordmm.hpp" #include <cstdint> #include <map> +#include <memory> #include <string> namespace ingen { @@ -82,8 +82,9 @@ public: bool has_ui() const; - SPtr<PluginUI> - ui(ingen::World& world, const SPtr<const BlockModel>& block) const; + std::shared_ptr<PluginUI> + ui(ingen::World& world, + const std::shared_ptr<const BlockModel>& block) const; std::string documentation(bool html) const; std::string port_documentation(uint32_t index, bool html) const; @@ -104,7 +105,7 @@ public: protected: friend class ClientStore; - void set(const SPtr<PluginModel>& p); + void set(const std::shared_ptr<PluginModel>& p); void add_preset(const URI& uri, const std::string& label); diff --git a/include/ingen/client/PluginUI.hpp b/include/ingen/client/PluginUI.hpp index 89c951c3..35a14bd2 100644 --- a/include/ingen/client/PluginUI.hpp +++ b/include/ingen/client/PluginUI.hpp @@ -22,11 +22,11 @@ #include "ingen/LV2Features.hpp" #include "ingen/Resource.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "lilv/lilv.h" #include "suil/suil.h" #include <cstdint> +#include <memory> #include <set> namespace ingen { @@ -53,9 +53,10 @@ public: * connected first. The caller should connect to signal_property_changed, * then call instantiate(). */ - static SPtr<PluginUI> create(ingen::World& world, - const SPtr<const BlockModel>& block, - const LilvPlugin* plugin); + static std::shared_ptr<PluginUI> + create(ingen::World& world, + const std::shared_ptr<const BlockModel>& block, + const LilvPlugin* plugin); /** Instantiate the UI. * @@ -86,28 +87,28 @@ public: const Atom&, // Object Resource::Graph) // Context - ingen::World& world() const { return _world; } - SPtr<const BlockModel> block() const { return _block; } + ingen::World& world() const { return _world; } + std::shared_ptr<const BlockModel> block() const { return _block; } private: - PluginUI(ingen::World& world, - SPtr<const BlockModel> block, - LilvUIs* uis, - const LilvUI* ui, - const LilvNode* ui_type); - - ingen::World& _world; - SPtr<const BlockModel> _block; - SuilInstance* _instance; - LilvUIs* _uis; - const LilvUI* _ui; - LilvNode* _ui_node; - LilvNode* _ui_type; - std::set<uint32_t> _subscribed_ports; + PluginUI(ingen::World& world, + std::shared_ptr<const BlockModel> block, + LilvUIs* uis, + const LilvUI* ui, + const LilvNode* ui_type); + + ingen::World& _world; + std::shared_ptr<const BlockModel> _block; + SuilInstance* _instance; + LilvUIs* _uis; + const LilvUI* _ui; + LilvNode* _ui_node; + LilvNode* _ui_type; + std::set<uint32_t> _subscribed_ports; static SuilHost* ui_host; - SPtr<LV2Features::FeatureArray> _features; + std::shared_ptr<LV2Features::FeatureArray> _features; }; } // namespace client diff --git a/include/ingen/client/PortModel.hpp b/include/ingen/client/PortModel.hpp index 46034b2f..61b223df 100644 --- a/include/ingen/client/PortModel.hpp +++ b/include/ingen/client/PortModel.hpp @@ -19,11 +19,11 @@ #include "ingen/client/ObjectModel.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "lv2/core/lv2.h" #include "lv2/port-props/port-props.h" #include <cstdlib> +#include <memory> #include <string> namespace Raul { class Path; } @@ -82,10 +82,10 @@ private: , _direction(dir) {} - void add_child(const SPtr<ObjectModel>& c) override { throw; } - bool remove_child(const SPtr<ObjectModel>& c) override { throw; } + void add_child(const std::shared_ptr<ObjectModel>& c) override { throw; } + bool remove_child(const std::shared_ptr<ObjectModel>& c) override { throw; } - void set(const SPtr<ObjectModel>& model) override; + void set(const std::shared_ptr<ObjectModel>& model) override; uint32_t _index; Direction _direction; diff --git a/include/ingen/client/SocketClient.hpp b/include/ingen/client/SocketClient.hpp index b23c6a45..57c1de97 100644 --- a/include/ingen/client/SocketClient.hpp +++ b/include/ingen/client/SocketClient.hpp @@ -22,6 +22,8 @@ #include "ingen/ingen.h" #include "raul/Socket.hpp" +#include <memory> + namespace ingen { namespace client { @@ -29,39 +31,41 @@ namespace client { class INGEN_API SocketClient : public SocketWriter { public: - SocketClient(World& world, - const URI& uri, - const SPtr<Raul::Socket>& sock, - const SPtr<Interface>& respondee) + SocketClient(World& world, + const URI& uri, + const std::shared_ptr<Raul::Socket>& sock, + const std::shared_ptr<Interface>& respondee) : SocketWriter(world.uri_map(), world.uris(), uri, sock) , _respondee(respondee) , _reader(world, *respondee, sock) {} - SPtr<Interface> respondee() const override { + std::shared_ptr<Interface> respondee() const override { return _respondee; } - void set_respondee(const SPtr<Interface>& respondee) override { + void set_respondee(const std::shared_ptr<Interface>& respondee) override + { _respondee = respondee; } - static SPtr<ingen::Interface> - new_socket_interface(ingen::World& world, - const URI& uri, - const SPtr<ingen::Interface>& respondee) + static std::shared_ptr<ingen::Interface> + new_socket_interface(ingen::World& world, + const URI& uri, + const std::shared_ptr<ingen::Interface>& respondee) { const Raul::Socket::Type type = (uri.scheme() == "unix" ? Raul::Socket::Type::UNIX : Raul::Socket::Type::TCP); - SPtr<Raul::Socket> sock(new Raul::Socket(type)); + std::shared_ptr<Raul::Socket> sock(new Raul::Socket(type)); if (!sock->connect(uri)) { world.log().error("Failed to connect <%1%> (%2%)\n", sock->uri(), strerror(errno)); return nullptr; } - return SPtr<Interface>(new SocketClient(world, uri, sock, respondee)); + return std::shared_ptr<Interface>( + new SocketClient(world, uri, sock, respondee)); } static void register_factories(World& world) { @@ -70,8 +74,8 @@ public: } private: - SPtr<Interface> _respondee; - SocketReader _reader; + std::shared_ptr<Interface> _respondee; + SocketReader _reader; }; } // namespace client diff --git a/include/ingen/memory.hpp b/include/ingen/memory.hpp index bec86c43..e4bf6879 100644 --- a/include/ingen/memory.hpp +++ b/include/ingen/memory.hpp @@ -31,9 +31,6 @@ template <class T> struct FreeDeleter { void operator()(T* const ptr) { free(ptr); } }; template <class T> -using SPtr = std::shared_ptr<T>; - -template <class T> using MPtr = Raul::managed_ptr<T>; template <typename T, typename... Args> |