diff options
author | David Robillard <d@drobilla.net> | 2013-01-12 23:38:03 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-01-12 23:38:03 +0000 |
commit | df1447c665e6c3631961297a9d3e9aff4e94c47f (patch) | |
tree | c0ff117c362e6d571f430f886ab62f372b59af08 | |
parent | bb335dca695273622b7a4ebbefbe9e089edb9ab4 (diff) | |
download | ingen-df1447c665e6c3631961297a9d3e9aff4e94c47f.tar.gz ingen-df1447c665e6c3631961297a9d3e9aff4e94c47f.tar.bz2 ingen-df1447c665e6c3631961297a9d3e9aff4e94c47f.zip |
Remove Raul::SharedPtr and switch to std::shared_ptr.
Use project local short type aliases for shared_ptr and friends.
Move Raul::Disposable and Raul::Manageable into Raul::Maid.
Use sets to store machina nodes and edges to avoid O(n) searches.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4939 a436a847-0d15-0410-975c-d299462d15a1
149 files changed, 1143 insertions, 1147 deletions
diff --git a/ingen/Builder.hpp b/ingen/Builder.hpp index 96096b3d..728a5cb9 100644 --- a/ingen/Builder.hpp +++ b/ingen/Builder.hpp @@ -17,7 +17,7 @@ #ifndef INGEN_BUILDER_HPP #define INGEN_BUILDER_HPP -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" namespace Ingen { @@ -35,8 +35,8 @@ public: Builder(URIs& uris, Interface& interface); virtual ~Builder() {} - void build(SharedPtr<const Node> object); - void connect(SharedPtr<const Node> object); + void build(SPtr<const Node> object); + void connect(SPtr<const Node> object); private: URIs& _uris; diff --git a/ingen/EngineBase.hpp b/ingen/EngineBase.hpp index caa1cf00..311bef3a 100644 --- a/ingen/EngineBase.hpp +++ b/ingen/EngineBase.hpp @@ -20,7 +20,8 @@ #include <stdint.h> #include "raul/URI.hpp" -#include "raul/SharedPtr.hpp" + +#include "ingen/types.hpp" namespace Ingen { @@ -93,8 +94,8 @@ public: /** Register a client to receive updates about engine changes. */ - virtual void register_client(const Raul::URI& uri, - SharedPtr<Interface> client) = 0; + virtual void register_client(const Raul::URI& uri, + SPtr<Interface> client) = 0; /** Unregister a client. diff --git a/ingen/Interface.hpp b/ingen/Interface.hpp index 7f1fe9b7..023221bd 100644 --- a/ingen/Interface.hpp +++ b/ingen/Interface.hpp @@ -25,7 +25,7 @@ #include "ingen/Resource.hpp" #include "ingen/Status.hpp" -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" namespace Raul { class Atom; @@ -47,11 +47,11 @@ public: virtual Raul::URI uri() const = 0; - virtual SharedPtr<Interface> respondee() const { - return SharedPtr<Interface>(); + virtual SPtr<Interface> respondee() const { + return SPtr<Interface>(); } - virtual void set_respondee(SharedPtr<Interface> respondee) {} + virtual void set_respondee(SPtr<Interface> respondee) {} /** Begin an atomic bundle */ virtual void bundle_begin() = 0; diff --git a/ingen/LV2Features.hpp b/ingen/LV2Features.hpp index 214d62bb..be8f777b 100644 --- a/ingen/LV2Features.hpp +++ b/ingen/LV2Features.hpp @@ -20,10 +20,10 @@ #include <vector> #include "lv2/lv2plug.in/ns/lv2core/lv2.h" - -#include "raul/SharedPtr.hpp" #include "raul/Noncopyable.hpp" +#include "ingen/types.hpp" + namespace Ingen { class Node; @@ -42,13 +42,13 @@ public: virtual const char* uri() const = 0; - virtual SharedPtr<LV2_Feature> feature(World* world, - Node* block) = 0; + virtual SPtr<LV2_Feature> feature(World* world, + Node* block) = 0; }; class FeatureArray : public Raul::Noncopyable { public: - typedef std::vector< SharedPtr<LV2_Feature> > FeatureVector; + typedef std::vector< SPtr<LV2_Feature> > FeatureVector; explicit FeatureArray(FeatureVector& features); @@ -61,14 +61,14 @@ public: LV2_Feature** _array; }; - void add_feature(SharedPtr<Feature> feature); + void add_feature(SPtr<Feature> feature); bool is_supported(const std::string& uri) const; - SharedPtr<FeatureArray> lv2_features(World* world, - Node* block) const; + SPtr<FeatureArray> lv2_features(World* world, + Node* block) const; private: - typedef std::vector< SharedPtr<Feature> > Features; + typedef std::vector< SPtr<Feature> > Features; Features _features; }; diff --git a/ingen/Node.hpp b/ingen/Node.hpp index d61732ff..2cbce01c 100644 --- a/ingen/Node.hpp +++ b/ingen/Node.hpp @@ -17,9 +17,9 @@ #ifndef INGEN_NODE_HPP #define INGEN_NODE_HPP -#include "raul/Path.hpp" -#include "raul/SharedPtr.hpp" #include "ingen/Resource.hpp" +#include "ingen/types.hpp" +#include "raul/Path.hpp" namespace Raul { class Atom; @@ -55,7 +55,7 @@ public: }; typedef std::pair<const Node*, const Node*> ArcsKey; - typedef std::map< ArcsKey, SharedPtr<Arc> > Arcs; + typedef std::map< ArcsKey, SPtr<Arc> > Arcs; // Graphs only Arcs& arcs() { return _arcs; } diff --git a/ingen/Store.hpp b/ingen/Store.hpp index c176cdd3..dcab2532 100644 --- a/ingen/Store.hpp +++ b/ingen/Store.hpp @@ -22,10 +22,12 @@ #undef nil #include <glibmm/thread.h> -#include "ingen/Node.hpp" #include "raul/Deletable.hpp" #include "raul/Noncopyable.hpp" +#include "ingen/Node.hpp" +#include "ingen/types.hpp" + namespace Ingen { /** Store of objects in the graph hierarchy. @@ -33,7 +35,7 @@ namespace Ingen { */ class Store : public Raul::Noncopyable , public Raul::Deletable - , public std::map< const Raul::Path, SharedPtr<Node> > { + , public std::map< const Raul::Path, SPtr<Node> > { public: void add(Node* o); @@ -44,12 +46,12 @@ public: typedef std::pair<const_iterator, const_iterator> const_range; - typedef std::map< Raul::Path, SharedPtr<Node> > Objects; + typedef std::map< Raul::Path, SPtr<Node> > Objects; iterator find_descendants_end(Store::iterator parent); const_iterator find_descendants_end(Store::const_iterator parent) const; - const_range children_range(SharedPtr<const Node> o) const; + const_range children_range(SPtr<const Node> o) const; /** Remove the object at @p top and all its children from the store. * diff --git a/ingen/URIMap.hpp b/ingen/URIMap.hpp index e5ca71e3..a275fdff 100644 --- a/ingen/URIMap.hpp +++ b/ingen/URIMap.hpp @@ -48,8 +48,8 @@ public: const char* uri() const { return _feature.URI; } - SharedPtr<LV2_Feature> feature(World*, Node*) { - return SharedPtr<LV2_Feature>(&_feature, NullDeleter<LV2_Feature>); + SPtr<LV2_Feature> feature(World*, Node*) { + return SPtr<LV2_Feature>(&_feature, NullDeleter<LV2_Feature>); } private: @@ -71,12 +71,12 @@ public: LV2_URID_Unmap urid_unmap; }; - SharedPtr<URIDMapFeature> urid_map_feature() { return _urid_map_feature; } - SharedPtr<URIDUnmapFeature> urid_unmap_feature() { return _urid_unmap_feature; } + SPtr<URIDMapFeature> urid_map_feature() { return _urid_map_feature; } + SPtr<URIDUnmapFeature> urid_unmap_feature() { return _urid_unmap_feature; } private: - SharedPtr<URIDMapFeature> _urid_map_feature; - SharedPtr<URIDUnmapFeature> _urid_unmap_feature; + SPtr<URIDMapFeature> _urid_map_feature; + SPtr<URIDUnmapFeature> _urid_unmap_feature; }; } // namespace Ingen diff --git a/ingen/World.hpp b/ingen/World.hpp index 16ad5731..fb412afc 100644 --- a/ingen/World.hpp +++ b/ingen/World.hpp @@ -19,10 +19,10 @@ #include <string> -#include "lv2/lv2plug.in/ns/ext/urid/urid.h" +#include "ingen/types.hpp" #include "lv2/lv2plug.in/ns/ext/log/log.h" +#include "lv2/lv2plug.in/ns/ext/urid/urid.h" #include "raul/Noncopyable.hpp" -#include "raul/SharedPtr.hpp" #include "raul/URI.hpp" typedef struct LilvWorldImpl LilvWorld; @@ -93,10 +93,10 @@ public: virtual bool run_module(const char* name); /** A function to create a new remote Interface. */ - typedef SharedPtr<Interface> (*InterfaceFactory)( - World* world, - const Raul::URI& engine_uri, - SharedPtr<Interface> respondee); + typedef SPtr<Interface> (*InterfaceFactory)( + World* world, + const Raul::URI& engine_uri, + SPtr<Interface> respondee); /** Register an InterfaceFactory (for module implementations). */ virtual void add_interface_factory(const std::string& scheme, @@ -107,25 +107,25 @@ public: * @param respondee The Interface that will receive responses to commands * and broadcasts, if applicable. */ - virtual SharedPtr<Interface> new_interface( - const Raul::URI& engine_uri, - SharedPtr<Interface> respondee); + virtual SPtr<Interface> new_interface( + const Raul::URI& engine_uri, + SPtr<Interface> respondee); /** Run a script. */ virtual bool run(const std::string& mime_type, const std::string& filename); - virtual void set_engine(SharedPtr<EngineBase> e); - virtual void set_interface(SharedPtr<Interface> e); - virtual void set_parser(SharedPtr<Serialisation::Parser> p); - virtual void set_serialiser(SharedPtr<Serialisation::Serialiser> s); - virtual void set_store(SharedPtr<Store> s); - - virtual SharedPtr<EngineBase> engine(); - virtual SharedPtr<Interface> interface(); - virtual SharedPtr<Serialisation::Parser> parser(); - virtual SharedPtr<Serialisation::Serialiser> serialiser(); - virtual SharedPtr<Store> store(); + virtual void set_engine(SPtr<EngineBase> e); + virtual void set_interface(SPtr<Interface> e); + virtual void set_parser(SPtr<Serialisation::Parser> p); + virtual void set_serialiser(SPtr<Serialisation::Serialiser> s); + virtual void set_store(SPtr<Store> s); + + virtual SPtr<EngineBase> engine(); + virtual SPtr<Interface> interface(); + virtual SPtr<Serialisation::Parser> parser(); + virtual SPtr<Serialisation::Serialiser> serialiser(); + virtual SPtr<Store> store(); virtual int& argc(); virtual char**& argv(); diff --git a/ingen/client/ArcModel.hpp b/ingen/client/ArcModel.hpp index 99d5afa0..4306be09 100644 --- a/ingen/client/ArcModel.hpp +++ b/ingen/client/ArcModel.hpp @@ -19,8 +19,8 @@ #include <cassert> +#include "ingen/types.hpp" #include "raul/Path.hpp" -#include "raul/SharedPtr.hpp" #include "ingen/Arc.hpp" #include "ingen/client/PortModel.hpp" @@ -37,8 +37,8 @@ class ClientStore; class ArcModel : public Arc { public: - SharedPtr<PortModel> tail() const { return _tail; } - SharedPtr<PortModel> head() const { return _head; } + SPtr<PortModel> tail() const { return _tail; } + SPtr<PortModel> head() const { return _head; } const Raul::Path& tail_path() const { return _tail->path(); } const Raul::Path& head_path() const { return _head->path(); } @@ -46,7 +46,7 @@ public: private: friend class ClientStore; - ArcModel(SharedPtr<PortModel> tail, SharedPtr<PortModel> head) + ArcModel(SPtr<PortModel> tail, SPtr<PortModel> head) : _tail(tail) , _head(head) { @@ -57,8 +57,8 @@ private: assert(_tail->path() != _head->path()); } - const SharedPtr<PortModel> _tail; - const SharedPtr<PortModel> _head; + const SPtr<PortModel> _tail; + const SPtr<PortModel> _head; }; } // namespace Client diff --git a/ingen/client/BlockModel.hpp b/ingen/client/BlockModel.hpp index 3262b230..b5db2b0d 100644 --- a/ingen/client/BlockModel.hpp +++ b/ingen/client/BlockModel.hpp @@ -21,11 +21,11 @@ #include <string> #include <vector> -#include "raul/SharedPtr.hpp" #include "ingen/Node.hpp" #include "ingen/client/ObjectModel.hpp" #include "ingen/client/PluginModel.hpp" #include "ingen/client/PortModel.hpp" +#include "ingen/types.hpp" namespace Raul { class Path; } @@ -50,31 +50,35 @@ public: GraphType graph_type() const { return Node::GraphType::BLOCK; } - typedef std::vector< SharedPtr<const PortModel> > Ports; + typedef std::vector< SPtr<const PortModel> > Ports; - SharedPtr<const PortModel> get_port(const Raul::Symbol& symbol) const; + SPtr<const PortModel> get_port(const Raul::Symbol& symbol) const; Node* port(uint32_t index) const; - const Raul::URI& plugin_uri() const { return _plugin_uri; } - const Plugin* plugin() const { return _plugin.get(); } - Plugin* plugin() { return _plugin.get(); } - SharedPtr<PluginModel> plugin_model() const { return _plugin; } - uint32_t num_ports() const { return _ports.size(); } - const Ports& ports() const { return _ports; } + const Raul::URI& plugin_uri() const { return _plugin_uri; } + const Plugin* plugin() const { return _plugin.get(); } + Plugin* plugin() { return _plugin.get(); } + SPtr<PluginModel> plugin_model() const { return _plugin; } + uint32_t num_ports() const { return _ports.size(); } + const Ports& ports() const { return _ports; } - void default_port_value_range(SharedPtr<const PortModel> port, - float& min, float& max, uint32_t srate=1) const; + void default_port_value_range(SPtr<const PortModel> port, + float& min, + float& max, + uint32_t srate = 1) const; - void port_value_range(SharedPtr<const PortModel> port, - float& min, float& max, uint32_t srate=1) const; + void port_value_range(SPtr<const PortModel> port, + float& min, + float& max, + uint32_t srate = 1) const; std::string label() const; - std::string port_label(SharedPtr<const PortModel> port) const; + std::string port_label(SPtr<const PortModel> port) const; // Signals - INGEN_SIGNAL(new_port, void, SharedPtr<const PortModel>); - INGEN_SIGNAL(removed_port, void, SharedPtr<const PortModel>); + INGEN_SIGNAL(new_port, void, SPtr<const PortModel>); + INGEN_SIGNAL(removed_port, void, SPtr<const PortModel>); protected: friend class ClientStore; @@ -82,23 +86,23 @@ protected: BlockModel(URIs& uris, const Raul::URI& plugin_uri, const Raul::Path& path); - BlockModel(URIs& uris, - SharedPtr<PluginModel> plugin, - const Raul::Path& path); + BlockModel(URIs& uris, + SPtr<PluginModel> plugin, + const Raul::Path& path); explicit BlockModel(const Raul::Path& path); - void add_child(SharedPtr<ObjectModel> c); - bool remove_child(SharedPtr<ObjectModel> c); - void add_port(SharedPtr<PortModel> pm); - void remove_port(SharedPtr<PortModel> pm); + void add_child(SPtr<ObjectModel> c); + bool remove_child(SPtr<ObjectModel> c); + void add_port(SPtr<PortModel> pm); + void remove_port(SPtr<PortModel> pm); void remove_port(const Raul::Path& port_path); - void set(SharedPtr<ObjectModel> model); + void set(SPtr<ObjectModel> model); virtual void clear(); - Ports _ports; ///< Vector of ports - Raul::URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown) - SharedPtr<PluginModel> _plugin; ///< The plugin this block is an instance of + Ports _ports; ///< Vector of ports + Raul::URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown) + SPtr<PluginModel> _plugin; ///< The plugin this block is an instance of private: mutable uint32_t _num_values; ///< Size of _min_values and _max_values diff --git a/ingen/client/ClientStore.hpp b/ingen/client/ClientStore.hpp index 3d7d724a..e9c85ba9 100644 --- a/ingen/client/ClientStore.hpp +++ b/ingen/client/ClientStore.hpp @@ -22,10 +22,10 @@ #include <string> #include "ingen/Interface.hpp" -#include "ingen/client/signal.hpp" #include "ingen/Store.hpp" +#include "ingen/client/signal.hpp" +#include "ingen/types.hpp" #include "raul/Path.hpp" -#include "raul/SharedPtr.hpp" namespace Raul { class Atom; } @@ -53,23 +53,23 @@ class ClientStore : public Store , public INGEN_TRACKABLE { public: ClientStore( - URIs& uris, - Log& log, - SharedPtr<Interface> engine = SharedPtr<Interface>(), - SharedPtr<SigClientInterface> emitter = SharedPtr<SigClientInterface>()); + URIs& uris, + Log& log, + SPtr<Interface> engine = SPtr<Interface>(), + SPtr<SigClientInterface> emitter = SPtr<SigClientInterface>()); Raul::URI uri() const { return Raul::URI("ingen:/clients/store"); } - SharedPtr<const ObjectModel> object(const Raul::Path& path) const; - SharedPtr<const PluginModel> plugin(const Raul::URI& uri) const; - SharedPtr<const Resource> resource(const Raul::URI& uri) const; + SPtr<const ObjectModel> object(const Raul::Path& path) const; + SPtr<const PluginModel> plugin(const Raul::URI& uri) const; + SPtr<const Resource> resource(const Raul::URI& uri) const; void clear(); - typedef std::map< const Raul::URI, SharedPtr<PluginModel> > Plugins; - SharedPtr<const Plugins> plugins() const { return _plugins; } - SharedPtr<Plugins> plugins() { return _plugins; } - void set_plugins(SharedPtr<Plugins> p) { _plugins = p; } + typedef std::map< const Raul::URI, SPtr<PluginModel> > Plugins; + SPtr<const Plugins> plugins() const { return _plugins; } + SPtr<Plugins> plugins() { return _plugins; } + void set_plugins(SPtr<Plugins> p) { _plugins = p; } URIs& uris() { return _uris; } @@ -104,21 +104,21 @@ public: void response(int32_t id, Status status, const std::string& subject) {} void error(const std::string& msg) {} - INGEN_SIGNAL(new_object, void, SharedPtr<ObjectModel>); - INGEN_SIGNAL(new_plugin, void, SharedPtr<PluginModel>); + INGEN_SIGNAL(new_object, void, SPtr<ObjectModel>); + INGEN_SIGNAL(new_plugin, void, SPtr<PluginModel>); private: - SharedPtr<ObjectModel> _object(const Raul::Path& path); - SharedPtr<PluginModel> _plugin(const Raul::URI& uri); - SharedPtr<Resource> _resource(const Raul::URI& uri); + SPtr<ObjectModel> _object(const Raul::Path& path); + SPtr<PluginModel> _plugin(const Raul::URI& uri); + SPtr<Resource> _resource(const Raul::URI& uri); - void add_object(SharedPtr<ObjectModel> object); - SharedPtr<ObjectModel> remove_object(const Raul::Path& path); + void add_object(SPtr<ObjectModel> object); + SPtr<ObjectModel> remove_object(const Raul::Path& path); - void add_plugin(SharedPtr<PluginModel> plugin); + void add_plugin(SPtr<PluginModel> plugin); - SharedPtr<GraphModel> connection_graph(const Raul::Path& tail_path, - const Raul::Path& head_path); + SPtr<GraphModel> connection_graph(const Raul::Path& tail_path, + const Raul::Path& head_path); void bundle_begin() {} void bundle_end() {} @@ -127,12 +127,12 @@ private: bool attempt_connection(const Raul::Path& tail_path, const Raul::Path& head_path); - URIs& _uris; - Log& _log; - SharedPtr<Interface> _engine; - SharedPtr<SigClientInterface> _emitter; + URIs& _uris; + Log& _log; + SPtr<Interface> _engine; + SPtr<SigClientInterface> _emitter; - SharedPtr<Plugins> _plugins; ///< Map, keyed by plugin URI + SPtr<Plugins> _plugins; ///< Map, keyed by plugin URI }; } // namespace Client diff --git a/ingen/client/GraphModel.hpp b/ingen/client/GraphModel.hpp index 996e9129..7a899ecb 100644 --- a/ingen/client/GraphModel.hpp +++ b/ingen/client/GraphModel.hpp @@ -18,7 +18,7 @@ #define INGEN_CLIENT_GRAPHMODEL_HPP #include "ingen/client/BlockModel.hpp" -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" namespace Ingen { namespace Client { @@ -37,18 +37,18 @@ public: GraphType graph_type() const { return Node::GraphType::GRAPH; } - SharedPtr<ArcModel> get_arc(const Ingen::Node* tail, - const Ingen::Node* head); + SPtr<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, SharedPtr<BlockModel>); - INGEN_SIGNAL(removed_block, void, SharedPtr<BlockModel>); - INGEN_SIGNAL(new_arc, void, SharedPtr<ArcModel>); - INGEN_SIGNAL(removed_arc, void, SharedPtr<ArcModel>); + 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>); private: friend class ClientStore; @@ -58,10 +58,10 @@ private: {} void clear(); - void add_child(SharedPtr<ObjectModel> c); - bool remove_child(SharedPtr<ObjectModel> c); + void add_child(SPtr<ObjectModel> c); + bool remove_child(SPtr<ObjectModel> c); - void add_arc(SharedPtr<ArcModel> arc); + void add_arc(SPtr<ArcModel> arc); void remove_arc(const Ingen::Node* tail, const Ingen::Node* head); }; diff --git a/ingen/client/ObjectModel.hpp b/ingen/client/ObjectModel.hpp index 60e873e4..52655949 100644 --- a/ingen/client/ObjectModel.hpp +++ b/ingen/client/ObjectModel.hpp @@ -25,8 +25,8 @@ #include <cassert> #include <cstdlib> +#include "ingen/types.hpp" #include "raul/Path.hpp" -#include "raul/SharedPtr.hpp" #include "raul/URI.hpp" #include "ingen/Node.hpp" @@ -63,16 +63,16 @@ public: void on_property(const Raul::URI& uri, const Raul::Atom& value); - const Raul::Path& path() const { return _path; } - const Raul::Symbol& symbol() const { return _symbol; } - SharedPtr<ObjectModel> parent() const { return _parent; } - bool polyphonic() const; + const Raul::Path& path() const { return _path; } + const Raul::Symbol& symbol() const { return _symbol; } + SPtr<ObjectModel> parent() const { return _parent; } + bool polyphonic() const; Node* graph_parent() const { return _parent.get(); } // Signals - INGEN_SIGNAL(new_child, void, SharedPtr<ObjectModel>); - INGEN_SIGNAL(removed_child, void, SharedPtr<ObjectModel>); + INGEN_SIGNAL(new_child, void, SPtr<ObjectModel>); + INGEN_SIGNAL(removed_child, void, SPtr<ObjectModel>); INGEN_SIGNAL(property, void, const Raul::URI&, const Raul::Atom&); INGEN_SIGNAL(destroyed, void); INGEN_SIGNAL(moved, void); @@ -84,13 +84,13 @@ protected: ObjectModel(const ObjectModel& copy); virtual void set_path(const Raul::Path& p); - virtual void set_parent(SharedPtr<ObjectModel> p); - virtual void add_child(SharedPtr<ObjectModel> c) {} - virtual bool remove_child(SharedPtr<ObjectModel> c) { return true; } + virtual void set_parent(SPtr<ObjectModel> p); + virtual void add_child(SPtr<ObjectModel> c) {} + virtual bool remove_child(SPtr<ObjectModel> c) { return true; } - virtual void set(SharedPtr<ObjectModel> model); + virtual void set(SPtr<ObjectModel> model); - SharedPtr<ObjectModel> _parent; + SPtr<ObjectModel> _parent; private: Raul::Path _path; diff --git a/ingen/client/PluginModel.hpp b/ingen/client/PluginModel.hpp index 4195dfe2..dea85651 100644 --- a/ingen/client/PluginModel.hpp +++ b/ingen/client/PluginModel.hpp @@ -26,8 +26,8 @@ #include "ingen/Resource.hpp" #include "ingen/World.hpp" #include "ingen/client/signal.hpp" +#include "ingen/types.hpp" #include "lilv/lilv.h" -#include "raul/SharedPtr.hpp" #include "raul/Symbol.hpp" #include "sord/sordmm.hpp" @@ -74,8 +74,8 @@ public: bool has_ui() const; - SharedPtr<PluginUI> ui(Ingen::World* world, - SharedPtr<const BlockModel> block) const; + SPtr<PluginUI> ui(Ingen::World* world, + SPtr<const BlockModel> block) const; const std::string& icon_path() const; static std::string get_lv2_icon_path(const LilvPlugin* plugin); @@ -95,7 +95,7 @@ public: protected: friend class ClientStore; - void set(SharedPtr<PluginModel> p); + void set(SPtr<PluginModel> p); private: Type _type; diff --git a/ingen/client/PluginUI.hpp b/ingen/client/PluginUI.hpp index 60403570..b2a8bd6b 100644 --- a/ingen/client/PluginUI.hpp +++ b/ingen/client/PluginUI.hpp @@ -17,7 +17,7 @@ #ifndef INGEN_CLIENT_PLUGINUI_HPP #define INGEN_CLIENT_PLUGINUI_HPP -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" #include "lilv/lilv.h" @@ -42,9 +42,9 @@ class PluginUI { public: ~PluginUI(); - static SharedPtr<PluginUI> create(Ingen::World* world, - SharedPtr<const BlockModel> block, - const LilvPlugin* plugin); + static SPtr<PluginUI> create(Ingen::World* world, + SPtr<const BlockModel> block, + const LilvPlugin* plugin); SuilWidget get_widget(); @@ -55,22 +55,22 @@ public: bool is_resizable() const; - Ingen::World* world() const { return _world; } - SharedPtr<const BlockModel> block() const { return _block; } + Ingen::World* world() const { return _world; } + SPtr<const BlockModel> block() const { return _block; } private: - PluginUI(Ingen::World* world, - SharedPtr<const BlockModel> block, - const LilvNode* ui_node); + PluginUI(Ingen::World* world, + SPtr<const BlockModel> block, + const LilvNode* ui_node); - Ingen::World* _world; - SharedPtr<const BlockModel> _block; - SuilInstance* _instance; - LilvNode* _ui_node; + Ingen::World* _world; + SPtr<const BlockModel> _block; + SuilInstance* _instance; + LilvNode* _ui_node; static SuilHost* ui_host; - SharedPtr<LV2Features::FeatureArray> _features; + SPtr<LV2Features::FeatureArray> _features; }; } // namespace Client diff --git a/ingen/client/PortModel.hpp b/ingen/client/PortModel.hpp index 92379e6e..568975fc 100644 --- a/ingen/client/PortModel.hpp +++ b/ingen/client/PortModel.hpp @@ -20,7 +20,7 @@ #include <cstdlib> #include <string> -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" #include "lv2/lv2plug.in/ns/ext/port-props/port-props.h" #include "lv2/lv2plug.in/ns/lv2core/lv2.h" @@ -71,8 +71,8 @@ public: INGEN_SIGNAL(value_changed, void, const Raul::Atom&); INGEN_SIGNAL(voice_changed, void, uint32_t, const Raul::Atom&); INGEN_SIGNAL(activity, void, const Raul::Atom&); - INGEN_SIGNAL(connection, void, SharedPtr<PortModel>); - INGEN_SIGNAL(disconnection, void, SharedPtr<PortModel>); + INGEN_SIGNAL(connection, void, SPtr<PortModel>); + INGEN_SIGNAL(disconnection, void, SPtr<PortModel>); private: friend class ClientStore; @@ -87,20 +87,20 @@ private: , _connections(0) {} - void add_child(SharedPtr<ObjectModel> c) { throw; } - bool remove_child(SharedPtr<ObjectModel> c) { throw; } + void add_child(SPtr<ObjectModel> c) { throw; } + bool remove_child(SPtr<ObjectModel> c) { throw; } - void connected_to(SharedPtr<PortModel> p) { + void connected_to(SPtr<PortModel> p) { ++_connections; _signal_connection.emit(p); } - void disconnected_from(SharedPtr<PortModel> p) { + void disconnected_from(SPtr<PortModel> p) { --_connections; _signal_disconnection.emit(p); } - void set(SharedPtr<ObjectModel> model); + void set(SPtr<ObjectModel> model); uint32_t _index; Direction _direction; diff --git a/ingen/serialisation/Serialiser.hpp b/ingen/serialisation/Serialiser.hpp index 979fee62..d0b65893 100644 --- a/ingen/serialisation/Serialiser.hpp +++ b/ingen/serialisation/Serialiser.hpp @@ -21,7 +21,6 @@ #include <string> #include "raul/Path.hpp" -#include "raul/SharedPtr.hpp" #include "sord/sordmm.hpp" @@ -49,23 +48,23 @@ public: typedef Node::Properties Properties; - virtual void to_file(SharedPtr<const Node> object, - const std::string& filename); + virtual void to_file(SPtr<const Node> object, + const std::string& filename); - virtual void write_bundle(SharedPtr<const Node> graph, - const std::string& path); + virtual void write_bundle(SPtr<const Node> graph, + const std::string& path); - virtual std::string to_string(SharedPtr<const Node> object, - const std::string& base_uri); + virtual std::string to_string(SPtr<const Node> object, + const std::string& base_uri); virtual void start_to_string(const Raul::Path& root, const std::string& base_uri); - virtual void serialise(SharedPtr<const Node> object) + virtual void serialise(SPtr<const Node> object) throw (std::logic_error); - virtual void serialise_arc(const Sord::Node& parent, - SharedPtr<const Arc> arc) + virtual void serialise_arc(const Sord::Node& parent, + SPtr<const Arc> arc) throw (std::logic_error); virtual std::string finish(); diff --git a/src/Builder.cpp b/src/Builder.cpp index a4a519b4..dedd5cca 100644 --- a/src/Builder.cpp +++ b/src/Builder.cpp @@ -33,13 +33,13 @@ Builder::Builder(URIs& uris, Interface& interface) } void -Builder::build(SharedPtr<const Node> object) +Builder::build(SPtr<const Node> object) { _interface.put(object->uri(), object->properties()); } void -Builder::connect(SharedPtr<const Node> object) +Builder::connect(SPtr<const Node> object) { if (object->graph_type() == Node::GraphType::GRAPH) { for (auto a : object->arcs()) { diff --git a/src/LV2Features.cpp b/src/LV2Features.cpp index a7069a75..3941d92c 100644 --- a/src/LV2Features.cpp +++ b/src/LV2Features.cpp @@ -27,7 +27,7 @@ LV2Features::LV2Features() } void -LV2Features::add_feature(SharedPtr<Feature> feature) +LV2Features::add_feature(SPtr<Feature> feature) { _features.push_back(feature); } @@ -53,17 +53,17 @@ LV2Features::is_supported(const std::string& uri) const return false; } -SharedPtr<LV2Features::FeatureArray> +SPtr<LV2Features::FeatureArray> LV2Features::lv2_features(World* world, Node* node) const { FeatureArray::FeatureVector vec; for (const auto& f : _features) { - SharedPtr<LV2_Feature> fptr = f->feature(world, node); + SPtr<LV2_Feature> fptr = f->feature(world, node); if (fptr) { vec.push_back(fptr); } } - return SharedPtr<FeatureArray>(new FeatureArray(vec)); + return SPtr<FeatureArray>(new FeatureArray(vec)); } } // namespace Ingen diff --git a/src/Store.cpp b/src/Store.cpp index fda93474..560c2de9 100644 --- a/src/Store.cpp +++ b/src/Store.cpp @@ -29,7 +29,7 @@ Store::add(Node* o) return; } - insert(make_pair(o->path(), SharedPtr<Node>(o))); + insert(make_pair(o->path(), SPtr<Node>(o))); for (uint32_t i = 0; i < o->num_ports(); ++i) { add(o->port(i)); @@ -72,7 +72,7 @@ Store::find_descendants_end(const const_iterator parent) const } Store::const_range -Store::children_range(SharedPtr<const Node> o) const +Store::children_range(SPtr<const Node> o) const { const const_iterator parent = find(o->path()); if (parent != end()) { diff --git a/src/World.cpp b/src/World.cpp index 0b56262c..218da83c 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -191,23 +191,23 @@ public: typedef std::map<const std::string, ScriptRunner> ScriptRunners; ScriptRunners script_runners; - int& argc; - char**& argv; - LV2Features* lv2_features; - Sord::World* rdf_world; - URIMap* uri_map; - Forge* forge; - URIs* uris; - LV2_Log_Log* lv2_log; - Log log; - Configuration conf; - SharedPtr<Interface> interface; - SharedPtr<EngineBase> engine; - SharedPtr<Serialisation::Serialiser> serialiser; - SharedPtr<Serialisation::Parser> parser; - SharedPtr<Store> store; - LilvWorld* lilv_world; - std::string jack_uuid; + int& argc; + char**& argv; + LV2Features* lv2_features; + Sord::World* rdf_world; + URIMap* uri_map; + Forge* forge; + URIs* uris; + LV2_Log_Log* lv2_log; + Log log; + Configuration conf; + SPtr<Interface> interface; + SPtr<EngineBase> engine; + SPtr<Serialisation::Serialiser> serialiser; + SPtr<Serialisation::Parser> parser; + SPtr<Store> store; + LilvWorld* lilv_world; + std::string jack_uuid; }; World::World(int& argc, @@ -224,17 +224,17 @@ World::~World() delete _impl; } -void World::set_engine(SharedPtr<EngineBase> e) { _impl->engine = e; } -void World::set_interface(SharedPtr<Interface> i) { _impl->interface = i; } -void World::set_parser(SharedPtr<Serialisation::Parser> p) { _impl->parser = p; } -void World::set_serialiser(SharedPtr<Serialisation::Serialiser> s) { _impl->serialiser = s; } -void World::set_store(SharedPtr<Store> s) { _impl->store = s; } +void World::set_engine(SPtr<EngineBase> e) { _impl->engine = e; } +void World::set_interface(SPtr<Interface> i) { _impl->interface = i; } +void World::set_parser(SPtr<Serialisation::Parser> p) { _impl->parser = p; } +void World::set_serialiser(SPtr<Serialisation::Serialiser> s) { _impl->serialiser = s; } +void World::set_store(SPtr<Store> s) { _impl->store = s; } -SharedPtr<EngineBase> World::engine() { return _impl->engine; } -SharedPtr<Interface> World::interface() { return _impl->interface; } -SharedPtr<Serialisation::Parser> World::parser() { return _impl->parser; } -SharedPtr<Serialisation::Serialiser> World::serialiser() { return _impl->serialiser; } -SharedPtr<Store> World::store() { return _impl->store; } +SPtr<EngineBase> World::engine() { return _impl->engine; } +SPtr<Interface> World::interface() { return _impl->interface; } +SPtr<Serialisation::Parser> World::parser() { return _impl->parser; } +SPtr<Serialisation::Serialiser> World::serialiser() { return _impl->serialiser; } +SPtr<Store> World::store() { return _impl->store; } int& World::argc() { return _impl->argc; } char**& World::argv() { return _impl->argv; } @@ -288,14 +288,14 @@ World::run_module(const char* name) /** Get an interface for a remote engine at @a url */ -SharedPtr<Interface> -World::new_interface(const Raul::URI& engine_uri, - SharedPtr<Interface> respondee) +SPtr<Interface> +World::new_interface(const Raul::URI& engine_uri, + SPtr<Interface> respondee) { const Impl::InterfaceFactories::const_iterator i = _impl->interface_factories.find(engine_uri.scheme()); if (i == _impl->interface_factories.end()) { log().warn(Raul::fmt("Unknown URI scheme `%1%'\n") % engine_uri.scheme()); - return SharedPtr<Interface>(); + return SPtr<Interface>(); } return i->second(this, engine_uri, respondee); diff --git a/src/client/BlockModel.cpp b/src/client/BlockModel.cpp index eb982f0d..0ed58c7a 100644 --- a/src/client/BlockModel.cpp +++ b/src/client/BlockModel.cpp @@ -25,9 +25,9 @@ namespace Ingen { namespace Client { -BlockModel::BlockModel(URIs& uris, - SharedPtr<PluginModel> plugin, - const Raul::Path& path) +BlockModel::BlockModel(URIs& uris, + SPtr<PluginModel> plugin, + const Raul::Path& path) : ObjectModel(uris, path) , _plugin_uri(plugin->uri()) , _plugin(plugin) @@ -65,7 +65,7 @@ BlockModel::~BlockModel() } void -BlockModel::remove_port(SharedPtr<PortModel> port) +BlockModel::remove_port(SPtr<PortModel> port) { for (Ports::iterator i = _ports.begin(); i != _ports.end(); ++i) { if ((*i) == port) { @@ -99,26 +99,26 @@ BlockModel::clear() } void -BlockModel::add_child(SharedPtr<ObjectModel> c) +BlockModel::add_child(SPtr<ObjectModel> c) { assert(c->parent().get() == this); //ObjectModel::add_child(c); - SharedPtr<PortModel> pm = PtrCast<PortModel>(c); + SPtr<PortModel> pm = dynamic_ptr_cast<PortModel>(c); assert(pm); add_port(pm); } bool -BlockModel::remove_child(SharedPtr<ObjectModel> c) +BlockModel::remove_child(SPtr<ObjectModel> c) { assert(c->path().is_child_of(path())); assert(c->parent().get() == this); //bool ret = ObjectModel::remove_child(c); - SharedPtr<PortModel> pm = PtrCast<PortModel>(c); + SPtr<PortModel> pm = dynamic_ptr_cast<PortModel>(c); assert(pm); remove_port(pm); @@ -127,7 +127,7 @@ BlockModel::remove_child(SharedPtr<ObjectModel> c) } void -BlockModel::add_port(SharedPtr<PortModel> pm) +BlockModel::add_port(SPtr<PortModel> pm) { assert(pm); assert(pm->path().is_child_of(path())); @@ -140,13 +140,13 @@ BlockModel::add_port(SharedPtr<PortModel> pm) _signal_new_port.emit(pm); } -SharedPtr<const PortModel> +SPtr<const PortModel> BlockModel::get_port(const Raul::Symbol& symbol) const { for (auto p : _ports) if (p->symbol() == symbol) return p; - return SharedPtr<PortModel>(); + return SPtr<PortModel>(); } Ingen::Node* @@ -158,10 +158,10 @@ BlockModel::port(uint32_t index) const } void -BlockModel::default_port_value_range(SharedPtr<const PortModel> port, - float& min, - float& max, - uint32_t srate) const +BlockModel::default_port_value_range(SPtr<const PortModel> port, + float& min, + float& max, + uint32_t srate) const { // Default control values min = 0.0; @@ -190,8 +190,10 @@ BlockModel::default_port_value_range(SharedPtr<const PortModel> port, } void -BlockModel::port_value_range(SharedPtr<const PortModel> port, - float& min, float& max, uint32_t srate) const +BlockModel::port_value_range(SPtr<const PortModel> port, + float& min, + float& max, + uint32_t srate) const { assert(port->parent().get() == this); @@ -228,7 +230,7 @@ BlockModel::label() const } std::string -BlockModel::port_label(SharedPtr<const PortModel> port) const +BlockModel::port_label(SPtr<const PortModel> port) const { const Raul::Atom& name = port->get_property(Raul::URI(LV2_CORE__name)); if (name.is_valid()) { @@ -255,9 +257,9 @@ BlockModel::port_label(SharedPtr<const PortModel> port) const } void -BlockModel::set(SharedPtr<ObjectModel> model) +BlockModel::set(SPtr<ObjectModel> model) { - SharedPtr<BlockModel> block = PtrCast<BlockModel>(model); + SPtr<BlockModel> block = dynamic_ptr_cast<BlockModel>(model); if (block) { _plugin_uri = block->_plugin_uri; _plugin = block->_plugin; diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 318d31a5..8c48ab72 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -31,10 +31,10 @@ using namespace std; namespace Ingen { namespace Client { -ClientStore::ClientStore(URIs& uris, - Log& log, - SharedPtr<Interface> engine, - SharedPtr<SigClientInterface> emitter) +ClientStore::ClientStore(URIs& uris, + Log& log, + SPtr<Interface> engine, + SPtr<SigClientInterface> emitter) : _uris(uris) , _log(log) , _engine(engine) @@ -66,16 +66,16 @@ ClientStore::clear() } void -ClientStore::add_object(SharedPtr<ObjectModel> object) +ClientStore::add_object(SPtr<ObjectModel> object) { // If we already have "this" object, merge the existing one into the new // one (with precedence to the new values). iterator existing = find(object->path()); if (existing != end()) { - PtrCast<ObjectModel>(existing->second)->set(object); + dynamic_ptr_cast<ObjectModel>(existing->second)->set(object); } else { if (!object->path().is_root()) { - SharedPtr<ObjectModel> parent = _object(object->path().parent()); + SPtr<ObjectModel> parent = _object(object->path().parent()); if (parent) { assert(object->path().is_child_of(parent->path())); object->set_parent(parent); @@ -97,13 +97,13 @@ ClientStore::add_object(SharedPtr<ObjectModel> object) object->signal_property().emit(p.first, p.second); } -SharedPtr<ObjectModel> +SPtr<ObjectModel> ClientStore::remove_object(const Raul::Path& path) { // Find the object, the "top" of the tree to remove const iterator top = find(path); if (top == end()) { - return SharedPtr<ObjectModel>(); + return SPtr<ObjectModel>(); } // Remove the object and all its descendants @@ -111,7 +111,7 @@ ClientStore::remove_object(const Raul::Path& path) remove(top, removed); // Notify everything that needs to know this object is going away - SharedPtr<ObjectModel> object = PtrCast<ObjectModel>(top->second); + SPtr<ObjectModel> object = dynamic_ptr_cast<ObjectModel>(top->second); if (object) { // Notify the program this object is going away object->signal_destroyed().emit(); @@ -125,43 +125,43 @@ ClientStore::remove_object(const Raul::Path& path) return object; } -SharedPtr<PluginModel> +SPtr<PluginModel> ClientStore::_plugin(const Raul::URI& uri) { Plugins::iterator i = _plugins->find(uri); if (i == _plugins->end()) - return SharedPtr<PluginModel>(); + return SPtr<PluginModel>(); else return (*i).second; } -SharedPtr<const PluginModel> +SPtr<const PluginModel> ClientStore::plugin(const Raul::URI& uri) const { return const_cast<ClientStore*>(this)->_plugin(uri); } -SharedPtr<ObjectModel> +SPtr<ObjectModel> ClientStore::_object(const Raul::Path& path) { const iterator i = find(path); if (i == end()) { - return SharedPtr<ObjectModel>(); + return SPtr<ObjectModel>(); } else { - SharedPtr<ObjectModel> model = PtrCast<ObjectModel>(i->second); + SPtr<ObjectModel> model = dynamic_ptr_cast<ObjectModel>(i->second); assert(model); assert(model->path().is_root() || model->parent()); return model; } } -SharedPtr<const ObjectModel> +SPtr<const ObjectModel> ClientStore::object(const Raul::Path& path) const { return const_cast<ClientStore*>(this)->_object(path); } -SharedPtr<Resource> +SPtr<Resource> ClientStore::_resource(const Raul::URI& uri) { if (Node::uri_is_path(uri)) { @@ -171,16 +171,16 @@ ClientStore::_resource(const Raul::URI& uri) } } -SharedPtr<const Resource> +SPtr<const Resource> ClientStore::resource(const Raul::URI& uri) const { return const_cast<ClientStore*>(this)->_resource(uri); } void -ClientStore::add_plugin(SharedPtr<PluginModel> pm) +ClientStore::add_plugin(SPtr<PluginModel> pm) { - SharedPtr<PluginModel> existing = _plugin(pm->uri()); + SPtr<PluginModel> existing = _plugin(pm->uri()); if (existing) { existing->set(pm); } else { @@ -235,7 +235,7 @@ ClientStore::put(const Raul::URI& uri, if (plugin_type == Plugin::Graph) { is_graph = true; } else if (plugin_type != Plugin::NIL) { - SharedPtr<PluginModel> p( + SPtr<PluginModel> p( new PluginModel(uris(), uri, type_uri, properties)); add_plugin(p); return; @@ -250,7 +250,7 @@ ClientStore::put(const Raul::URI& uri, const Raul::Path path(Node::uri_to_path(uri)); - SharedPtr<ObjectModel> obj = PtrCast<ObjectModel>(_object(path)); + SPtr<ObjectModel> obj = dynamic_ptr_cast<ObjectModel>(_object(path)); if (obj) { obj->set_properties(properties); return; @@ -261,15 +261,15 @@ ClientStore::put(const Raul::URI& uri, } if (is_graph) { - SharedPtr<GraphModel> model(new GraphModel(uris(), path)); + SPtr<GraphModel> model(new GraphModel(uris(), path)); model->set_properties(properties); add_object(model); } else if (is_block) { const Iterator p = properties.find(_uris.ingen_prototype); - SharedPtr<PluginModel> plug; + SPtr<PluginModel> plug; if (p->second.is_valid() && p->second.type() == _uris.forge.URI) { if (!(plug = _plugin(Raul::URI(p->second.get_uri())))) { - plug = SharedPtr<PluginModel>( + plug = SPtr<PluginModel>( new PluginModel(uris(), Raul::URI(p->second.get_uri()), _uris.ingen_nil, @@ -277,7 +277,7 @@ ClientStore::put(const Raul::URI& uri, add_plugin(plug); } - SharedPtr<BlockModel> bm(new BlockModel(uris(), plug, path)); + SPtr<BlockModel> bm(new BlockModel(uris(), plug, path)); bm->set_properties(properties); add_object(bm); } else { @@ -291,7 +291,7 @@ ClientStore::put(const Raul::URI& uri, const Iterator i = properties.find(_uris.lv2_index); if (i != properties.end() && i->second.type() == _uris.forge.Int) { const uint32_t index = i->second.get_int32(); - SharedPtr<PortModel> p( + SPtr<PortModel> p( new PortModel(uris(), path, index, pdir)); p->set_properties(properties); add_object(p); @@ -331,7 +331,7 @@ ClientStore::delta(const Raul::URI& uri, const Raul::Path path(Node::uri_to_path(uri)); - SharedPtr<ObjectModel> obj = _object(path); + SPtr<ObjectModel> obj = _object(path); if (obj) { obj->remove_properties(remove); obj->add_properties(add); @@ -351,7 +351,7 @@ ClientStore::set_property(const Raul::URI& subject_uri, % predicate.c_str() % _uris.forge.str(value)); return; } - SharedPtr<Resource> subject = _resource(subject_uri); + SPtr<Resource> subject = _resource(subject_uri); if (subject) { if (predicate == _uris.ingen_activity) { /* Activity is transient, trigger any live actions (like GUI @@ -361,7 +361,7 @@ ClientStore::set_property(const Raul::URI& subject_uri, subject->set_property(predicate, value); } } else { - SharedPtr<PluginModel> plugin = _plugin(subject_uri); + SPtr<PluginModel> plugin = _plugin(subject_uri); if (plugin) { plugin->set_property(predicate, value); } else if (predicate != _uris.ingen_activity) { @@ -371,23 +371,23 @@ ClientStore::set_property(const Raul::URI& subject_uri, } } -SharedPtr<GraphModel> +SPtr<GraphModel> ClientStore::connection_graph(const Raul::Path& tail_path, const Raul::Path& head_path) { - SharedPtr<GraphModel> graph; + SPtr<GraphModel> graph; if (tail_path.parent() == head_path.parent()) - graph = PtrCast<GraphModel>(_object(tail_path.parent())); + graph = dynamic_ptr_cast<GraphModel>(_object(tail_path.parent())); if (!graph && tail_path.parent() == head_path.parent().parent()) - graph = PtrCast<GraphModel>(_object(tail_path.parent())); + graph = dynamic_ptr_cast<GraphModel>(_object(tail_path.parent())); if (!graph && tail_path.parent().parent() == head_path.parent()) - graph = PtrCast<GraphModel>(_object(head_path.parent())); + graph = dynamic_ptr_cast<GraphModel>(_object(head_path.parent())); if (!graph) - graph = PtrCast<GraphModel>(_object(tail_path.parent().parent())); + graph = dynamic_ptr_cast<GraphModel>(_object(tail_path.parent().parent())); if (!graph) _log.error(Raul::fmt("Unable to find graph for arc %1% => %2%\n") @@ -400,12 +400,12 @@ bool ClientStore::attempt_connection(const Raul::Path& tail_path, const Raul::Path& head_path) { - SharedPtr<PortModel> tail = PtrCast<PortModel>(_object(tail_path)); - SharedPtr<PortModel> head = PtrCast<PortModel>(_object(head_path)); + SPtr<PortModel> tail = dynamic_ptr_cast<PortModel>(_object(tail_path)); + SPtr<PortModel> head = dynamic_ptr_cast<PortModel>(_object(head_path)); if (tail && head) { - SharedPtr<GraphModel> graph = connection_graph(tail_path, head_path); - SharedPtr<ArcModel> arc(new ArcModel(tail, head)); + SPtr<GraphModel> graph = connection_graph(tail_path, head_path); + SPtr<ArcModel> arc(new ArcModel(tail, head)); tail->connected_to(head); head->connected_to(tail); @@ -430,8 +430,8 @@ void ClientStore::disconnect(const Raul::Path& src_path, const Raul::Path& dst_path) { - SharedPtr<PortModel> tail = PtrCast<PortModel>(_object(src_path)); - SharedPtr<PortModel> head = PtrCast<PortModel>(_object(dst_path)); + SPtr<PortModel> tail = dynamic_ptr_cast<PortModel>(_object(src_path)); + SPtr<PortModel> head = dynamic_ptr_cast<PortModel>(_object(dst_path)); if (tail) tail->disconnected_from(head); @@ -439,7 +439,7 @@ ClientStore::disconnect(const Raul::Path& src_path, if (head) head->disconnected_from(tail); - SharedPtr<GraphModel> graph = connection_graph(src_path, dst_path); + SPtr<GraphModel> graph = connection_graph(src_path, dst_path); if (graph) graph->remove_arc(tail.get(), head.get()); } @@ -448,8 +448,8 @@ void ClientStore::disconnect_all(const Raul::Path& parent_graph, const Raul::Path& path) { - SharedPtr<GraphModel> graph = PtrCast<GraphModel>(_object(parent_graph)); - SharedPtr<ObjectModel> object = _object(path); + SPtr<GraphModel> graph = dynamic_ptr_cast<GraphModel>(_object(parent_graph)); + SPtr<ObjectModel> object = _object(path); if (!graph || !object) { _log.error(Raul::fmt("Bad disconnect all notification %1% in %2%\n") @@ -459,7 +459,7 @@ ClientStore::disconnect_all(const Raul::Path& parent_graph, const GraphModel::Arcs arcs = graph->arcs(); for (auto a : arcs) { - SharedPtr<ArcModel> arc = PtrCast<ArcModel>(a.second); + SPtr<ArcModel> arc = dynamic_ptr_cast<ArcModel>(a.second); if (arc->tail()->parent() == object || arc->head()->parent() == object || arc->tail()->path() == path diff --git a/src/client/GraphModel.cpp b/src/client/GraphModel.cpp index 98155138..8586f168 100644 --- a/src/client/GraphModel.cpp +++ b/src/client/GraphModel.cpp @@ -28,24 +28,24 @@ namespace Ingen { namespace Client { void -GraphModel::add_child(SharedPtr<ObjectModel> c) +GraphModel::add_child(SPtr<ObjectModel> c) { assert(c->parent().get() == this); - SharedPtr<PortModel> pm = PtrCast<PortModel>(c); + SPtr<PortModel> pm = dynamic_ptr_cast<PortModel>(c); if (pm) { add_port(pm); return; } - SharedPtr<BlockModel> bm = PtrCast<BlockModel>(c); + SPtr<BlockModel> bm = dynamic_ptr_cast<BlockModel>(c); if (bm) { _signal_new_block.emit(bm); } } bool -GraphModel::remove_child(SharedPtr<ObjectModel> o) +GraphModel::remove_child(SPtr<ObjectModel> o) { assert(o->path().is_child_of(path())); assert(o->parent().get() == this); @@ -56,7 +56,7 @@ GraphModel::remove_child(SharedPtr<ObjectModel> o) Arcs::iterator next = j; ++next; - SharedPtr<ArcModel> arc = PtrCast<ArcModel>(j->second); + SPtr<ArcModel> arc = dynamic_ptr_cast<ArcModel>(j->second); if (arc->tail_path().parent() == o->path() || arc->tail_path() == o->path() || arc->head_path().parent() == o->path() @@ -67,11 +67,11 @@ GraphModel::remove_child(SharedPtr<ObjectModel> o) j = next; } - SharedPtr<PortModel> pm = PtrCast<PortModel>(o); + SPtr<PortModel> pm = dynamic_ptr_cast<PortModel>(o); if (pm) remove_port(pm); - SharedPtr<BlockModel> bm = PtrCast<BlockModel>(o); + SPtr<BlockModel> bm = dynamic_ptr_cast<BlockModel>(o); if (bm) { _signal_removed_block.emit(bm); } @@ -90,14 +90,14 @@ GraphModel::clear() assert(_ports.empty()); } -SharedPtr<ArcModel> +SPtr<ArcModel> GraphModel::get_arc(const Node* tail, const Node* head) { Arcs::iterator i = _arcs.find(make_pair(tail, head)); if (i != _arcs.end()) - return PtrCast<ArcModel>(i->second); + return dynamic_ptr_cast<ArcModel>(i->second); else - return SharedPtr<ArcModel>(); + return SPtr<ArcModel>(); } /** Add a connection to this graph. @@ -108,7 +108,7 @@ GraphModel::get_arc(const Node* tail, const Node* head) * this graph is a fatal error. */ void -GraphModel::add_arc(SharedPtr<ArcModel> arc) +GraphModel::add_arc(SPtr<ArcModel> arc) { // Store should have 'resolved' the connection already assert(arc); @@ -122,7 +122,7 @@ GraphModel::add_arc(SharedPtr<ArcModel> arc) assert(arc->head()->parent().get() == this || arc->head()->parent()->parent().get() == this); - SharedPtr<ArcModel> existing = get_arc( + SPtr<ArcModel> existing = get_arc( arc->tail().get(), arc->head().get()); if (existing) { @@ -141,7 +141,7 @@ GraphModel::remove_arc(const Node* tail, const Node* head) { Arcs::iterator i = _arcs.find(make_pair(tail, head)); if (i != _arcs.end()) { - SharedPtr<ArcModel> arc = PtrCast<ArcModel>(i->second); + SPtr<ArcModel> arc = dynamic_ptr_cast<ArcModel>(i->second); _signal_removed_arc.emit(arc); _arcs.erase(i); } diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp index 51427f90..9fc22c03 100644 --- a/src/client/ObjectModel.cpp +++ b/src/client/ObjectModel.cpp @@ -73,7 +73,7 @@ ObjectModel::polyphonic() const * @a o as correct. The paths of the two models MUST be equal. */ void -ObjectModel::set(SharedPtr<ObjectModel> o) +ObjectModel::set(SPtr<ObjectModel> o) { assert(_path == o->path()); if (o->_parent) @@ -94,7 +94,7 @@ ObjectModel::set_path(const Raul::Path& p) } void -ObjectModel::set_parent(SharedPtr<ObjectModel> p) +ObjectModel::set_parent(SPtr<ObjectModel> p) { assert(_path.is_child_of(p->path())); _parent = p; diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 5dc6ec2a..206aebab 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -151,7 +151,7 @@ PluginModel::get_property(const Raul::URI& key) const } void -PluginModel::set(SharedPtr<PluginModel> p) +PluginModel::set(SPtr<PluginModel> p) { _type = p->_type; @@ -229,12 +229,12 @@ PluginModel::has_ui() const } -SharedPtr<PluginUI> -PluginModel::ui(Ingen::World* world, - SharedPtr<const BlockModel> block) const +SPtr<PluginUI> +PluginModel::ui(Ingen::World* world, + SPtr<const BlockModel> block) const { if (!_lilv_plugin) { - return SharedPtr<PluginUI>(); + return SPtr<PluginUI>(); } return PluginUI::create(world, block, _lilv_plugin); diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index 7a4c88e8..24144b42 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -47,7 +47,7 @@ lv2_ui_write(SuilController controller, return; } - SharedPtr<const PortModel> port = ports[port_index]; + SPtr<const PortModel> port = ports[port_index]; const URIs& uris = ui->world()->uris(); @@ -77,9 +77,9 @@ lv2_ui_write(SuilController controller, } } -PluginUI::PluginUI(Ingen::World* world, - SharedPtr<const BlockModel> block, - const LilvNode* ui_node) +PluginUI::PluginUI(Ingen::World* world, + SPtr<const BlockModel> block, + const LilvNode* ui_node) : _world(world) , _block(block) , _instance(NULL) @@ -93,10 +93,10 @@ PluginUI::~PluginUI() lilv_node_free(_ui_node); } -SharedPtr<PluginUI> -PluginUI::create(Ingen::World* world, - SharedPtr<const BlockModel> block, - const LilvPlugin* plugin) +SPtr<PluginUI> +PluginUI::create(Ingen::World* world, + SPtr<const BlockModel> block, + const LilvPlugin* plugin) { if (!PluginUI::ui_host) { PluginUI::ui_host = suil_host_new(lv2_ui_write, NULL, NULL, NULL); @@ -123,10 +123,10 @@ PluginUI::create(Ingen::World* world, if (!ui) { lilv_node_free(gtk_ui); - return SharedPtr<PluginUI>(); + return SPtr<PluginUI>(); } - SharedPtr<PluginUI> ret(new PluginUI(world, block, lilv_ui_get_uri(ui))); + SPtr<PluginUI> ret(new PluginUI(world, block, lilv_ui_get_uri(ui))); ret->_features = world->lv2_features().lv2_features( world, const_cast<BlockModel*>(block.get())); diff --git a/src/client/PortModel.cpp b/src/client/PortModel.cpp index a4261202..eb645791 100644 --- a/src/client/PortModel.cpp +++ b/src/client/PortModel.cpp @@ -64,11 +64,11 @@ PortModel::is_uri() const } void -PortModel::set(SharedPtr<ObjectModel> model) +PortModel::set(SPtr<ObjectModel> model) { ObjectModel::set(model); - SharedPtr<PortModel> port = PtrCast<PortModel>(model); + SPtr<PortModel> port = dynamic_ptr_cast<PortModel>(model); if (port) { _index = port->_index; _direction = port->_direction; diff --git a/src/client/ingen_client.cpp b/src/client/ingen_client.cpp index 46a14dc1..6f873f14 100644 --- a/src/client/ingen_client.cpp +++ b/src/client/ingen_client.cpp @@ -16,15 +16,13 @@ #include "ingen/Module.hpp" #include "ingen/World.hpp" -#include "raul/SharedPtr.hpp" #include "ingen_config.h" using namespace Ingen; struct IngenClientModule : public Ingen::Module { - void load(Ingen::World* world) { - } + void load(Ingen::World* world) {} }; extern "C" { diff --git a/src/gui/App.cpp b/src/gui/App.cpp index 11da12f0..5fcfb57d 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -97,7 +97,7 @@ App::~App() delete _window_factory; } -SharedPtr<App> +SPtr<App> App::create(Ingen::World* world) { _main = Gtk::Main::instance(); @@ -136,7 +136,7 @@ App::create(Ingen::World* world) Gtk::RC::parse_string(rc_style); - return SharedPtr<App>(app); + return SPtr<App>(app); } void @@ -155,7 +155,7 @@ App::run() } void -App::attach(SharedPtr<SigClientInterface> client) +App::attach(SPtr<SigClientInterface> client) { assert(!_client); assert(!_store); @@ -166,8 +166,8 @@ App::attach(SharedPtr<SigClientInterface> client) } _client = client; - _store = SharedPtr<ClientStore>(new ClientStore(_world->uris(), _world->log(), _world->interface(), client)); - _loader = SharedPtr<ThreadedLoader>(new ThreadedLoader(*this, _world->interface())); + _store = SPtr<ClientStore>(new ClientStore(_world->uris(), _world->log(), _world->interface(), client)); + _loader = SPtr<ThreadedLoader>(new ThreadedLoader(*this, _world->interface())); _graph_tree_window->init(*this, *_store); @@ -189,7 +189,7 @@ App::detach() _loader.reset(); _store.reset(); _client.reset(); - _world->set_interface(SharedPtr<Interface>()); + _world->set_interface(SPtr<Interface>()); } } @@ -202,7 +202,7 @@ App::request_plugins_if_necessary() } } -SharedPtr<Serialisation::Serialiser> +SPtr<Serialisation::Serialiser> App::serialiser() { if (!_world->serialiser()) @@ -376,10 +376,6 @@ struct IconDestroyNotification { Glib::RefPtr<Gdk::Pixbuf> App::icon_from_path(const string& path, int size) { - /* If weak references to Glib::Objects are needed somewhere else it will - probably be a good idea to create a proper WeakPtr class instead of - using raw pointers, but for a single use this will do. */ - Glib::RefPtr<Gdk::Pixbuf> buf; if (path.length() == 0) return buf; diff --git a/src/gui/App.hpp b/src/gui/App.hpp index 2b27de25..e435c4a5 100644 --- a/src/gui/App.hpp +++ b/src/gui/App.hpp @@ -28,9 +28,9 @@ #include "ingen/Status.hpp" #include "ingen/World.hpp" +#include "ingen/types.hpp" #include "raul/Atom.hpp" #include "raul/Deletable.hpp" -#include "raul/SharedPtr.hpp" #include "raul/URI.hpp" namespace Ingen { @@ -74,7 +74,7 @@ public: void error_message(const std::string& msg); - void attach(SharedPtr<Client::SigClientInterface> client); + void attach(SPtr<Client::SigClientInterface> client); void detach(); @@ -108,15 +108,15 @@ public: Glib::RefPtr<Gdk::Pixbuf> icon_from_path(const std::string& path, int size); - Ingen::Forge& forge() const { return _world->forge(); } - SharedPtr<Ingen::Interface> interface() const { return _world->interface(); } - SharedPtr<Client::SigClientInterface> client() const { return _client; } - SharedPtr<Client::ClientStore> store() const { return _store; } - SharedPtr<ThreadedLoader> loader() const { return _loader; } + Ingen::Forge& forge() const { return _world->forge(); } + SPtr<Ingen::Interface> interface() const { return _world->interface(); } + SPtr<Client::SigClientInterface> client() const { return _client; } + SPtr<Client::ClientStore> store() const { return _store; } + SPtr<ThreadedLoader> loader() const { return _loader; } - SharedPtr<Serialisation::Serialiser> serialiser(); + SPtr<Serialisation::Serialiser> serialiser(); - static SharedPtr<App> create(Ingen::World* world); + static SPtr<App> create(Ingen::World* world); void run(); inline Ingen::World* world() const { return _world; } @@ -152,9 +152,9 @@ protected: static Gtk::Main* _main; - SharedPtr<Client::SigClientInterface> _client; - SharedPtr<Client::ClientStore> _store; - SharedPtr<ThreadedLoader> _loader; + SPtr<Client::SigClientInterface> _client; + SPtr<Client::ClientStore> _store; + SPtr<ThreadedLoader> _loader; Style* _style; diff --git a/src/gui/Arc.cpp b/src/gui/Arc.cpp index b75f30ae..0289d2b7 100644 --- a/src/gui/Arc.cpp +++ b/src/gui/Arc.cpp @@ -19,11 +19,11 @@ namespace Ingen { namespace GUI { -Arc::Arc(Ganv::Canvas& canvas, - boost::shared_ptr<const Client::ArcModel> model, - Ganv::Node* src, - Ganv::Node* dst, - uint32_t color) +Arc::Arc(Ganv::Canvas& canvas, + SPtr<const Client::ArcModel> model, + Ganv::Node* src, + Ganv::Node* dst, + uint32_t color) : Ganv::Edge(canvas, src, dst, color) , _arc_model(model) { diff --git a/src/gui/Arc.hpp b/src/gui/Arc.hpp index df6dfbfb..52a03a23 100644 --- a/src/gui/Arc.hpp +++ b/src/gui/Arc.hpp @@ -20,7 +20,7 @@ #include <cassert> #include "ganv/Edge.hpp" -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" namespace Ingen { @@ -35,16 +35,16 @@ namespace GUI { class Arc : public Ganv::Edge { public: - Arc(Ganv::Canvas& canvas, - boost::shared_ptr<const Client::ArcModel> model, - Ganv::Node* src, - Ganv::Node* dst, - uint32_t color); + Arc(Ganv::Canvas& canvas, + SPtr<const Client::ArcModel> model, + Ganv::Node* src, + Ganv::Node* dst, + uint32_t color); - SharedPtr<const Client::ArcModel> model() const { return _arc_model; } + SPtr<const Client::ArcModel> model() const { return _arc_model; } private: - SharedPtr<const Client::ArcModel> _arc_model; + SPtr<const Client::ArcModel> _arc_model; }; } // namespace GUI diff --git a/src/gui/BreadCrumbs.cpp b/src/gui/BreadCrumbs.cpp index 22142285..8073f933 100644 --- a/src/gui/BreadCrumbs.cpp +++ b/src/gui/BreadCrumbs.cpp @@ -39,14 +39,14 @@ BreadCrumbs::BreadCrumbs(App& app) set_can_focus(false); } -SharedPtr<GraphView> +SPtr<GraphView> BreadCrumbs::view(const Raul::Path& path) { for (const auto& b : _breadcrumbs) if (b->path() == path) return b->view(); - return SharedPtr<GraphView>(); + return SPtr<GraphView>(); } /** Sets up the crumbs to display @a path. @@ -55,7 +55,7 @@ BreadCrumbs::view(const Raul::Path& path) * children preserved. */ void -BreadCrumbs::build(Raul::Path path, SharedPtr<GraphView> view) +BreadCrumbs::build(Raul::Path path, SPtr<GraphView> view) { bool old_enable_signal = _enable_signal; _enable_signal = false; @@ -146,11 +146,11 @@ BreadCrumbs::build(Raul::Path path, SharedPtr<GraphView> view) * match, otherwise ignoring @a view. */ BreadCrumbs::BreadCrumb* -BreadCrumbs::create_crumb(const Raul::Path& path, - SharedPtr<GraphView> view) +BreadCrumbs::create_crumb(const Raul::Path& path, + SPtr<GraphView> view) { BreadCrumb* but = manage(new BreadCrumb(path, - (view && path == view->graph()->path()) ? view : SharedPtr<GraphView>())); + (view && path == view->graph()->path()) ? view : SPtr<GraphView>())); but->signal_toggled().connect(sigc::bind(sigc::mem_fun( this, &BreadCrumbs::breadcrumb_clicked), but)); diff --git a/src/gui/BreadCrumbs.hpp b/src/gui/BreadCrumbs.hpp index cdb11583..933a28dc 100644 --- a/src/gui/BreadCrumbs.hpp +++ b/src/gui/BreadCrumbs.hpp @@ -24,9 +24,9 @@ #include <gtkmm/togglebutton.h> #include "raul/Path.hpp" -#include "raul/SharedPtr.hpp" #include "ingen/client/GraphModel.hpp" +#include "ingen/types.hpp" #include "GraphView.hpp" @@ -43,11 +43,11 @@ class BreadCrumbs : public Gtk::HBox public: explicit BreadCrumbs(App& app); - SharedPtr<GraphView> view(const Raul::Path& path); + SPtr<GraphView> view(const Raul::Path& path); - void build(Raul::Path path, SharedPtr<GraphView> view); + void build(Raul::Path path, SPtr<GraphView> view); - sigc::signal<void, const Raul::Path&, SharedPtr<GraphView> > signal_graph_selected; + sigc::signal<void, const Raul::Path&, SPtr<GraphView> > signal_graph_selected; private: /** Breadcrumb button. @@ -62,7 +62,7 @@ private: class BreadCrumb : public Gtk::ToggleButton { public: - BreadCrumb(const Raul::Path& path, SharedPtr<GraphView> view = SharedPtr<GraphView>()) + BreadCrumb(const Raul::Path& path, SPtr<GraphView> view = SPtr<GraphView>()) : _path(path) , _view(view) { @@ -73,13 +73,13 @@ private: show_all(); } - void set_view(SharedPtr<GraphView> view) { + void set_view(SPtr<GraphView> view) { assert(!view || view->graph()->path() == _path); _view = view; } - const Raul::Path& path() const { return _path; } - SharedPtr<GraphView> view() const { return _view; } + const Raul::Path& path() const { return _path; } + SPtr<GraphView> view() const { return _view; } void set_path(const Raul::Path& path) { remove(); @@ -94,12 +94,12 @@ private: } private: - Raul::Path _path; - SharedPtr<GraphView> _view; + Raul::Path _path; + SPtr<GraphView> _view; }; - BreadCrumb* create_crumb(const Raul::Path& path, - SharedPtr<GraphView> view = SharedPtr<GraphView>()); + BreadCrumb* create_crumb(const Raul::Path& path, + SPtr<GraphView> view = SPtr<GraphView>()); void breadcrumb_clicked(BreadCrumb* crumb); diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index ab889461..ca4836b7 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -82,11 +82,11 @@ ConnectWindow::start(App& app, Ingen::World* world) } set_connected_to(world->interface()); - connect(world->interface()); + connect(bool(world->interface())); } void -ConnectWindow::set_connected_to(SharedPtr<Ingen::Interface> engine) +ConnectWindow::set_connected_to(SPtr<Ingen::Interface> engine) { _app->world()->set_interface(engine); @@ -174,9 +174,9 @@ ConnectWindow::connect(bool existing) uri = world->interface()->uri(); } - SharedPtr<ThreadedSigClientInterface> tsci; + SPtr<ThreadedSigClientInterface> tsci; if (world->interface()) { - tsci = PtrCast<ThreadedSigClientInterface>( + tsci = dynamic_ptr_cast<ThreadedSigClientInterface>( world->interface()->respondee()); } @@ -200,7 +200,7 @@ ConnectWindow::connect(bool existing) if (Raul::Process::launch(cmd)) { const Raul::URI engine_uri(string("tcp://localhost:") + port_str); - SharedPtr<ThreadedSigClientInterface> tsci(new ThreadedSigClientInterface(1024)); + SPtr<ThreadedSigClientInterface> tsci(new ThreadedSigClientInterface(1024)); world->set_interface(world->new_interface(engine_uri, tsci)); _app->attach(tsci); @@ -221,7 +221,7 @@ ConnectWindow::connect(bool existing) world->engine()->activate(); } - SharedPtr<SigClientInterface> client(new SigClientInterface()); + SPtr<SigClientInterface> client(new SigClientInterface()); world->interface()->set_respondee(client); _app->attach(client); @@ -239,7 +239,7 @@ ConnectWindow::disconnect() _attached = false; _app->detach(); - set_connected_to(SharedPtr<Ingen::Interface>()); + set_connected_to(SPtr<Ingen::Interface>()); if (!_widgets_loaded) return; @@ -418,7 +418,7 @@ ConnectWindow::gtk_callback() ++_connect_stage; } else if (_connect_stage == 3) { if (_app->store()->size() > 0) { - SharedPtr<const GraphModel> root = PtrCast<const GraphModel>( + SPtr<const GraphModel> root = dynamic_ptr_cast<const GraphModel>( _app->store()->object(Raul::Path("/"))); if (root) { set_connected_to(_app->interface()); diff --git a/src/gui/ConnectWindow.hpp b/src/gui/ConnectWindow.hpp index ade0f3b1..2efa394f 100644 --- a/src/gui/ConnectWindow.hpp +++ b/src/gui/ConnectWindow.hpp @@ -26,8 +26,8 @@ #include <gtkmm/radiobutton.h> #include <gtkmm/spinbutton.h> +#include "ingen/types.hpp" #include "lilv/lilv.h" -#include "raul/SharedPtr.hpp" #include "Window.hpp" @@ -49,7 +49,7 @@ public: ConnectWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml); - void set_connected_to(SharedPtr<Ingen::Interface> engine); + void set_connected_to(SPtr<Ingen::Interface> engine); void start(App& app, Ingen::World* world); void ingen_response(int32_t id, Status status, const std::string& subject) { _attached = true; diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index fd47ee26..84116196 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -157,15 +157,15 @@ GraphBox::~GraphBox() delete _breadcrumbs; } -SharedPtr<GraphBox> -GraphBox::create(App& app, SharedPtr<const GraphModel> graph) +SPtr<GraphBox> +GraphBox::create(App& app, SPtr<const GraphModel> graph) { GraphBox* result = NULL; Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("graph_win"); xml->get_widget_derived("graph_win_vbox", result); result->init_box(app); - result->set_graph(graph, SharedPtr<GraphView>()); - return SharedPtr<GraphBox>(result); + result->set_graph(graph, SPtr<GraphView>()); + return SPtr<GraphBox>(result); } void @@ -193,13 +193,13 @@ GraphBox::init_box(App& app) } void -GraphBox::set_graph_from_path(const Raul::Path& path, SharedPtr<GraphView> view) +GraphBox::set_graph_from_path(const Raul::Path& path, SPtr<GraphView> view) { if (view) { assert(view->graph()->path() == path); _app->window_factory()->present_graph(view->graph(), _window, view); } else { - SharedPtr<const GraphModel> model = PtrCast<const GraphModel>( + SPtr<const GraphModel> model = dynamic_ptr_cast<const GraphModel>( _app->store()->object(path)); if (model) { _app->window_factory()->present_graph(model, _window); @@ -212,8 +212,8 @@ GraphBox::set_graph_from_path(const Raul::Path& path, SharedPtr<GraphView> view) * If @a view is NULL, a new view will be created. */ void -GraphBox::set_graph(SharedPtr<const GraphModel> graph, - SharedPtr<GraphView> view) +GraphBox::set_graph(SPtr<const GraphModel> graph, + SPtr<GraphView> view) { if (!graph || graph == _graph) return; @@ -287,7 +287,7 @@ GraphBox::set_graph(SharedPtr<const GraphModel> graph, } void -GraphBox::graph_port_added(SharedPtr<const PortModel> port) +GraphBox::graph_port_added(SPtr<const PortModel> port) { if (port->is_input() && _app->can_control(port.get())) { _menu_view_control_window->property_sensitive() = true; @@ -295,7 +295,7 @@ GraphBox::graph_port_added(SharedPtr<const PortModel> port) } void -GraphBox::graph_port_removed(SharedPtr<const PortModel> port) +GraphBox::graph_port_removed(SPtr<const PortModel> port) { if (!(port->is_input() && _app->can_control(port.get()))) return; diff --git a/src/gui/GraphBox.hpp b/src/gui/GraphBox.hpp index f78d8a2b..663a3c14 100644 --- a/src/gui/GraphBox.hpp +++ b/src/gui/GraphBox.hpp @@ -28,7 +28,7 @@ #include <gtkmm/scrolledwindow.h> #include <gtkmm/statusbar.h> -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" #include "Window.hpp" @@ -67,33 +67,33 @@ public: const Glib::RefPtr<Gtk::Builder>& xml); ~GraphBox(); - static SharedPtr<GraphBox> create( - App& app, SharedPtr<const Client::GraphModel> graph); + static SPtr<GraphBox> create( + App& app, SPtr<const Client::GraphModel> graph); void init_box(App& app); - void set_graph(SharedPtr<const Client::GraphModel> graph, - SharedPtr<GraphView> view); + void set_graph(SPtr<const Client::GraphModel> graph, + SPtr<GraphView> view); void set_window(GraphWindow* win) { _window = win; } bool documentation_is_visible() { return _doc_scrolledwindow->is_visible(); } void set_documentation(const std::string& doc, bool html); - SharedPtr<const Client::GraphModel> graph() const { return _graph; } - SharedPtr<GraphView> view() const { return _view; } + SPtr<const Client::GraphModel> graph() const { return _graph; } + SPtr<GraphView> view() const { return _view; } void show_port_status(const Client::PortModel* model, const Raul::Atom& value); - void set_graph_from_path(const Raul::Path& path, SharedPtr<GraphView> view); + void set_graph_from_path(const Raul::Path& path, SPtr<GraphView> view); void object_entered(const Client::ObjectModel* model); void object_left(const Client::ObjectModel* model); private: - void graph_port_added(SharedPtr<const Client::PortModel> port); - void graph_port_removed(SharedPtr<const Client::PortModel> port); + void graph_port_added(SPtr<const Client::PortModel> port); + void graph_port_removed(SPtr<const Client::PortModel> port); void show_status(const Client::ObjectModel* model); int message_dialog(const Glib::ustring& message, @@ -124,10 +124,10 @@ private: void event_show_engine(); void event_clipboard_changed(GdkEventOwnerChange* ev); - App* _app; - SharedPtr<const Client::GraphModel> _graph; - SharedPtr<GraphView> _view; - GraphWindow* _window; + App* _app; + SPtr<const Client::GraphModel> _graph; + SPtr<GraphView> _view; + GraphWindow* _window; sigc::connection new_port_connection; sigc::connection removed_port_connection; diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 371f7444..3d742e1d 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -59,10 +59,10 @@ using namespace Client; namespace GUI { -GraphCanvas::GraphCanvas(App& app, - SharedPtr<const GraphModel> graph, - int width, - int height) +GraphCanvas::GraphCanvas(App& app, + SPtr<const GraphModel> graph, + int width, + int height) : Canvas(width, height) , _app(app) , _graph(graph) @@ -207,7 +207,7 @@ GraphCanvas::build_menus() } // Add known plugins to menu heirarchy - SharedPtr<const ClientStore::Plugins> plugins = _app.store()->plugins(); + SPtr<const ClientStore::Plugins> plugins = _app.store()->plugins(); for (const auto& p : *plugins.get()) add_plugin(p.second); } @@ -306,7 +306,7 @@ GraphCanvas::build() // Create modules for blocks for (Store::const_iterator i = kids.first; i != kids.second; ++i) { - SharedPtr<BlockModel> block = PtrCast<BlockModel>(i->second); + SPtr<BlockModel> block = dynamic_ptr_cast<BlockModel>(i->second); if (block && block->parent() == _graph) add_block(block); } @@ -318,7 +318,7 @@ GraphCanvas::build() // Create arcs for (const auto& a : _graph->arcs()) { - connection(PtrCast<ArcModel>(a.second)); + connection(dynamic_ptr_cast<ArcModel>(a.second)); } } @@ -352,7 +352,7 @@ GraphCanvas::show_port_names(bool b) } void -GraphCanvas::add_plugin(SharedPtr<PluginModel> p) +GraphCanvas::add_plugin(SPtr<PluginModel> p) { typedef ClassMenus::iterator iterator; if (_internal_menu && p->type() == Plugin::Internal) { @@ -406,10 +406,10 @@ GraphCanvas::add_plugin(SharedPtr<PluginModel> p) } void -GraphCanvas::add_block(SharedPtr<const BlockModel> bm) +GraphCanvas::add_block(SPtr<const BlockModel> bm) { - SharedPtr<const GraphModel> pm = PtrCast<const GraphModel>(bm); - NodeModule* module; + SPtr<const GraphModel> pm = dynamic_ptr_cast<const GraphModel>(bm); + NodeModule* module; if (pm) { module = SubgraphModule::create(*this, pm, _human_names); } else { @@ -427,7 +427,7 @@ GraphCanvas::add_block(SharedPtr<const BlockModel> bm) } void -GraphCanvas::remove_block(SharedPtr<const BlockModel> bm) +GraphCanvas::remove_block(SPtr<const BlockModel> bm) { Views::iterator i = _views.find(bm); @@ -442,7 +442,7 @@ GraphCanvas::remove_block(SharedPtr<const BlockModel> bm) } void -GraphCanvas::add_port(SharedPtr<const PortModel> pm) +GraphCanvas::add_port(SPtr<const PortModel> pm) { GraphPortModule* view = GraphPortModule::create(*this, pm, _human_names); _views.insert(std::make_pair(pm, view)); @@ -450,7 +450,7 @@ GraphCanvas::add_port(SharedPtr<const PortModel> pm) } void -GraphCanvas::remove_port(SharedPtr<const PortModel> pm) +GraphCanvas::remove_port(SPtr<const PortModel> pm) { Views::iterator i = _views.find(pm); @@ -468,7 +468,7 @@ GraphCanvas::remove_port(SharedPtr<const PortModel> pm) } Ganv::Port* -GraphCanvas::get_port_view(SharedPtr<PortModel> port) +GraphCanvas::get_port_view(SPtr<PortModel> port) { Ganv::Module* module = _views[port]; @@ -493,7 +493,7 @@ GraphCanvas::get_port_view(SharedPtr<PortModel> port) } void -GraphCanvas::connection(SharedPtr<const ArcModel> arc) +GraphCanvas::connection(SPtr<const ArcModel> arc) { Ganv::Port* const tail = get_port_view(arc->tail()); Ganv::Port* const head = get_port_view(arc->head()); @@ -507,7 +507,7 @@ GraphCanvas::connection(SharedPtr<const ArcModel> arc) } void -GraphCanvas::disconnection(SharedPtr<const ArcModel> arc) +GraphCanvas::disconnection(SPtr<const ArcModel> arc) { Ganv::Port* const src = get_port_view(arc->tail()); Ganv::Port* const dst = get_port_view(arc->head()); @@ -713,7 +713,7 @@ void GraphCanvas::paste() { Glib::ustring str = Gtk::Clipboard::get()->wait_for_text(); - SharedPtr<Serialisation::Parser> parser = _app.loader()->parser(); + SPtr<Serialisation::Parser> parser = _app.loader()->parser(); if (!parser) { _app.log().error("Unable to load parser, paste unavailable\n"); return; @@ -782,7 +782,8 @@ GraphCanvas::paste() _pastees.insert(c.first); } - builder.connect(PtrCast<const GraphModel>(clipboard.object(_graph->path()))); + builder.connect( + dynamic_ptr_cast<const GraphModel>(clipboard.object(_graph->path()))); } void @@ -837,9 +838,9 @@ GraphCanvas::menu_add_port(const string& sym_base, const string& name_base, } void -GraphCanvas::load_plugin(WeakPtr<PluginModel> weak_plugin) +GraphCanvas::load_plugin(WPtr<PluginModel> weak_plugin) { - SharedPtr<PluginModel> plugin = weak_plugin.lock(); + SPtr<PluginModel> plugin = weak_plugin.lock(); if (!plugin) return; diff --git a/src/gui/GraphCanvas.hpp b/src/gui/GraphCanvas.hpp index 6d4bbc87..77498748 100644 --- a/src/gui/GraphCanvas.hpp +++ b/src/gui/GraphCanvas.hpp @@ -27,12 +27,12 @@ #include "ganv/Canvas.hpp" #include "ganv/Module.hpp" -#include "raul/SharedPtr.hpp" +#include "ingen/Node.hpp" +#include "ingen/client/ArcModel.hpp" +#include "ingen/types.hpp" #include "raul/Path.hpp" #include "NodeModule.hpp" -#include "ingen/Node.hpp" -#include "ingen/client/ArcModel.hpp" namespace Ingen { @@ -49,10 +49,10 @@ class NodeModule; class GraphCanvas : public Ganv::Canvas { public: - GraphCanvas(App& app, - SharedPtr<const Client::GraphModel> graph, - int width, - int height); + GraphCanvas(App& app, + SPtr<const Client::GraphModel> graph, + int width, + int height); virtual ~GraphCanvas() {} @@ -63,13 +63,13 @@ public: void show_port_names(bool show); bool show_port_names() const { return _show_port_names; } - void add_plugin(SharedPtr<Client::PluginModel> pm); - void add_block(SharedPtr<const Client::BlockModel> bm); - void remove_block(SharedPtr<const Client::BlockModel> bm); - void add_port(SharedPtr<const Client::PortModel> pm); - void remove_port(SharedPtr<const Client::PortModel> pm); - void connection(SharedPtr<const Client::ArcModel> am); - void disconnection(SharedPtr<const Client::ArcModel> am); + void add_plugin(SPtr<Client::PluginModel> pm); + void add_block(SPtr<const Client::BlockModel> bm); + void remove_block(SPtr<const Client::BlockModel> bm); + void add_port(SPtr<const Client::PortModel> pm); + void remove_port(SPtr<const Client::PortModel> pm); + void connection(SPtr<const Client::ArcModel> am); + void disconnection(SPtr<const Client::ArcModel> am); void get_new_module_location(double& x, double& y); @@ -96,7 +96,7 @@ private: void menu_new_graph(); void menu_load_graph(); void menu_properties(); - void load_plugin(WeakPtr<Client::PluginModel> plugin); + void load_plugin(WPtr<Client::PluginModel> plugin); void build_menus(); @@ -116,7 +116,7 @@ private: Node::Properties get_initial_data(Resource::Graph ctx=Resource::Graph::DEFAULT); - Ganv::Port* get_port_view(SharedPtr<Client::PortModel> port); + Ganv::Port* get_port_view(SPtr<Client::PortModel> port); void connect(Ganv::Node* src, Ganv::Node* dst); @@ -124,10 +124,10 @@ private: void disconnect(Ganv::Node* src, Ganv::Node* dst); - App& _app; - SharedPtr<const Client::GraphModel> _graph; + App& _app; + SPtr<const Client::GraphModel> _graph; - typedef std::map<SharedPtr<const Client::ObjectModel>, Ganv::Module*> Views; + typedef std::map<SPtr<const Client::ObjectModel>, Ganv::Module*> Views; Views _views; int _auto_position_count; diff --git a/src/gui/GraphPortModule.cpp b/src/gui/GraphPortModule.cpp index d495cbe4..402da865 100644 --- a/src/gui/GraphPortModule.cpp +++ b/src/gui/GraphPortModule.cpp @@ -42,14 +42,14 @@ using namespace Client; namespace GUI { -GraphPortModule::GraphPortModule(GraphCanvas& canvas, - SharedPtr<const Client::PortModel> model) +GraphPortModule::GraphPortModule(GraphCanvas& canvas, + SPtr<const Client::PortModel> model) : Ganv::Module(canvas, "", 0, 0, false) // FIXME: coords? , _model(model) { assert(model); - assert(PtrCast<const GraphModel>(model->parent())); + assert(dynamic_ptr_cast<const GraphModel>(model->parent())); set_stacked(model->polyphonic()); @@ -61,9 +61,9 @@ GraphPortModule::GraphPortModule(GraphCanvas& canvas, } GraphPortModule* -GraphPortModule::create(GraphCanvas& canvas, - SharedPtr<const PortModel> model, - bool human) +GraphPortModule::create(GraphCanvas& canvas, + SPtr<const PortModel> model, + bool human) { GraphPortModule* ret = new GraphPortModule(canvas, model); Port* port = Port::create(canvas.app(), *ret, model, human, true); diff --git a/src/gui/GraphPortModule.hpp b/src/gui/GraphPortModule.hpp index 722f35c3..9f2c96fd 100644 --- a/src/gui/GraphPortModule.hpp +++ b/src/gui/GraphPortModule.hpp @@ -49,9 +49,9 @@ class GraphPortModule : public Ganv::Module { public: static GraphPortModule* create( - GraphCanvas& canvas, - SharedPtr<const Client::PortModel> model, - bool human); + GraphCanvas& canvas, + SPtr<const Client::PortModel> model, + bool human); App& app() const; @@ -60,11 +60,11 @@ public: void set_name(const std::string& n); - SharedPtr<const Client::PortModel> port() const { return _model; } + SPtr<const Client::PortModel> port() const { return _model; } protected: - GraphPortModule(GraphCanvas& canvas, - SharedPtr<const Client::PortModel> model); + GraphPortModule(GraphCanvas& canvas, + SPtr<const Client::PortModel> model); bool show_menu(GdkEventButton* ev); void set_selected(gboolean b); @@ -73,8 +73,8 @@ protected: void property_changed(const Raul::URI& predicate, const Raul::Atom& value); - SharedPtr<const Client::PortModel> _model; - Port* _port; + SPtr<const Client::PortModel> _model; + Port* _port; }; } // namespace GUI diff --git a/src/gui/GraphTreeWindow.cpp b/src/gui/GraphTreeWindow.cpp index 7ddbb23a..ff38e707 100644 --- a/src/gui/GraphTreeWindow.cpp +++ b/src/gui/GraphTreeWindow.cpp @@ -75,15 +75,15 @@ GraphTreeWindow::init(App& app, ClientStore& store) } void -GraphTreeWindow::new_object(SharedPtr<ObjectModel> object) +GraphTreeWindow::new_object(SPtr<ObjectModel> object) { - SharedPtr<GraphModel> graph = PtrCast<GraphModel>(object); + SPtr<GraphModel> graph = dynamic_ptr_cast<GraphModel>(object); if (graph) add_graph(graph); } void -GraphTreeWindow::add_graph(SharedPtr<GraphModel> pm) +GraphTreeWindow::add_graph(SPtr<GraphModel> pm) { if (!pm->parent()) { Gtk::TreeModel::iterator iter = _graph_treestore->append(); @@ -124,7 +124,7 @@ GraphTreeWindow::add_graph(SharedPtr<GraphModel> pm) } void -GraphTreeWindow::remove_graph(SharedPtr<GraphModel> pm) +GraphTreeWindow::remove_graph(SPtr<GraphModel> pm) { Gtk::TreeModel::iterator i = find_graph(_graph_treestore->children(), pm); if (i != _graph_treestore->children().end()) @@ -132,12 +132,11 @@ GraphTreeWindow::remove_graph(SharedPtr<GraphModel> pm) } Gtk::TreeModel::iterator -GraphTreeWindow::find_graph( - Gtk::TreeModel::Children root, - SharedPtr<Client::ObjectModel> graph) +GraphTreeWindow::find_graph(Gtk::TreeModel::Children root, + SPtr<Client::ObjectModel> graph) { for (Gtk::TreeModel::iterator c = root.begin(); c != root.end(); ++c) { - SharedPtr<GraphModel> pm = (*c)[_graph_tree_columns.graph_model_col]; + SPtr<GraphModel> pm = (*c)[_graph_tree_columns.graph_model_col]; if (graph == pm) { return c; } else if ((*c)->children().size() > 0) { @@ -157,7 +156,7 @@ GraphTreeWindow::show_graph_menu(GdkEventButton* ev) Gtk::TreeModel::iterator active = _graph_tree_selection->get_selected(); if (active) { Gtk::TreeModel::Row row = *active; - SharedPtr<GraphModel> pm = row[_graph_tree_columns.graph_model_col]; + SPtr<GraphModel> pm = row[_graph_tree_columns.graph_model_col]; if (pm) { _app->log().warn("TODO: graph menu from tree window"); } @@ -165,11 +164,12 @@ GraphTreeWindow::show_graph_menu(GdkEventButton* ev) } void -GraphTreeWindow::event_graph_activated(const Gtk::TreeModel::Path& path, Gtk::TreeView::Column* col) +GraphTreeWindow::event_graph_activated(const Gtk::TreeModel::Path& path, + Gtk::TreeView::Column* col) { Gtk::TreeModel::iterator active = _graph_treestore->get_iter(path); Gtk::TreeModel::Row row = *active; - SharedPtr<GraphModel> pm = row[_graph_tree_columns.graph_model_col]; + SPtr<GraphModel> pm = row[_graph_tree_columns.graph_model_col]; _app->window_factory()->present_graph(pm); } @@ -181,7 +181,7 @@ GraphTreeWindow::event_graph_enabled_toggled(const Glib::ustring& path_str) Gtk::TreeModel::iterator active = _graph_treestore->get_iter(path); Gtk::TreeModel::Row row = *active; - SharedPtr<GraphModel> pm = row[_graph_tree_columns.graph_model_col]; + SPtr<GraphModel> pm = row[_graph_tree_columns.graph_model_col]; assert(pm); if (_enable_signal) @@ -192,9 +192,9 @@ GraphTreeWindow::event_graph_enabled_toggled(const Glib::ustring& path_str) } void -GraphTreeWindow::graph_property_changed(const Raul::URI& key, - const Raul::Atom& value, - SharedPtr<GraphModel> graph) +GraphTreeWindow::graph_property_changed(const Raul::URI& key, + const Raul::Atom& value, + SPtr<GraphModel> graph) { const URIs& uris = _app->uris(); _enable_signal = false; @@ -212,7 +212,7 @@ GraphTreeWindow::graph_property_changed(const Raul::URI& key, } void -GraphTreeWindow::graph_moved(SharedPtr<GraphModel> graph) +GraphTreeWindow::graph_moved(SPtr<GraphModel> graph) { _enable_signal = false; diff --git a/src/gui/GraphTreeWindow.hpp b/src/gui/GraphTreeWindow.hpp index 3bd50b76..eec8b0d8 100644 --- a/src/gui/GraphTreeWindow.hpp +++ b/src/gui/GraphTreeWindow.hpp @@ -47,16 +47,16 @@ public: void init(App& app, Client::ClientStore& store); - void new_object(SharedPtr<Client::ObjectModel> object); + void new_object(SPtr<Client::ObjectModel> object); - void graph_property_changed(const Raul::URI& key, - const Raul::Atom& value, - SharedPtr<Client::GraphModel> gm); + void graph_property_changed(const Raul::URI& key, + const Raul::Atom& value, + SPtr<Client::GraphModel> gm); - void graph_moved(SharedPtr<Client::GraphModel> graph); + void graph_moved(SPtr<Client::GraphModel> graph); - void add_graph(SharedPtr<Client::GraphModel> gm); - void remove_graph(SharedPtr<Client::GraphModel> gm); + void add_graph(SPtr<Client::GraphModel> gm); + void remove_graph(SPtr<Client::GraphModel> gm); void show_graph_menu(GdkEventButton* ev); protected: @@ -66,8 +66,8 @@ protected: void event_graph_enabled_toggled(const Glib::ustring& path_str); Gtk::TreeModel::iterator find_graph( - Gtk::TreeModel::Children root, - SharedPtr<Client::ObjectModel> graph); + Gtk::TreeModel::Children root, + SPtr<Client::ObjectModel> graph); GraphTreeView* _graphs_treeview; @@ -79,9 +79,9 @@ protected: add(graph_model_col); } - Gtk::TreeModelColumn<Glib::ustring> name_col; - Gtk::TreeModelColumn<bool> enabled_col; - Gtk::TreeModelColumn<SharedPtr<Client::GraphModel> > graph_model_col; + Gtk::TreeModelColumn<Glib::ustring> name_col; + Gtk::TreeModelColumn<bool> enabled_col; + Gtk::TreeModelColumn<SPtr<Client::GraphModel> > graph_model_col; }; App* _app; diff --git a/src/gui/GraphView.cpp b/src/gui/GraphView.cpp index c795861d..8452e9cf 100644 --- a/src/gui/GraphView.cpp +++ b/src/gui/GraphView.cpp @@ -67,14 +67,14 @@ GraphView::init(App& app) } void -GraphView::set_graph(SharedPtr<const GraphModel> graph) +GraphView::set_graph(SPtr<const GraphModel> graph) { assert(!_canvas); // FIXME: remove assert(_breadcrumb_container); // ensure created _graph = graph; - _canvas = SharedPtr<GraphCanvas>(new GraphCanvas(*_app, graph, 1600*2, 1200*2)); + _canvas = SPtr<GraphCanvas>(new GraphCanvas(*_app, graph, 1600*2, 1200*2)); _canvas->build(); _canvas_scrolledwindow->add(_canvas->widget()); @@ -116,15 +116,15 @@ GraphView::set_graph(SharedPtr<const GraphModel> graph) _canvas->widget().grab_focus(); } -SharedPtr<GraphView> -GraphView::create(App& app, SharedPtr<const GraphModel> graph) +SPtr<GraphView> +GraphView::create(App& app, SPtr<const GraphModel> graph) { GraphView* result = NULL; Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("warehouse_win"); xml->get_widget_derived("graph_view_box", result); result->init(app); result->set_graph(graph); - return SharedPtr<GraphView>(result); + return SPtr<GraphView>(result); } #if 0 diff --git a/src/gui/GraphView.hpp b/src/gui/GraphView.hpp index cae073af..c060d02e 100644 --- a/src/gui/GraphView.hpp +++ b/src/gui/GraphView.hpp @@ -26,7 +26,7 @@ #include <gtkmm/toolitem.h> #include <gtkmm/toolitem.h> -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" #include "raul/URI.hpp" namespace Raul { class Atom; } @@ -61,18 +61,18 @@ public: void init(App& app); - SharedPtr<GraphCanvas> canvas() const { return _canvas; } - SharedPtr<const Client::GraphModel> graph() const { return _graph; } - Gtk::ToolItem* breadcrumb_container() const { return _breadcrumb_container; } + SPtr<GraphCanvas> canvas() const { return _canvas; } + SPtr<const Client::GraphModel> graph() const { return _graph; } + Gtk::ToolItem* breadcrumb_container() const { return _breadcrumb_container; } - static SharedPtr<GraphView> create(App& app, - SharedPtr<const Client::GraphModel> graph); + static SPtr<GraphView> create(App& app, + SPtr<const Client::GraphModel> graph); sigc::signal<void, const Client::ObjectModel*> signal_object_entered; sigc::signal<void, const Client::ObjectModel*> signal_object_left; private: - void set_graph(SharedPtr<const Client::GraphModel> graph); + void set_graph(SPtr<const Client::GraphModel> graph); void process_toggled(); void poly_changed(); @@ -90,8 +90,8 @@ private: App* _app; - SharedPtr<const Client::GraphModel> _graph; - SharedPtr<GraphCanvas> _canvas; + SPtr<const Client::GraphModel> _graph; + SPtr<GraphCanvas> _canvas; Gtk::ScrolledWindow* _canvas_scrolledwindow; Gtk::Toolbar* _toolbar; diff --git a/src/gui/GraphWindow.hpp b/src/gui/GraphWindow.hpp index a45177ce..bbb25a27 100644 --- a/src/gui/GraphWindow.hpp +++ b/src/gui/GraphWindow.hpp @@ -21,7 +21,7 @@ #include <gtkmm/builder.h> -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" #include "GraphBox.hpp" #include "Window.hpp" @@ -48,8 +48,8 @@ public: void init_window(App& app); - SharedPtr<const Client::GraphModel> graph() const { return _box->graph(); } - GraphBox* box() const { return _box; } + SPtr<const Client::GraphModel> graph() const { return _box->graph(); } + GraphBox* box() const { return _box; } bool documentation_is_visible() { return _box->documentation_is_visible(); } diff --git a/src/gui/LoadGraphWindow.cpp b/src/gui/LoadGraphWindow.cpp index c7e94a0e..1229dd25 100644 --- a/src/gui/LoadGraphWindow.cpp +++ b/src/gui/LoadGraphWindow.cpp @@ -95,9 +95,9 @@ LoadGraphWindow::LoadGraphWindow(BaseObjectType* cobject, } void -LoadGraphWindow::present(SharedPtr<const GraphModel> graph, - bool import, - Node::Properties data) +LoadGraphWindow::present(SPtr<const GraphModel> graph, + bool import, + Node::Properties data) { _import = import; set_graph(graph); @@ -115,7 +115,7 @@ LoadGraphWindow::present(SharedPtr<const GraphModel> graph, * This function MUST be called before using the window in any way! */ void -LoadGraphWindow::set_graph(SharedPtr<const GraphModel> graph) +LoadGraphWindow::set_graph(SPtr<const GraphModel> graph) { _graph = graph; _symbol_entry->set_text(""); diff --git a/src/gui/LoadGraphWindow.hpp b/src/gui/LoadGraphWindow.hpp index 64ebe99b..a6fa84c8 100644 --- a/src/gui/LoadGraphWindow.hpp +++ b/src/gui/LoadGraphWindow.hpp @@ -25,9 +25,8 @@ #include <gtkmm/radiobutton.h> #include <gtkmm/spinbutton.h> -#include "raul/SharedPtr.hpp" - #include "ingen/Node.hpp" +#include "ingen/types.hpp" namespace Ingen { @@ -49,11 +48,11 @@ public: void init(App& app) { _app = &app; } - void set_graph(SharedPtr<const Client::GraphModel> graph); + void set_graph(SPtr<const Client::GraphModel> graph); - void present(SharedPtr<const Client::GraphModel> graph, - bool import, - Node::Properties data); + void present(SPtr<const Client::GraphModel> graph, + bool import, + Node::Properties data); protected: void on_show(); @@ -73,7 +72,7 @@ private: Node::Properties _initial_data; - SharedPtr<const Client::GraphModel> _graph; + SPtr<const Client::GraphModel> _graph; Gtk::Label* _symbol_label; Gtk::Entry* _symbol_entry; diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index 7e61d48d..7b1ac5c7 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -129,8 +129,8 @@ LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, } void -LoadPluginWindow::present(SharedPtr<const GraphModel> graph, - Node::Properties data) +LoadPluginWindow::present(SPtr<const GraphModel> graph, + Node::Properties data) { set_graph(graph); _initial_data = data; @@ -170,7 +170,7 @@ LoadPluginWindow::name_cleared(Gtk::EntryIconPosition pos, const GdkEventButton* * This function MUST be called before using the window in any way! */ void -LoadPluginWindow::set_graph(SharedPtr<const GraphModel> graph) +LoadPluginWindow::set_graph(SPtr<const GraphModel> graph) { if (_graph) { _graph = graph; @@ -205,7 +205,7 @@ LoadPluginWindow::on_show() } void -LoadPluginWindow::set_plugins(SharedPtr<const ClientStore::Plugins> plugins) +LoadPluginWindow::set_plugins(SPtr<const ClientStore::Plugins> plugins) { _rows.clear(); _plugins_liststore->clear(); @@ -219,7 +219,7 @@ LoadPluginWindow::set_plugins(SharedPtr<const ClientStore::Plugins> plugins) } void -LoadPluginWindow::new_plugin(SharedPtr<const PluginModel> pm) +LoadPluginWindow::new_plugin(SPtr<const PluginModel> pm) { if (is_visible()) add_plugin(pm); @@ -228,7 +228,7 @@ LoadPluginWindow::new_plugin(SharedPtr<const PluginModel> pm) } static std::string -get_project_name(SharedPtr<const PluginModel> plugin) +get_project_name(SPtr<const PluginModel> plugin) { std::string name; if (plugin->lilv_plugin()) { @@ -254,7 +254,7 @@ get_project_name(SharedPtr<const PluginModel> plugin) } static std::string -get_author_name(SharedPtr<const PluginModel> plugin) +get_author_name(SPtr<const PluginModel> plugin) { std::string name; if (plugin->lilv_plugin()) { @@ -269,7 +269,7 @@ get_author_name(SharedPtr<const PluginModel> plugin) void LoadPluginWindow::set_row(Gtk::TreeModel::Row& row, - SharedPtr<const PluginModel> plugin) + SPtr<const PluginModel> plugin) { const URIs& uris = _app->uris(); const Raul::Atom& name = plugin->get_property(uris.doap_name); @@ -303,7 +303,7 @@ LoadPluginWindow::set_row(Gtk::TreeModel::Row& row, } void -LoadPluginWindow::add_plugin(SharedPtr<const PluginModel> plugin) +LoadPluginWindow::add_plugin(SPtr<const PluginModel> plugin) { if (plugin->lilv_plugin() && lilv_plugin_is_replaced(plugin->lilv_plugin())) { return; @@ -342,7 +342,7 @@ LoadPluginWindow::plugin_selection_changed() *_selection->get_selected_rows().begin()); if (iter) { Gtk::TreeModel::Row row = *iter; - boost::shared_ptr<const PluginModel> p = row.get_value( + SPtr<const PluginModel> p = row.get_value( _plugins_columns._col_plugin); _name_offset = _app->store()->child_name_offset( _graph->path(), p->default_block_symbol()); @@ -366,8 +366,8 @@ LoadPluginWindow::plugin_selection_changed() * sends the notification back. */ string -LoadPluginWindow::generate_module_name(SharedPtr<const PluginModel> plugin, - int offset) +LoadPluginWindow::generate_module_name(SPtr<const PluginModel> plugin, + int offset) { std::stringstream ss; ss << plugin->default_block_symbol(); @@ -379,11 +379,11 @@ LoadPluginWindow::generate_module_name(SharedPtr<const PluginModel> plugin, void LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter) { - const URIs& uris = _app->uris(); - Gtk::TreeModel::Row row = *iter; - SharedPtr<const PluginModel> plugin = row.get_value(_plugins_columns._col_plugin); - bool polyphonic = _polyphonic_checkbutton->get_active(); - string name = _name_entry->get_text(); + const URIs& uris = _app->uris(); + Gtk::TreeModel::Row row = *iter; + SPtr<const PluginModel> plugin = row.get_value(_plugins_columns._col_plugin); + bool polyphonic = _polyphonic_checkbutton->get_active(); + string name = _name_entry->get_text(); if (name.empty()) name = generate_module_name(plugin, _name_offset); @@ -446,7 +446,7 @@ LoadPluginWindow::filter_changed() const URIs& uris = _app->uris(); for (const auto& p : *_app->store()->plugins().get()) { - const SharedPtr<PluginModel> plugin = p.second; + const SPtr<PluginModel> plugin = p.second; const Raul::Atom& name = plugin->get_property(uris.doap_name); switch (criteria) { diff --git a/src/gui/LoadPluginWindow.hpp b/src/gui/LoadPluginWindow.hpp index ed2e979c..5c8fad19 100644 --- a/src/gui/LoadPluginWindow.hpp +++ b/src/gui/LoadPluginWindow.hpp @@ -26,10 +26,9 @@ #include <gtkmm/treemodel.h> #include <gtkmm/treeview.h> -#include "raul/SharedPtr.hpp" - #include "ingen/Node.hpp" #include "ingen/client/ClientStore.hpp" +#include "ingen/types.hpp" #include "ingen_config.h" #include "Window.hpp" @@ -55,13 +54,13 @@ public: LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml); - void set_graph(SharedPtr<const Client::GraphModel> graph); - void set_plugins(SharedPtr<const Client::ClientStore::Plugins> plugins); + void set_graph(SPtr<const Client::GraphModel> graph); + void set_plugins(SPtr<const Client::ClientStore::Plugins> plugins); - void add_plugin(SharedPtr<const Client::PluginModel> plugin); + void add_plugin(SPtr<const Client::PluginModel> plugin); - void present(SharedPtr<const Client::GraphModel> graph, - Node::Properties data); + void present(SPtr<const Client::GraphModel> graph, + Node::Properties data); protected: void on_show(); @@ -87,7 +86,7 @@ private: Gtk::TreeModelColumn<Glib::ustring> _col_uri; // Not displayed: - Gtk::TreeModelColumn< SharedPtr<const Client::PluginModel> > _col_plugin; + Gtk::TreeModelColumn< SPtr<const Client::PluginModel> > _col_plugin; }; /** Column for the filter criteria combo box. */ @@ -112,8 +111,10 @@ private: void name_cleared(Gtk::EntryIconPosition pos, const GdkEventButton* event); #endif - void set_row(Gtk::TreeModel::Row& row, SharedPtr<const Client::PluginModel> plugin); - void new_plugin(SharedPtr<const Client::PluginModel> plugin); + void set_row(Gtk::TreeModel::Row& row, + SPtr<const Client::PluginModel> plugin); + + void new_plugin(SPtr<const Client::PluginModel> plugin); void plugin_property_changed(const Raul::URI& plugin, const Raul::URI& predicate, @@ -122,15 +123,14 @@ private: void plugin_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* col); void plugin_selection_changed(); - std::string generate_module_name( - SharedPtr<const Client::PluginModel> plugin, - int offset=0); + std::string generate_module_name(SPtr<const Client::PluginModel> plugin, + int offset=0); void load_plugin(const Gtk::TreeModel::iterator& iter); Node::Properties _initial_data; - SharedPtr<const Client::GraphModel> _graph; + SPtr<const Client::GraphModel> _graph; typedef std::map<Raul::URI, Gtk::TreeModel::iterator> Rows; Rows _rows; diff --git a/src/gui/NewSubgraphWindow.cpp b/src/gui/NewSubgraphWindow.cpp index f2457843..b17cc100 100644 --- a/src/gui/NewSubgraphWindow.cpp +++ b/src/gui/NewSubgraphWindow.cpp @@ -49,8 +49,8 @@ NewSubgraphWindow::NewSubgraphWindow(BaseObjectType* cobject, } void -NewSubgraphWindow::present(SharedPtr<const Client::GraphModel> graph, - Node::Properties data) +NewSubgraphWindow::present(SPtr<const Client::GraphModel> graph, + Node::Properties data) { set_graph(graph); _initial_data = data; @@ -62,7 +62,7 @@ NewSubgraphWindow::present(SharedPtr<const Client::GraphModel> graph, * This function MUST be called before using the window in any way! */ void -NewSubgraphWindow::set_graph(SharedPtr<const Client::GraphModel> graph) +NewSubgraphWindow::set_graph(SPtr<const Client::GraphModel> graph) { _graph = graph; } diff --git a/src/gui/NewSubgraphWindow.hpp b/src/gui/NewSubgraphWindow.hpp index 4fef4831..7f3c855b 100644 --- a/src/gui/NewSubgraphWindow.hpp +++ b/src/gui/NewSubgraphWindow.hpp @@ -23,9 +23,8 @@ #include <gtkmm/label.h> #include <gtkmm/spinbutton.h> -#include "raul/SharedPtr.hpp" - #include "ingen/Node.hpp" +#include "ingen/types.hpp" #include "Window.hpp" @@ -47,18 +46,18 @@ public: NewSubgraphWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml); - void set_graph(SharedPtr<const Client::GraphModel> graph); + void set_graph(SPtr<const Client::GraphModel> graph); - void present(SharedPtr<const Client::GraphModel> graph, - Node::Properties data); + void present(SPtr<const Client::GraphModel> graph, + Node::Properties data); private: void name_changed(); void ok_clicked(); void cancel_clicked(); - Node::Properties _initial_data; - SharedPtr<const Client::GraphModel> _graph; + Node::Properties _initial_data; + SPtr<const Client::GraphModel> _graph; Gtk::Entry* _name_entry; Gtk::Label* _message_label; diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp index 548aa68a..9fe43562 100644 --- a/src/gui/NodeMenu.cpp +++ b/src/gui/NodeMenu.cpp @@ -49,7 +49,7 @@ NodeMenu::NodeMenu(BaseObjectType* cobject, } void -NodeMenu::init(App& app, SharedPtr<const Client::BlockModel> block) +NodeMenu::init(App& app, SPtr<const Client::BlockModel> block) { ObjectMenu::init(app, block); diff --git a/src/gui/NodeMenu.hpp b/src/gui/NodeMenu.hpp index b307b9a4..969afecf 100644 --- a/src/gui/NodeMenu.hpp +++ b/src/gui/NodeMenu.hpp @@ -25,7 +25,7 @@ #include "ObjectMenu.hpp" #include "ingen/client/BlockModel.hpp" -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" namespace Ingen { namespace GUI { @@ -40,7 +40,7 @@ public: NodeMenu(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml); - void init(App& app, SharedPtr<const Client::BlockModel> block); + void init(App& app, SPtr<const Client::BlockModel> block); bool has_control_inputs(); diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 46588e6e..77ec41ca 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -51,8 +51,8 @@ using namespace Client; namespace GUI { -NodeModule::NodeModule(GraphCanvas& canvas, - SharedPtr<const BlockModel> block) +NodeModule::NodeModule(GraphCanvas& canvas, + SPtr<const BlockModel> block) : Ganv::Module(canvas, block->path().symbol(), 0, 0, true) , _block(block) , _gui_widget(NULL) @@ -103,11 +103,11 @@ NodeModule::show_menu(GdkEventButton* ev) } NodeModule* -NodeModule::create(GraphCanvas& canvas, - SharedPtr<const BlockModel> block, - bool human) +NodeModule::create(GraphCanvas& canvas, + SPtr<const BlockModel> block, + bool human) { - SharedPtr<const GraphModel> graph = PtrCast<const GraphModel>(block); + SPtr<const GraphModel> graph = dynamic_ptr_cast<const GraphModel>(block); NodeModule* ret = (graph) ? new SubgraphModule(canvas, graph) @@ -262,7 +262,7 @@ NodeModule::rename() } void -NodeModule::new_port_view(SharedPtr<const PortModel> port) +NodeModule::new_port_view(SPtr<const PortModel> port) { Port::create(app(), *this, port, app().world()->conf().option("human-names").get_bool()); @@ -277,7 +277,7 @@ NodeModule::new_port_view(SharedPtr<const PortModel> port) } Port* -NodeModule::port(boost::shared_ptr<const PortModel> model) +NodeModule::port(SPtr<const PortModel> model) { for (iterator p = begin(); p != end(); ++p) { Port* const port = dynamic_cast<Port*>(*p); @@ -288,7 +288,7 @@ NodeModule::port(boost::shared_ptr<const PortModel> model) } void -NodeModule::delete_port_view(SharedPtr<const PortModel> model) +NodeModule::delete_port_view(SPtr<const PortModel> model) { Port* p = port(model); if (p) { diff --git a/src/gui/NodeModule.hpp b/src/gui/NodeModule.hpp index 3dc7e93e..f1521c5f 100644 --- a/src/gui/NodeModule.hpp +++ b/src/gui/NodeModule.hpp @@ -18,7 +18,7 @@ #define INGEN_GUI_NODEMODULE_HPP #include "ganv/Module.hpp" -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" #include "Port.hpp" @@ -47,25 +47,25 @@ class NodeModule : public Ganv::Module { public: static NodeModule* create( - GraphCanvas& canvas, - SharedPtr<const Client::BlockModel> block, - bool human_names); + GraphCanvas& canvas, + SPtr<const Client::BlockModel> block, + bool human_names); virtual ~NodeModule(); App& app() const; - Port* port(boost::shared_ptr<const Client::PortModel> model); + Port* port(SPtr<const Client::PortModel> model); - void delete_port_view(SharedPtr<const Client::PortModel> port); + void delete_port_view(SPtr<const Client::PortModel> port); virtual void store_location(double x, double y); void show_human_names(bool b); - SharedPtr<const Client::BlockModel> block() const { return _block; } + SPtr<const Client::BlockModel> block() const { return _block; } protected: - NodeModule(GraphCanvas& canvas, SharedPtr<const Client::BlockModel> block); + NodeModule(GraphCanvas& canvas, SPtr<const Client::BlockModel> block); virtual bool on_double_click(GdkEventButton* ev); @@ -80,7 +80,7 @@ protected: void rename(); void property_changed(const Raul::URI& predicate, const Raul::Atom& value); - void new_port_view(SharedPtr<const Client::PortModel> port); + void new_port_view(SPtr<const Client::PortModel> port); void value_changed(uint32_t index, const Raul::Atom& value); void port_activity(uint32_t index, const Raul::Atom& value); @@ -89,11 +89,11 @@ protected: bool show_menu(GdkEventButton* ev); - SharedPtr<const Client::BlockModel> _block; - NodeMenu* _menu; - SharedPtr<Client::PluginUI> _plugin_ui; - Gtk::Widget* _gui_widget; - Gtk::Window* _gui_window; ///< iff popped up + SPtr<const Client::BlockModel> _block; + NodeMenu* _menu; + SPtr<Client::PluginUI> _plugin_ui; + Gtk::Widget* _gui_widget; + Gtk::Window* _gui_window; ///< iff popped up }; } // namespace GUI diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp index 46437e2e..d963aa90 100644 --- a/src/gui/ObjectMenu.cpp +++ b/src/gui/ObjectMenu.cpp @@ -51,7 +51,7 @@ ObjectMenu::ObjectMenu(BaseObjectType* cobject, } void -ObjectMenu::init(App& app, SharedPtr<const ObjectModel> object) +ObjectMenu::init(App& app, SPtr<const ObjectModel> object) { _app = &app; _object = object; diff --git a/src/gui/ObjectMenu.hpp b/src/gui/ObjectMenu.hpp index c4648443..63ca666d 100644 --- a/src/gui/ObjectMenu.hpp +++ b/src/gui/ObjectMenu.hpp @@ -22,9 +22,8 @@ #include <gtkmm/menu.h> #include <gtkmm/menuitem.h> -#include "raul/SharedPtr.hpp" - #include "ingen/client/ObjectModel.hpp" +#include "ingen/types.hpp" namespace Ingen { namespace GUI { @@ -43,7 +42,7 @@ public: ObjectMenu(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml); - void init(App& app, SharedPtr<const Client::ObjectModel> object); + void init(App& app, SPtr<const Client::ObjectModel> object); protected: void on_menu_learn(); @@ -55,15 +54,15 @@ protected: void property_changed(const Raul::URI& predicate, const Raul::Atom& value); - App* _app; - SharedPtr<const Client::ObjectModel> _object; - Gtk::MenuItem* _learn_menuitem; - Gtk::MenuItem* _unlearn_menuitem; - Gtk::CheckMenuItem* _polyphonic_menuitem; - Gtk::MenuItem* _disconnect_menuitem; - Gtk::MenuItem* _rename_menuitem; - Gtk::MenuItem* _destroy_menuitem; - Gtk::MenuItem* _properties_menuitem; + App* _app; + SPtr<const Client::ObjectModel> _object; + Gtk::MenuItem* _learn_menuitem; + Gtk::MenuItem* _unlearn_menuitem; + Gtk::CheckMenuItem* _polyphonic_menuitem; + Gtk::MenuItem* _disconnect_menuitem; + Gtk::MenuItem* _rename_menuitem; + Gtk::MenuItem* _destroy_menuitem; + Gtk::MenuItem* _properties_menuitem; bool _enable_signal; }; diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index 0b85b286..b22339a0 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -40,11 +40,11 @@ namespace Ingen { namespace GUI { Port* -Port::create(App& app, - Ganv::Module& module, - SharedPtr<const PortModel> pm, - bool human_name, - bool flip) +Port::create(App& app, + Ganv::Module& module, + SPtr<const PortModel> pm, + bool human_name, + bool flip) { Glib::ustring label; if (app.world()->conf().option("port-labels").get_bool()) { @@ -53,7 +53,7 @@ Port::create(App& app, if (name.type() == app.forge().String) { label = name.get_string(); } else { - const SharedPtr<const BlockModel> parent(PtrCast<const BlockModel>(pm->parent())); + const SPtr<const BlockModel> parent(dynamic_ptr_cast<const BlockModel>(pm->parent())); if (parent && parent->plugin_model()) label = parent->plugin_model()->port_human_name(pm->index()); } @@ -66,11 +66,11 @@ Port::create(App& app, /** @a flip Make an input port appear as an output port, and vice versa. */ -Port::Port(App& app, - Ganv::Module& module, - SharedPtr<const PortModel> pm, - const string& name, - bool flip) +Port::Port(App& app, + Ganv::Module& module, + SPtr<const PortModel> pm, + const string& name, + bool flip) : Ganv::Port(module, name, flip ? (!pm->is_input()) : pm->is_input(), app.style()->get_port_color(pm.get())) @@ -115,9 +115,9 @@ Port::~Port() void Port::update_metadata() { - SharedPtr<const PortModel> pm = _port_model.lock(); + SPtr<const PortModel> pm = _port_model.lock(); if (_app.can_control(pm.get()) && pm->is_numeric()) { - boost::shared_ptr<const BlockModel> parent = PtrCast<const BlockModel>(pm->parent()); + SPtr<const BlockModel> parent = dynamic_ptr_cast<const BlockModel>(pm->parent()); if (parent) { float min = 0.0f; float max = 1.0f; @@ -190,8 +190,8 @@ Port::on_scale_point_activated(float f) Gtk::Menu* Port::build_enum_menu() { - SharedPtr<const BlockModel> block = PtrCast<BlockModel>(model()->parent()); - Gtk::Menu* menu = Gtk::manage(new Gtk::Menu()); + SPtr<const BlockModel> block = dynamic_ptr_cast<BlockModel>(model()->parent()); + Gtk::Menu* menu = Gtk::manage(new Gtk::Menu()); PluginModel::ScalePoints points = block->plugin_model()->port_scale_points( model()->index()); @@ -220,9 +220,9 @@ Port::on_uri_activated(const Raul::URI& uri) Gtk::Menu* Port::build_uri_menu() { - World* world = _app.world(); - SharedPtr<const BlockModel> block = PtrCast<BlockModel>(model()->parent()); - Gtk::Menu* menu = Gtk::manage(new Gtk::Menu()); + World* world = _app.world(); + SPtr<const BlockModel> block = dynamic_ptr_cast<BlockModel>(model()->parent()); + Gtk::Menu* menu = Gtk::manage(new Gtk::Menu()); // Get the port designation, which should be a rdf:Property const Raul::Atom& designation_atom = model()->get_property( @@ -370,7 +370,7 @@ Port::activity(const Raul::Atom& value) } void -Port::disconnected_from(SharedPtr<PortModel> port) +Port::disconnected_from(SPtr<PortModel> port) { if (!model()->connected() && model()->is_a(_app.uris().lv2_AudioPort)) { set_fill_color(peak_color(0.0f)); @@ -380,9 +380,9 @@ Port::disconnected_from(SharedPtr<PortModel> port) GraphBox* Port::get_graph_box() const { - SharedPtr<const GraphModel> graph = PtrCast<const GraphModel>(model()->parent()); + SPtr<const GraphModel> graph = dynamic_ptr_cast<const GraphModel>(model()->parent()); if (!graph) { - graph = PtrCast<const GraphModel>(model()->parent()->parent()); + graph = dynamic_ptr_cast<const GraphModel>(model()->parent()->parent()); } return _app.window_factory()->graph_box(graph); @@ -424,9 +424,9 @@ Port::set_selected(gboolean b) { if (b != get_selected()) { Ganv::Port::set_selected(b); - SharedPtr<const PortModel> pm = _port_model.lock(); + SPtr<const PortModel> pm = _port_model.lock(); if (pm && b) { - SharedPtr<const BlockModel> block = PtrCast<BlockModel>(pm->parent()); + SPtr<const BlockModel> block = dynamic_ptr_cast<BlockModel>(pm->parent()); GraphWindow* win = _app.window_factory()->parent_graph_window(block); if (win && win->documentation_is_visible() && block->plugin_model()) { const std::string& doc = block->plugin_model()->port_documentation( diff --git a/src/gui/Port.hpp b/src/gui/Port.hpp index 94f66ecd..a9d24c1f 100644 --- a/src/gui/Port.hpp +++ b/src/gui/Port.hpp @@ -23,8 +23,7 @@ #include <gtkmm/menu.h> #include "ganv/Port.hpp" -#include "raul/SharedPtr.hpp" -#include "raul/WeakPtr.hpp" +#include "ingen/types.hpp" namespace Raul { class Atom; @@ -48,31 +47,31 @@ class Port : public Ganv::Port { public: static Port* create( - App& app, - Ganv::Module& module, - SharedPtr<const Client::PortModel> pm, - bool human_name, - bool flip = false); + App& app, + Ganv::Module& module, + SPtr<const Client::PortModel> pm, + bool human_name, + bool flip = false); ~Port(); - SharedPtr<const Client::PortModel> model() const { return _port_model.lock(); } + SPtr<const Client::PortModel> model() const { return _port_model.lock(); } bool show_menu(GdkEventButton* ev); void update_metadata(); void value_changed(const Raul::Atom& value); void activity(const Raul::Atom& value); - void disconnected_from(SharedPtr<Client::PortModel> port); + void disconnected_from(SPtr<Client::PortModel> port); void set_selected(gboolean b); private: - Port(App& app, - Ganv::Module& module, - SharedPtr<const Client::PortModel> pm, - const std::string& name, - bool flip = false); + Port(App& app, + Ganv::Module& module, + SPtr<const Client::PortModel> pm, + const std::string& name, + bool flip = false); Gtk::Menu* build_enum_menu(); Gtk::Menu* build_uri_menu(); @@ -86,11 +85,11 @@ private: void on_uri_activated(const Raul::URI& uri); bool on_event(GdkEvent* ev); - App& _app; - WeakPtr<const Client::PortModel> _port_model; - bool _pressed : 1; - bool _entered : 1; - bool _flipped : 1; + App& _app; + WPtr<const Client::PortModel> _port_model; + bool _pressed : 1; + bool _entered : 1; + bool _flipped : 1; }; } // namespace GUI diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index 18e16aa3..76dff135 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -19,7 +19,7 @@ #include "ingen/Interface.hpp" #include "ingen/client/GraphModel.hpp" #include "ingen/client/PortModel.hpp" -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" #include "App.hpp" #include "PortMenu.hpp" @@ -44,7 +44,7 @@ PortMenu::PortMenu(BaseObjectType* cobject, } void -PortMenu::init(App& app, SharedPtr<const PortModel> port, bool is_graph_port) +PortMenu::init(App& app, SPtr<const PortModel> port, bool is_graph_port) { const URIs& uris = app.uris(); @@ -63,8 +63,8 @@ PortMenu::init(App& app, SharedPtr<const PortModel> port, bool is_graph_port) _expose_menuitem->signal_activate().connect( sigc::mem_fun(this, &PortMenu::on_menu_expose)); - const bool is_control = app.can_control(port.get()) && port->is_numeric(); - const bool is_on_graph = PtrCast<GraphModel>(port->parent()); + const bool is_control(app.can_control(port.get()) && port->is_numeric()); + const bool is_on_graph(dynamic_ptr_cast<GraphModel>(port->parent())); if (!_is_graph_port) { _polyphonic_menuitem->set_sensitive(false); @@ -101,9 +101,9 @@ PortMenu::on_menu_disconnect() void PortMenu::on_menu_set_min() { - const URIs& uris = _app->uris(); - SharedPtr<const PortModel> model = PtrCast<const PortModel>(_object); - const Raul::Atom& value = model->get_property(uris.ingen_value); + const URIs& uris = _app->uris(); + SPtr<const PortModel> model = dynamic_ptr_cast<const PortModel>(_object); + const Raul::Atom& value = model->get_property(uris.ingen_value); if (value.is_valid()) _app->interface()->set_property(_object->uri(), uris.lv2_minimum, value); } @@ -111,9 +111,9 @@ PortMenu::on_menu_set_min() void PortMenu::on_menu_set_max() { - const URIs& uris = _app->uris(); - SharedPtr<const PortModel> model = PtrCast<const PortModel>(_object); - const Raul::Atom& value = model->get_property(uris.ingen_value); + const URIs& uris = _app->uris(); + SPtr<const PortModel> model = dynamic_ptr_cast<const PortModel>(_object); + const Raul::Atom& value = model->get_property(uris.ingen_value); if (value.is_valid()) _app->interface()->set_property(_object->uri(), uris.lv2_maximum, value); } @@ -121,9 +121,9 @@ PortMenu::on_menu_set_max() void PortMenu::on_menu_reset_range() { - const URIs& uris = _app->uris(); - SharedPtr<const PortModel> model = PtrCast<const PortModel>(_object); - SharedPtr<const BlockModel> parent = PtrCast<const BlockModel>(_object->parent()); + const URIs& uris = _app->uris(); + SPtr<const PortModel> model = dynamic_ptr_cast<const PortModel>(_object); + SPtr<const BlockModel> parent = dynamic_ptr_cast<const BlockModel>(_object->parent()); float min, max; parent->default_port_value_range(model, min, max); @@ -142,9 +142,9 @@ PortMenu::on_menu_reset_range() void PortMenu::on_menu_expose() { - const URIs& uris = _app->uris(); - SharedPtr<const PortModel> port = PtrCast<const PortModel>(_object); - SharedPtr<const BlockModel> block = PtrCast<const BlockModel>(port->parent()); + const URIs& uris = _app->uris(); + SPtr<const PortModel> port = dynamic_ptr_cast<const PortModel>(_object); + SPtr<const BlockModel> block = dynamic_ptr_cast<const BlockModel>(port->parent()); const std::string label = block->label() + " " + block->port_label(port); const Raul::Path path = Raul::Path(block->path() + Raul::Symbol("_" + port->symbol())); diff --git a/src/gui/PortMenu.hpp b/src/gui/PortMenu.hpp index 34f2c315..7e375098 100644 --- a/src/gui/PortMenu.hpp +++ b/src/gui/PortMenu.hpp @@ -22,7 +22,7 @@ #include <gtkmm/menushell.h> #include "ingen/client/PortModel.hpp" -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" #include "ObjectMenu.hpp" @@ -39,9 +39,9 @@ public: PortMenu(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml); - void init(App& app, - SharedPtr<const Client::PortModel> port, - bool is_graph_port = false); + void init(App& app, + SPtr<const Client::PortModel> port, + bool is_graph_port = false); private: void on_menu_disconnect(); diff --git a/src/gui/PortPropertiesWindow.cpp b/src/gui/PortPropertiesWindow.cpp index a0162fba..defe8235 100644 --- a/src/gui/PortPropertiesWindow.cpp +++ b/src/gui/PortPropertiesWindow.cpp @@ -52,7 +52,7 @@ PortPropertiesWindow::PortPropertiesWindow(BaseObjectType* cob * This function MUST be called before using this object in any way. */ void -PortPropertiesWindow::present(SharedPtr<const PortModel> pm) +PortPropertiesWindow::present(SPtr<const PortModel> pm) { assert(pm); @@ -66,7 +66,7 @@ PortPropertiesWindow::present(SharedPtr<const PortModel> pm) set_title(pm->path() + " Properties - Ingen"); float min = 0.0f, max = 1.0f; - boost::shared_ptr<BlockModel> parent = PtrCast<BlockModel>(_port_model->parent()); + SPtr<BlockModel> parent = dynamic_ptr_cast<BlockModel>(_port_model->parent()); if (parent) parent->port_value_range(_port_model, min, max, _app->sample_rate()); diff --git a/src/gui/PortPropertiesWindow.hpp b/src/gui/PortPropertiesWindow.hpp index 309f3968..1cf86aa8 100644 --- a/src/gui/PortPropertiesWindow.hpp +++ b/src/gui/PortPropertiesWindow.hpp @@ -22,9 +22,8 @@ #include <gtkmm/builder.h> #include <gtkmm/spinbutton.h> -#include "raul/SharedPtr.hpp" - #include "ingen/client/PortModel.hpp" +#include "ingen/types.hpp" #include "Window.hpp" @@ -43,7 +42,7 @@ public: PortPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml); - void present(SharedPtr<const Client::PortModel> port_model); + void present(SPtr<const Client::PortModel> port_model); private: void property_changed(const Raul::URI& key, const Raul::Atom& value); @@ -56,12 +55,12 @@ private: float _initial_min; float _initial_max; - SharedPtr<const Client::PortModel> _port_model; - Gtk::SpinButton* _min_spinner; - Gtk::SpinButton* _max_spinner; - Gtk::Button* _cancel_button; - Gtk::Button* _ok_button; - std::list<sigc::connection> _connections; + SPtr<const Client::PortModel> _port_model; + Gtk::SpinButton* _min_spinner; + Gtk::SpinButton* _max_spinner; + Gtk::Button* _cancel_button; + Gtk::Button* _ok_button; + std::list<sigc::connection> _connections; }; } // namespace GUI diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index 44d84d70..0f21a4fb 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -97,7 +97,7 @@ PropertiesWindow::reset() } void -PropertiesWindow::present(SharedPtr<const ObjectModel> model) +PropertiesWindow::present(SPtr<const ObjectModel> model) { set_object(model); Gtk::Window::present(); @@ -140,7 +140,7 @@ PropertiesWindow::add_property(const Raul::URI& uri, const Raul::Atom& value) * This function MUST be called before using this object in any way. */ void -PropertiesWindow::set_object(SharedPtr<const ObjectModel> model) +PropertiesWindow::set_object(SPtr<const ObjectModel> model) { reset(); _model = model; diff --git a/src/gui/PropertiesWindow.hpp b/src/gui/PropertiesWindow.hpp index 7ba5e5b6..ad4d3d90 100644 --- a/src/gui/PropertiesWindow.hpp +++ b/src/gui/PropertiesWindow.hpp @@ -28,9 +28,8 @@ #include <gtkmm/scrolledwindow.h> #include <gtkmm/table.h> -#include "raul/SharedPtr.hpp" - #include "ingen/client/BlockModel.hpp" +#include "ingen/types.hpp" #include "Window.hpp" @@ -52,8 +51,8 @@ public: PropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml); - void present(SharedPtr<const Client::ObjectModel> model); - void set_object(SharedPtr<const Client::ObjectModel> model); + void present(SPtr<const Client::ObjectModel> model); + void set_object(SPtr<const Client::ObjectModel> model); private: /** Record of a property (row in the table) */ @@ -96,20 +95,20 @@ private: typedef std::map<Raul::URI, Record> Records; Records _records; - SharedPtr<const Client::ObjectModel> _model; - ComboColumns _combo_columns; - Glib::RefPtr<Gtk::ListStore> _key_store; - Glib::RefPtr<Gtk::ListStore> _value_store; - sigc::connection _property_connection; - Gtk::VBox* _vbox; - Gtk::ScrolledWindow* _scrolledwindow; - Gtk::Table* _table; - Gtk::ComboBox* _key_combo; - Gtk::ComboBox* _value_combo; - Gtk::Button* _add_button; - Gtk::Button* _cancel_button; - Gtk::Button* _apply_button; - Gtk::Button* _ok_button; + SPtr<const Client::ObjectModel> _model; + ComboColumns _combo_columns; + Glib::RefPtr<Gtk::ListStore> _key_store; + Glib::RefPtr<Gtk::ListStore> _value_store; + sigc::connection _property_connection; + Gtk::VBox* _vbox; + Gtk::ScrolledWindow* _scrolledwindow; + Gtk::Table* _table; + Gtk::ComboBox* _key_combo; + Gtk::ComboBox* _value_combo; + Gtk::Button* _add_button; + Gtk::Button* _cancel_button; + Gtk::Button* _apply_button; + Gtk::Button* _ok_button; }; } // namespace GUI diff --git a/src/gui/RDFS.cpp b/src/gui/RDFS.cpp index bec69cee..667e51fe 100644 --- a/src/gui/RDFS.cpp +++ b/src/gui/RDFS.cpp @@ -78,7 +78,7 @@ classes(World* world, URISet& types, bool super) } URISet -types(World* world, SharedPtr<const Client::ObjectModel> model) +types(World* world, SPtr<const Client::ObjectModel> model) { typedef Resource::Properties::const_iterator PropIter; typedef std::pair<PropIter, PropIter> PropRange; @@ -101,7 +101,7 @@ types(World* world, SharedPtr<const Client::ObjectModel> model) } URISet -properties(World* world, SharedPtr<const Client::ObjectModel> model) +properties(World* world, SPtr<const Client::ObjectModel> model) { URISet properties; URISet types = RDFS::types(world, model); diff --git a/src/gui/RDFS.hpp b/src/gui/RDFS.hpp index bdc0a7a1..583f5d90 100644 --- a/src/gui/RDFS.hpp +++ b/src/gui/RDFS.hpp @@ -22,8 +22,8 @@ #include <glibmm/ustring.h> +#include "ingen/types.hpp" #include "raul/URI.hpp" -#include "raul/SharedPtr.hpp" namespace Ingen { @@ -55,10 +55,10 @@ Objects instances(World* world, const URISet& types); /** Get all the types which @p model is an instance of. */ -URISet types(World* world, SharedPtr<const Client::ObjectModel> model); +URISet types(World* world, SPtr<const Client::ObjectModel> model); /** Get all the properties with domains appropriate for @p model. */ -URISet properties(World* world, SharedPtr<const Client::ObjectModel> model); +URISet properties(World* world, SPtr<const Client::ObjectModel> model); } // namespace RDFS } // namespace GUI diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp index da9fb2c6..c6815fd7 100644 --- a/src/gui/RenameWindow.cpp +++ b/src/gui/RenameWindow.cpp @@ -59,7 +59,7 @@ RenameWindow::RenameWindow(BaseObjectType* cobject, * This function MUST be called before using this object in any way. */ void -RenameWindow::set_object(SharedPtr<const ObjectModel> object) +RenameWindow::set_object(SPtr<const ObjectModel> object) { _object = object; _symbol_entry->set_text(object->path().symbol()); @@ -69,7 +69,7 @@ RenameWindow::set_object(SharedPtr<const ObjectModel> object) } void -RenameWindow::present(SharedPtr<const ObjectModel> object) +RenameWindow::present(SPtr<const ObjectModel> object) { set_object(object); _symbol_entry->grab_focus(); diff --git a/src/gui/RenameWindow.hpp b/src/gui/RenameWindow.hpp index 03d5e318..718f2863 100644 --- a/src/gui/RenameWindow.hpp +++ b/src/gui/RenameWindow.hpp @@ -22,9 +22,8 @@ #include <gtkmm/entry.h> #include <gtkmm/label.h> -#include "raul/SharedPtr.hpp" - #include "ingen/client/ObjectModel.hpp" +#include "ingen/types.hpp" #include "Window.hpp" @@ -41,16 +40,16 @@ public: RenameWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml); - void present(SharedPtr<const Client::ObjectModel> object); + void present(SPtr<const Client::ObjectModel> object); private: - void set_object(SharedPtr<const Client::ObjectModel> object); + void set_object(SPtr<const Client::ObjectModel> object); void values_changed(); void cancel_clicked(); void ok_clicked(); - SharedPtr<const Client::ObjectModel> _object; + SPtr<const Client::ObjectModel> _object; Gtk::Entry* _symbol_entry; Gtk::Entry* _label_entry; diff --git a/src/gui/Style.hpp b/src/gui/Style.hpp index eb6947f8..e871e3fa 100644 --- a/src/gui/Style.hpp +++ b/src/gui/Style.hpp @@ -21,8 +21,6 @@ #include <string> -#include "raul/SharedPtr.hpp" - namespace Ingen { namespace Client { class PortModel; } } namespace Ingen { diff --git a/src/gui/SubgraphModule.cpp b/src/gui/SubgraphModule.cpp index 88dbc81b..f4e9dc23 100644 --- a/src/gui/SubgraphModule.cpp +++ b/src/gui/SubgraphModule.cpp @@ -36,8 +36,8 @@ using namespace Client; namespace GUI { -SubgraphModule::SubgraphModule(GraphCanvas& canvas, - SharedPtr<const GraphModel> graph) +SubgraphModule::SubgraphModule(GraphCanvas& canvas, + SPtr<const GraphModel> graph) : NodeModule(canvas, graph) , _graph(graph) { @@ -49,7 +49,7 @@ SubgraphModule::on_double_click(GdkEventButton* event) { assert(_graph); - SharedPtr<GraphModel> parent = PtrCast<GraphModel>(_graph->parent()); + SPtr<GraphModel> parent = dynamic_ptr_cast<GraphModel>(_graph->parent()); GraphWindow* const preferred = ( (parent && (event->state & GDK_SHIFT_MASK)) ? NULL @@ -92,7 +92,7 @@ SubgraphModule::browse_to_graph() { assert(_graph->parent()); - SharedPtr<GraphModel> parent = PtrCast<GraphModel>(_graph->parent()); + SPtr<GraphModel> parent = dynamic_ptr_cast<GraphModel>(_graph->parent()); GraphWindow* const preferred = (parent) ? app().window_factory()->graph_window(parent) diff --git a/src/gui/SubgraphModule.hpp b/src/gui/SubgraphModule.hpp index 569e0fd8..a439c324 100644 --- a/src/gui/SubgraphModule.hpp +++ b/src/gui/SubgraphModule.hpp @@ -17,7 +17,7 @@ #ifndef INGEN_GUI_SUBGRAPHMODULE_HPP #define INGEN_GUI_SUBGRAPHMODULE_HPP -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" #include "NodeModule.hpp" #include "GraphPortModule.hpp" @@ -41,7 +41,7 @@ class SubgraphModule : public NodeModule { public: SubgraphModule(GraphCanvas& canvas, - SharedPtr<const Client::GraphModel> controller); + SPtr<const Client::GraphModel> controller); virtual ~SubgraphModule() {} @@ -52,10 +52,10 @@ public: void browse_to_graph(); void menu_remove(); - SharedPtr<const Client::GraphModel> graph() const { return _graph; } + SPtr<const Client::GraphModel> graph() const { return _graph; } protected: - SharedPtr<const Client::GraphModel> _graph; + SPtr<const Client::GraphModel> _graph; }; } // namespace GUI diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp index 9575734b..597a728d 100644 --- a/src/gui/ThreadedLoader.cpp +++ b/src/gui/ThreadedLoader.cpp @@ -30,7 +30,7 @@ using namespace std; namespace Ingen { namespace GUI { -ThreadedLoader::ThreadedLoader(App& app, SharedPtr<Interface> engine) +ThreadedLoader::ThreadedLoader(App& app, SPtr<Interface> engine) : Raul::Thread() , _app(app) , _sem(0) @@ -49,7 +49,7 @@ ThreadedLoader::~ThreadedLoader() _sem.post(); } -SharedPtr<Serialisation::Parser> +SPtr<Serialisation::Parser> ThreadedLoader::parser() { Ingen::World* world = _app.world(); @@ -108,8 +108,8 @@ ThreadedLoader::load_graph(bool merge, } void -ThreadedLoader::save_graph(SharedPtr<const Client::GraphModel> model, - const string& filename) +ThreadedLoader::save_graph(SPtr<const Client::GraphModel> model, + const string& filename) { _mutex.lock(); @@ -122,8 +122,8 @@ ThreadedLoader::save_graph(SharedPtr<const Client::GraphModel> model, } void -ThreadedLoader::save_graph_event(SharedPtr<const Client::GraphModel> model, - const string& filename) +ThreadedLoader::save_graph_event(SPtr<const Client::GraphModel> model, + const string& filename) { if (_app.serialiser()) { if (filename.find(".ingen") != string::npos) diff --git a/src/gui/ThreadedLoader.hpp b/src/gui/ThreadedLoader.hpp index afca29a9..815cfeec 100644 --- a/src/gui/ThreadedLoader.hpp +++ b/src/gui/ThreadedLoader.hpp @@ -47,8 +47,8 @@ namespace GUI { class ThreadedLoader : public Raul::Thread { public: - ThreadedLoader(App& app, - SharedPtr<Interface> engine); + ThreadedLoader(App& app, + SPtr<Interface> engine); ~ThreadedLoader(); @@ -58,25 +58,25 @@ public: boost::optional<Raul::Symbol> engine_symbol, boost::optional<Node::Properties> engine_data); - void save_graph(SharedPtr<const Client::GraphModel> model, - const std::string& filename); + void save_graph(SPtr<const Client::GraphModel> model, + const std::string& filename); - SharedPtr<Serialisation::Parser> parser(); + SPtr<Serialisation::Parser> parser(); private: - void save_graph_event(SharedPtr<const Client::GraphModel> model, - const std::string& filename); + void save_graph_event(SPtr<const Client::GraphModel> model, + const std::string& filename); /** Returns nothing and takes no parameters (because they have all been bound) */ typedef sigc::slot<void> Closure; void _run(); - App& _app; - Raul::Semaphore _sem; - SharedPtr<Interface> _engine; - Glib::Mutex _mutex; - std::list<Closure> _events; + App& _app; + Raul::Semaphore _sem; + SPtr<Interface> _engine; + Glib::Mutex _mutex; + std::list<Closure> _events; }; } // namespace GUI diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp index 983e246b..f8738f40 100644 --- a/src/gui/WindowFactory.cpp +++ b/src/gui/WindowFactory.cpp @@ -87,7 +87,7 @@ WindowFactory::num_open_graph_windows() } GraphBox* -WindowFactory::graph_box(SharedPtr<const GraphModel> graph) +WindowFactory::graph_box(SPtr<const GraphModel> graph) { GraphWindow* window = graph_window(graph); if (window) { @@ -98,7 +98,7 @@ WindowFactory::graph_box(SharedPtr<const GraphModel> graph) } GraphWindow* -WindowFactory::graph_window(SharedPtr<const GraphModel> graph) +WindowFactory::graph_window(SPtr<const GraphModel> graph) { if (!graph) return NULL; @@ -109,12 +109,12 @@ WindowFactory::graph_window(SharedPtr<const GraphModel> graph) } GraphWindow* -WindowFactory::parent_graph_window(SharedPtr<const BlockModel> block) +WindowFactory::parent_graph_window(SPtr<const BlockModel> block) { if (!block) return NULL; - return graph_window(PtrCast<GraphModel>(block->parent())); + return graph_window(dynamic_ptr_cast<GraphModel>(block->parent())); } /** Present a GraphWindow for a Graph. @@ -124,9 +124,9 @@ WindowFactory::parent_graph_window(SharedPtr<const BlockModel> block) * presented and @a preferred left unmodified. */ void -WindowFactory::present_graph(SharedPtr<const GraphModel> graph, - GraphWindow* preferred, - SharedPtr<GraphView> view) +WindowFactory::present_graph(SPtr<const GraphModel> graph, + GraphWindow* preferred, + SPtr<GraphView> view) { assert(!view || view->graph() == graph); @@ -150,8 +150,8 @@ WindowFactory::present_graph(SharedPtr<const GraphModel> graph, } GraphWindow* -WindowFactory::new_graph_window(SharedPtr<const GraphModel> graph, - SharedPtr<GraphView> view) +WindowFactory::new_graph_window(SPtr<const GraphModel> graph, + SPtr<GraphView> view) { assert(!view || view->graph() == graph); @@ -185,8 +185,8 @@ WindowFactory::remove_graph_window(GraphWindow* win, GdkEventAny* ignored) } void -WindowFactory::present_load_plugin(SharedPtr<const GraphModel> graph, - Node::Properties data) +WindowFactory::present_load_plugin(SPtr<const GraphModel> graph, + Node::Properties data) { _app.request_plugins_if_necessary(); @@ -208,8 +208,8 @@ WindowFactory::present_load_plugin(SharedPtr<const GraphModel> graph, } void -WindowFactory::present_load_graph(SharedPtr<const GraphModel> graph, - Node::Properties data) +WindowFactory::present_load_graph(SPtr<const GraphModel> graph, + Node::Properties data) { GraphWindowMap::iterator w = _graph_windows.find(graph->path()); @@ -220,8 +220,8 @@ WindowFactory::present_load_graph(SharedPtr<const GraphModel> graph, } void -WindowFactory::present_load_subgraph(SharedPtr<const GraphModel> graph, - Node::Properties data) +WindowFactory::present_load_subgraph(SPtr<const GraphModel> graph, + Node::Properties data) { GraphWindowMap::iterator w = _graph_windows.find(graph->path()); @@ -232,8 +232,8 @@ WindowFactory::present_load_subgraph(SharedPtr<const GraphModel> graph, } void -WindowFactory::present_new_subgraph(SharedPtr<const GraphModel> graph, - Node::Properties data) +WindowFactory::present_new_subgraph(SPtr<const GraphModel> graph, + Node::Properties data) { GraphWindowMap::iterator w = _graph_windows.find(graph->path()); @@ -244,7 +244,7 @@ WindowFactory::present_new_subgraph(SharedPtr<const GraphModel> graph, } void -WindowFactory::present_rename(SharedPtr<const ObjectModel> object) +WindowFactory::present_rename(SPtr<const ObjectModel> object) { GraphWindowMap::iterator w = _graph_windows.find(object->path()); if (w == _graph_windows.end()) @@ -257,7 +257,7 @@ WindowFactory::present_rename(SharedPtr<const ObjectModel> object) } void -WindowFactory::present_properties(SharedPtr<const ObjectModel> object) +WindowFactory::present_properties(SPtr<const ObjectModel> object) { GraphWindowMap::iterator w = _graph_windows.find(object->path()); if (w == _graph_windows.end()) diff --git a/src/gui/WindowFactory.hpp b/src/gui/WindowFactory.hpp index bdeac89d..f68d5847 100644 --- a/src/gui/WindowFactory.hpp +++ b/src/gui/WindowFactory.hpp @@ -20,7 +20,7 @@ #include <map> #include "ingen/Node.hpp" -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" namespace Ingen { @@ -55,23 +55,23 @@ public: size_t num_open_graph_windows(); - GraphBox* graph_box(SharedPtr<const Client::GraphModel> graph); - GraphWindow* graph_window(SharedPtr<const Client::GraphModel> graph); - GraphWindow* parent_graph_window(SharedPtr<const Client::BlockModel> block); + GraphBox* graph_box(SPtr<const Client::GraphModel> graph); + GraphWindow* graph_window(SPtr<const Client::GraphModel> graph); + GraphWindow* parent_graph_window(SPtr<const Client::BlockModel> block); void present_graph( - SharedPtr<const Client::GraphModel> model, - GraphWindow* preferred = NULL, - SharedPtr<GraphView> view = SharedPtr<GraphView>()); + SPtr<const Client::GraphModel> model, + GraphWindow* preferred = NULL, + SPtr<GraphView> view = SPtr<GraphView>()); typedef Node::Properties Properties; - void present_load_plugin(SharedPtr<const Client::GraphModel> graph, Properties data=Properties()); - void present_load_graph(SharedPtr<const Client::GraphModel> graph, Properties data=Properties()); - void present_load_subgraph(SharedPtr<const Client::GraphModel> graph, Properties data=Properties()); - void present_new_subgraph(SharedPtr<const Client::GraphModel> graph, Properties data=Properties()); - void present_rename(SharedPtr<const Client::ObjectModel> object); - void present_properties(SharedPtr<const Client::ObjectModel> object); + void present_load_plugin(SPtr<const Client::GraphModel> graph, Properties data=Properties()); + void present_load_graph(SPtr<const Client::GraphModel> graph, Properties data=Properties()); + void present_load_subgraph(SPtr<const Client::GraphModel> graph, Properties data=Properties()); + void present_new_subgraph(SPtr<const Client::GraphModel> graph, Properties data=Properties()); + void present_rename(SPtr<const Client::ObjectModel> object); + void present_properties(SPtr<const Client::ObjectModel> object); bool remove_graph_window(GraphWindow* win, GdkEventAny* ignored = NULL); @@ -82,8 +82,8 @@ public: private: typedef std::map<Raul::Path, GraphWindow*> GraphWindowMap; - GraphWindow* new_graph_window(SharedPtr<const Client::GraphModel> graph, - SharedPtr<GraphView> view); + GraphWindow* new_graph_window(SPtr<const Client::GraphModel> graph, + SPtr<GraphView> view); App& _app; GraphBox* _main_box; diff --git a/src/gui/ingen_gui.cpp b/src/gui/ingen_gui.cpp index d5c15ca9..999b2431 100644 --- a/src/gui/ingen_gui.cpp +++ b/src/gui/ingen_gui.cpp @@ -25,7 +25,7 @@ struct IngenGUIModule : public Ingen::Module { app->run(); } - SharedPtr<Ingen::GUI::App> app; + Ingen::SPtr<Ingen::GUI::App> app; }; extern "C" { diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp index b8a4443b..d95ea82f 100644 --- a/src/gui/ingen_gui_lv2.cpp +++ b/src/gui/ingen_gui_lv2.cpp @@ -22,6 +22,7 @@ #include "ingen/client/GraphModel.hpp" #include "ingen/client/SigClientInterface.hpp" #include "ingen/runtime_paths.hpp" +#include "ingen/types.hpp" #include "lv2/lv2plug.in/ns/extensions/ui/ui.h" #include "App.hpp" @@ -62,16 +63,16 @@ struct IngenLV2UI { , sink(NULL) {} - int argc; - char** argv; - Ingen::Forge* forge; - Ingen::World* world; - IngenLV2AtomSink* sink; - SharedPtr<Ingen::GUI::App> app; - SharedPtr<Ingen::GUI::GraphBox> view; - SharedPtr<Ingen::Interface> engine; - SharedPtr<Ingen::AtomReader> reader; - SharedPtr<Ingen::Client::SigClientInterface> client; + int argc; + char** argv; + Ingen::Forge* forge; + Ingen::World* world; + IngenLV2AtomSink* sink; + Ingen::SPtr<Ingen::GUI::App> app; + Ingen::SPtr<Ingen::GUI::GraphBox> view; + Ingen::SPtr<Ingen::Interface> engine; + Ingen::SPtr<Ingen::AtomReader> reader; + Ingen::SPtr<Ingen::Client::SigClientInterface> client; }; static LV2UI_Handle @@ -113,7 +114,7 @@ instantiate(const LV2UI_Descriptor* descriptor, ui->world->uris(), write_function, controller); // Set up an engine interface that writes LV2 atoms - ui->engine = SharedPtr<Ingen::Interface>( + ui->engine = Ingen::SPtr<Ingen::Interface>( new Ingen::AtomWriter( ui->world->uri_map(), ui->world->uris(), *ui->sink)); @@ -121,11 +122,11 @@ instantiate(const LV2UI_Descriptor* descriptor, // Create App and client ui->app = Ingen::GUI::App::create(ui->world); - ui->client = SharedPtr<Ingen::Client::SigClientInterface>( + ui->client = Ingen::SPtr<Ingen::Client::SigClientInterface>( new Ingen::Client::SigClientInterface()); ui->app->attach(ui->client); - ui->reader = SharedPtr<Ingen::AtomReader>( + ui->reader = Ingen::SPtr<Ingen::AtomReader>( new Ingen::AtomReader(ui->world->uri_map(), ui->world->uris(), ui->world->log(), @@ -140,8 +141,9 @@ instantiate(const LV2UI_Descriptor* descriptor, ui->app->store()->put(Ingen::Node::root_uri(), props); // Create a GraphBox for the root and set as the UI widget - SharedPtr<const Ingen::Client::GraphModel> root = PtrCast<const Ingen::Client::GraphModel>( - ui->app->store()->object(Raul::Path("/"))); + Ingen::SPtr<const Ingen::Client::GraphModel> root = + Ingen::dynamic_ptr_cast<const Ingen::Client::GraphModel>( + ui->app->store()->object(Raul::Path("/"))); ui->view = Ingen::GUI::GraphBox::create(*ui->app, root); ui->view->unparent(); *widget = ui->view->gobj(); diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp index 3cd2ccf6..c194dcde 100644 --- a/src/ingen/main.cpp +++ b/src/ingen/main.cpp @@ -24,7 +24,6 @@ #include <glibmm/timer.h> #include "raul/Path.hpp" -#include "raul/SharedPtr.hpp" #include "raul/fmt.hpp" #include "ingen_config.h" @@ -36,6 +35,7 @@ #include "ingen/client/ThreadedSigClientInterface.hpp" #include "ingen/runtime_paths.hpp" #include "ingen/serialisation/Parser.hpp" +#include "ingen/types.hpp" #ifdef WITH_BINDINGS #include "bindings/ingen_bindings.hpp" #endif @@ -97,13 +97,12 @@ main(int argc, char** argv) } // Run engine - SharedPtr<Interface> engine_interface; + SPtr<Interface> engine_interface; if (conf.option("engine").get_bool()) { ingen_try(world->load_module("server"), "Unable to load server module"); - ingen_try(world->engine(), - "Unable to create engine"); + ingen_try(bool(world->engine()), "Unable to create engine"); engine_interface = world->interface(); @@ -124,9 +123,10 @@ main(int argc, char** argv) const char* const uri = conf.option("connect").get_string(); ingen_try(Raul::URI::is_valid(uri), (Raul::fmt("Invalid URI <%1%>") % uri).str().c_str()); - SharedPtr<Interface> client(new Client::ThreadedSigClientInterface(1024)); - ingen_try((engine_interface = world->new_interface(Raul::URI(uri), client)), - (string("Unable to create interface to `") + uri + "'").c_str()); + SPtr<Interface> client(new Client::ThreadedSigClientInterface(1024)); + engine_interface = world->new_interface(Raul::URI(uri), client); + ingen_try(bool(engine_interface), + (Raul::fmt("Unable to create interface to `%1%'") % uri).str().c_str()); } world->set_interface(engine_interface); @@ -168,8 +168,7 @@ main(int argc, char** argv) } } - ingen_try(world->parser(), - "Unable to create parser"); + ingen_try(bool(world->parser()), "Unable to create parser"); const string path = conf.option("load").is_valid() ? conf.option("load").get_string() : diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index 0bd6b49b..41ae45dc 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -66,12 +66,12 @@ struct Serialiser::Impl { void start_to_filename(const std::string& filename); - void serialise_graph(SharedPtr<const Node> p, - const Sord::Node& id); + void serialise_graph(SPtr<const Node> p, + const Sord::Node& id); - void serialise_block(SharedPtr<const Node> n, - const Sord::Node& class_id, - const Sord::Node& id); + void serialise_block(SPtr<const Node> n, + const Sord::Node& class_id, + const Sord::Node& id); void serialise_port(const Node* p, Resource::Graph context, @@ -80,17 +80,17 @@ struct Serialiser::Impl { void serialise_properties(Sord::Node id, const Resource::Properties& props); - void write_bundle(SharedPtr<const Node> graph, - const std::string& uri); + void write_bundle(SPtr<const Node> graph, + const std::string& uri); Sord::Node path_rdf_node(const Raul::Path& path); - void write_manifest(const std::string& bundle_path, - SharedPtr<const Node> graph, - const std::string& graph_symbol); + void write_manifest(const std::string& bundle_path, + SPtr<const Node> graph, + const std::string& graph_symbol); - void serialise_arc(const Sord::Node& parent, - SharedPtr<const Arc> a) + void serialise_arc(const Sord::Node& parent, + SPtr<const Arc> a) throw (std::logic_error); std::string finish(); @@ -113,8 +113,8 @@ Serialiser::~Serialiser() } void -Serialiser::to_file(SharedPtr<const Node> object, - const std::string& filename) +Serialiser::to_file(SPtr<const Node> object, + const std::string& filename) { me->_root_path = object->path(); me->start_to_filename(filename); @@ -123,9 +123,9 @@ Serialiser::to_file(SharedPtr<const Node> object, } void -Serialiser::Impl::write_manifest(const std::string& bundle_path, - SharedPtr<const Node> graph, - const std::string& graph_symbol) +Serialiser::Impl::write_manifest(const std::string& bundle_path, + SPtr<const Node> graph, + const std::string& graph_symbol) { const string manifest_path(Glib::build_filename(bundle_path, "manifest.ttl")); const string binary_path(Glib::Module::build_path("", "ingen_lv2")); @@ -158,15 +158,15 @@ Serialiser::Impl::write_manifest(const std::string& bundle_path, } void -Serialiser::write_bundle(SharedPtr<const Node> graph, - const std::string& path) +Serialiser::write_bundle(SPtr<const Node> graph, + const std::string& path) { me->write_bundle(graph, path); } void -Serialiser::Impl::write_bundle(SharedPtr<const Node> graph, - const std::string& a_path) +Serialiser::Impl::write_bundle(SPtr<const Node> graph, + const std::string& a_path) { std::string path = Glib::filename_from_uri(a_path); if (Glib::file_test(path, Glib::FILE_TEST_EXISTS) @@ -195,8 +195,8 @@ Serialiser::Impl::write_bundle(SharedPtr<const Node> graph, } string -Serialiser::to_string(SharedPtr<const Node> object, - const string& base_uri) +Serialiser::to_string(SPtr<const Node> object, + const string& base_uri) { start_to_string(object->path(), base_uri); serialise(object); @@ -279,7 +279,7 @@ Serialiser::Impl::path_rdf_node(const Raul::Path& path) } void -Serialiser::serialise(SharedPtr<const Node> object) throw (std::logic_error) +Serialiser::serialise(SPtr<const Node> object) throw (std::logic_error) { if (!me->_model) throw std::logic_error("serialise called without serialisation in progress"); @@ -300,8 +300,8 @@ Serialiser::serialise(SharedPtr<const Node> object) throw (std::logic_error) } void -Serialiser::Impl::serialise_graph(SharedPtr<const Node> graph, - const Sord::Node& graph_id) +Serialiser::Impl::serialise_graph(SPtr<const Node> graph, + const Sord::Node& graph_id) { Sord::World& world = _model->world(); const URIs& uris = _world.uris(); @@ -354,7 +354,7 @@ Serialiser::Impl::serialise_graph(SharedPtr<const Node> graph, continue; if (n->second->graph_type() == Node::GraphType::GRAPH) { - SharedPtr<Node> subgraph = n->second; + SPtr<Node> subgraph = n->second; SerdURI base_uri; serd_uri_parse((const uint8_t*)_base_uri.c_str(), &base_uri); @@ -387,7 +387,7 @@ Serialiser::Impl::serialise_graph(SharedPtr<const Node> graph, block_id); serialise_block(subgraph, subgraph_id, block_id); } else if (n->second->graph_type() == Node::GraphType::BLOCK) { - SharedPtr<const Node> block = n->second; + SPtr<const Node> block = n->second; const Sord::URI class_id(world, block->plugin()->uri()); const Sord::Node block_id(path_rdf_node(n->second->path())); @@ -419,9 +419,9 @@ Serialiser::Impl::serialise_graph(SharedPtr<const Node> graph, } void -Serialiser::Impl::serialise_block(SharedPtr<const Node> block, - const Sord::Node& class_id, - const Sord::Node& block_id) +Serialiser::Impl::serialise_block(SPtr<const Node> block, + const Sord::Node& class_id, + const Sord::Node& block_id) { const URIs& uris = _world.uris(); @@ -480,16 +480,16 @@ Serialiser::Impl::serialise_port(const Node* port, } void -Serialiser::serialise_arc(const Sord::Node& parent, - SharedPtr<const Arc> arc) +Serialiser::serialise_arc(const Sord::Node& parent, + SPtr<const Arc> arc) throw (std::logic_error) { return me->serialise_arc(parent, arc); } void -Serialiser::Impl::serialise_arc(const Sord::Node& parent, - SharedPtr<const Arc> arc) +Serialiser::Impl::serialise_arc(const Sord::Node& parent, + SPtr<const Arc> arc) throw (std::logic_error) { if (!_model) diff --git a/src/serialisation/serialisation.cpp b/src/serialisation/serialisation.cpp index 3c650dc6..65f11090 100644 --- a/src/serialisation/serialisation.cpp +++ b/src/serialisation/serialisation.cpp @@ -24,9 +24,9 @@ using namespace Ingen; struct IngenSerialisationModule : public Ingen::Module { virtual void load(Ingen::World* world) { - world->set_parser(SharedPtr<Serialisation::Parser>( + world->set_parser(SPtr<Serialisation::Parser>( new Serialisation::Parser())); - world->set_serialiser(SharedPtr<Serialisation::Serialiser>( + world->set_serialiser(SPtr<Serialisation::Serialiser>( new Serialisation::Serialiser(*world))); } }; diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp index 61237ee4..a174c270 100644 --- a/src/server/BlockFactory.cpp +++ b/src/server/BlockFactory.cpp @@ -120,13 +120,13 @@ void BlockFactory::load_lv2_plugins() { // Build an array of port type nodes for checking compatibility - typedef std::vector< SharedPtr<LilvNode> > Types; + typedef std::vector< SPtr<LilvNode> > Types; Types types; for (unsigned t = PortType::ID::AUDIO; t <= PortType::ID::ATOM; ++t) { const Raul::URI& uri(PortType((PortType::ID)t).uri()); - types.push_back(SharedPtr<LilvNode>( - lilv_new_uri(_world->lilv_world(), uri.c_str()), - lilv_node_free)); + types.push_back( + SPtr<LilvNode>(lilv_new_uri(_world->lilv_world(), uri.c_str()), + lilv_node_free)); } const LilvPlugins* plugins = lilv_world_get_all_plugins(_world->lilv_world()); diff --git a/src/server/BlockFactory.hpp b/src/server/BlockFactory.hpp index a66b7913..877a860b 100644 --- a/src/server/BlockFactory.hpp +++ b/src/server/BlockFactory.hpp @@ -20,8 +20,8 @@ #include <map> #include "ingen/World.hpp" +#include "ingen/types.hpp" #include "raul/Noncopyable.hpp" -#include "raul/SharedPtr.hpp" #include "raul/URI.hpp" namespace Ingen { @@ -51,10 +51,10 @@ private: void load_lv2_plugins(); void load_internal_plugins(); - Plugins _plugins; - Ingen::World* _world; - SharedPtr<LV2Info> _lv2_info; - bool _has_loaded; + Plugins _plugins; + Ingen::World* _world; + SPtr<LV2Info> _lv2_info; + bool _has_loaded; }; } // namespace Server diff --git a/src/server/Broadcaster.cpp b/src/server/Broadcaster.cpp index 49bc68ae..f3bc96f7 100644 --- a/src/server/Broadcaster.cpp +++ b/src/server/Broadcaster.cpp @@ -35,8 +35,8 @@ Broadcaster::~Broadcaster() /** Register a client to receive messages over the notification band. */ void -Broadcaster::register_client(const Raul::URI& uri, - SharedPtr<Interface> client) +Broadcaster::register_client(const Raul::URI& uri, + SPtr<Interface> client) { Glib::Mutex::Lock lock(_clients_mutex); _clients[uri] = client; @@ -57,7 +57,7 @@ Broadcaster::unregister_client(const Raul::URI& uri) /** Looks up the client with the given source @a uri (which is used as the * unique identifier for registered clients). */ -SharedPtr<Interface> +SPtr<Interface> Broadcaster::client(const Raul::URI& uri) { Glib::Mutex::Lock lock(_clients_mutex); @@ -65,7 +65,7 @@ Broadcaster::client(const Raul::URI& uri) if (i != _clients.end()) { return (*i).second; } else { - return SharedPtr<Interface>(); + return SPtr<Interface>(); } } diff --git a/src/server/Broadcaster.hpp b/src/server/Broadcaster.hpp index 33b438e5..3162742b 100644 --- a/src/server/Broadcaster.hpp +++ b/src/server/Broadcaster.hpp @@ -23,9 +23,8 @@ #include <glibmm/thread.h> -#include "raul/SharedPtr.hpp" - #include "ingen/Interface.hpp" +#include "ingen/types.hpp" #include "BlockFactory.hpp" @@ -45,7 +44,7 @@ public: Broadcaster() : _bundle_depth(0) {} ~Broadcaster(); - void register_client(const Raul::URI& uri, SharedPtr<Interface> client); + void register_client(const Raul::URI& uri, SPtr<Interface> client); bool unregister_client(const Raul::URI& uri); /** A handle that represents a transfer of possibly several changes. @@ -68,7 +67,7 @@ public: Broadcaster& broadcaster; }; - SharedPtr<Interface> client(const Raul::URI& uri); + SPtr<Interface> client(const Raul::URI& uri); void send_plugins(const BlockFactory::Plugins& plugin_list); void send_plugins_to(Interface*, const BlockFactory::Plugins& plugin_list); @@ -134,7 +133,7 @@ public: private: friend class Transfer; - typedef std::map< Raul::URI, SharedPtr<Interface> > Clients; + typedef std::map< Raul::URI, SPtr<Interface> > Clients; Glib::Mutex _clients_mutex; Clients _clients; diff --git a/src/server/Buffer.hpp b/src/server/Buffer.hpp index 56325f16..14984de4 100644 --- a/src/server/Buffer.hpp +++ b/src/server/Buffer.hpp @@ -22,10 +22,10 @@ #include <boost/utility.hpp> +#include "ingen/types.hpp" #include "lv2/lv2plug.in/ns/ext/atom/atom.h" #include "lv2/lv2plug.in/ns/ext/urid/urid.h" #include "raul/Deletable.hpp" -#include "raul/SharedPtr.hpp" #include "BufferFactory.hpp" #include "PortType.hpp" diff --git a/src/server/BufferFactory.hpp b/src/server/BufferFactory.hpp index 82180308..8c0f5db9 100644 --- a/src/server/BufferFactory.hpp +++ b/src/server/BufferFactory.hpp @@ -23,11 +23,11 @@ #undef nil #include <glibmm/thread.h> -#include "raul/Atom.hpp" -#include "raul/RingBuffer.hpp" -#include "raul/SharedPtr.hpp" #include "ingen/Forge.hpp" #include "ingen/URIs.hpp" +#include "ingen/types.hpp" +#include "raul/Atom.hpp" +#include "raul/RingBuffer.hpp" #include "BufferRef.hpp" #include "PortType.hpp" diff --git a/src/server/CompiledGraph.hpp b/src/server/CompiledGraph.hpp index ee02a24e..21b93058 100644 --- a/src/server/CompiledGraph.hpp +++ b/src/server/CompiledGraph.hpp @@ -20,7 +20,7 @@ #include <vector> #include <list> -#include "raul/Disposable.hpp" +#include "raul/Maid.hpp" #include "raul/Noncopyable.hpp" namespace Ingen { @@ -63,7 +63,7 @@ private: * before its providers, using this order as well as semaphores. */ class CompiledGraph : public std::vector<CompiledBlock> - , public Raul::Disposable + , public Raul::Maid::Disposable , public Raul::Noncopyable { }; diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp index 25d49265..634c568a 100644 --- a/src/server/ControlBindings.cpp +++ b/src/server/ControlBindings.cpp @@ -350,13 +350,13 @@ ControlBindings::bind(ProcessContext& context, Key key) return true; } -SharedPtr<ControlBindings::Bindings> +SPtr<ControlBindings::Bindings> ControlBindings::remove(const Raul::Path& path) { ThreadManager::assert_thread(THREAD_PRE_PROCESS); - SharedPtr<Bindings> old_bindings(_bindings); - SharedPtr<Bindings> copy(new Bindings(*_bindings.get())); + SPtr<Bindings> old_bindings(_bindings); + SPtr<Bindings> copy(new Bindings(*_bindings.get())); for (Bindings::iterator i = copy->begin(); i != copy->end();) { Bindings::iterator next = i; @@ -372,13 +372,13 @@ ControlBindings::remove(const Raul::Path& path) return old_bindings; } -SharedPtr<ControlBindings::Bindings> +SPtr<ControlBindings::Bindings> ControlBindings::remove(PortImpl* port) { ThreadManager::assert_thread(THREAD_PRE_PROCESS); - SharedPtr<Bindings> old_bindings(_bindings); - SharedPtr<Bindings> copy(new Bindings(*_bindings.get())); + SPtr<Bindings> old_bindings(_bindings); + SPtr<Bindings> copy(new Bindings(*_bindings.get())); for (Bindings::iterator i = copy->begin(); i != copy->end();) { Bindings::iterator next = i; @@ -397,8 +397,8 @@ ControlBindings::remove(PortImpl* port) void ControlBindings::pre_process(ProcessContext& context, Buffer* buffer) { - uint16_t value = 0; - SharedPtr<Bindings> bindings = _bindings; + uint16_t value = 0; + SPtr<Bindings> bindings = _bindings; _feedback->clear(); Ingen::World* world = context.engine().world(); diff --git a/src/server/ControlBindings.hpp b/src/server/ControlBindings.hpp index 630ec18a..26e9dd93 100644 --- a/src/server/ControlBindings.hpp +++ b/src/server/ControlBindings.hpp @@ -20,10 +20,10 @@ #include <map> #include <stdint.h> +#include "ingen/types.hpp" #include "lv2/lv2plug.in/ns/ext/atom/forge.h" #include "raul/Atom.hpp" #include "raul/Path.hpp" -#include "raul/SharedPtr.hpp" #include "BufferFactory.hpp" @@ -82,13 +82,13 @@ public: * The caller must safely drop the returned reference in the * post-processing thread after at least one process thread has run. */ - SharedPtr<Bindings> remove(const Raul::Path& path); + SPtr<Bindings> remove(const Raul::Path& path); /** Remove binding for a particular port. * The caller must safely drop the returned reference in the * post-processing thread after at least one process thread has run. */ - SharedPtr<Bindings> remove(PortImpl* port); + SPtr<Bindings> remove(PortImpl* port); private: Key midi_event_key(uint16_t size, const uint8_t* buf, uint16_t& value); @@ -106,11 +106,11 @@ private: Type type, const Raul::Atom& value) const; - Engine& _engine; - PortImpl* _learn_port; - SharedPtr<Bindings> _bindings; - BufferRef _feedback; - LV2_Atom_Forge _forge; + Engine& _engine; + PortImpl* _learn_port; + SPtr<Bindings> _bindings; + BufferRef _feedback; + LV2_Atom_Forge _forge; }; } // namespace Server diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index 5002feca..165f6412 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -18,12 +18,12 @@ #include "events/CreatePort.hpp" #include "ingen/Configuration.hpp" +#include "ingen/Log.hpp" #include "ingen/Store.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" -#include "ingen/Log.hpp" +#include "ingen/types.hpp" #include "raul/Maid.hpp" -#include "raul/SharedPtr.hpp" #include "BlockFactory.hpp" #include "Broadcaster.hpp" @@ -68,7 +68,7 @@ Engine::Engine(Ingen::World* world) , _direct_driver(true) { if (!world->store()) { - world->set_store(SharedPtr<Ingen::Store>(new Store())); + world->set_store(SPtr<Ingen::Store>(new Store())); } _control_bindings = new ControlBindings(*this); @@ -82,16 +82,16 @@ Engine::~Engine() _root_graph = NULL; deactivate(); - const SharedPtr<Store> store = this->store(); + const SPtr<Store> store = this->store(); if (store) { for (auto& s : *store.get()) { - if (!PtrCast<NodeImpl>(s.second)->parent()) { + if (!dynamic_ptr_cast<NodeImpl>(s.second)->parent()) { s.second.reset(); } } } - _world->set_store(SharedPtr<Ingen::Store>()); + _world->set_store(SPtr<Ingen::Store>()); delete _maid; delete _pre_processor; @@ -109,7 +109,7 @@ Engine::~Engine() munlockall(); } -SharedPtr<Store> +SPtr<Store> Engine::store() const { return _world->store(); @@ -136,7 +136,7 @@ Engine::main_iteration() } void -Engine::set_driver(SharedPtr<Driver> driver) +Engine::set_driver(SPtr<Driver> driver) { _driver = driver; } @@ -174,7 +174,7 @@ execute_and_delete_event(ProcessContext& context, Event* ev) void Engine::init(double sample_rate, uint32_t block_length) { - set_driver(SharedPtr<Driver>(new DirectDriver(sample_rate, block_length))); + set_driver(SPtr<Driver>(new DirectDriver(sample_rate, block_length))); _direct_driver = true; } @@ -240,7 +240,7 @@ Engine::activate() Resource::Property(forge.make(32.0f), Resource::Graph::EXTERNAL))); - SharedPtr<Interface> respondee; + SPtr<Interface> respondee; execute_and_delete_event( context, new Events::CreatePort( *this, respondee, -1, 0, Raul::Path("/control_in"), @@ -340,7 +340,7 @@ Engine::process_events() } void -Engine::register_client(const Raul::URI& uri, SharedPtr<Interface> client) +Engine::register_client(const Raul::URI& uri, SPtr<Interface> client) { log().info(Raul::fmt("Registering client <%1%>\n") % uri.c_str()); _broadcaster->register_client(uri, client); diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp index 692fbee8..e7327ef4 100644 --- a/src/server/Engine.hpp +++ b/src/server/Engine.hpp @@ -21,7 +21,7 @@ #include "ingen/EngineBase.hpp" #include "ingen/Interface.hpp" -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" #include "ProcessContext.hpp" @@ -73,10 +73,10 @@ public: virtual void quit(); virtual bool main_iteration(); virtual void register_client(const Raul::URI& uri, - SharedPtr<Interface> client); + SPtr<Interface> client); virtual bool unregister_client(const Raul::URI& uri); - void set_driver(SharedPtr<Driver> driver); + void set_driver(SPtr<Driver> driver); SampleCount event_time(); @@ -106,25 +106,25 @@ public: ProcessContext& process_context() { return _process_context; } - SharedPtr<Store> store() const; + SPtr<Store> store() const; size_t event_queue_size() const; private: Ingen::World* _world; - BlockFactory* _block_factory; - Broadcaster* _broadcaster; - BufferFactory* _buffer_factory; - ControlBindings* _control_bindings; - SharedPtr<Driver> _driver; - EventWriter* _event_writer; - Raul::Maid* _maid; - SharedPtr<LV2Options> _options; - PreProcessor* _pre_processor; - PostProcessor* _post_processor; - GraphImpl* _root_graph; - Worker* _worker; + BlockFactory* _block_factory; + Broadcaster* _broadcaster; + BufferFactory* _buffer_factory; + ControlBindings* _control_bindings; + SPtr<Driver> _driver; + EventWriter* _event_writer; + Raul::Maid* _maid; + SPtr<LV2Options> _options; + PreProcessor* _pre_processor; + PostProcessor* _post_processor; + GraphImpl* _root_graph; + Worker* _worker; ProcessContext _process_context; diff --git a/src/server/Event.hpp b/src/server/Event.hpp index e2000d09..21af45c5 100644 --- a/src/server/Event.hpp +++ b/src/server/Event.hpp @@ -22,11 +22,11 @@ #include "raul/Deletable.hpp" #include "raul/Noncopyable.hpp" #include "raul/Path.hpp" -#include "raul/SharedPtr.hpp" #include "ingen/Interface.hpp" #include "ingen/Node.hpp" #include "ingen/Status.hpp" +#include "ingen/types.hpp" #include "types.hpp" @@ -81,7 +81,7 @@ public: Status status() const { return _status; } protected: - Event(Engine& engine, SharedPtr<Interface> client, int32_t id, FrameTime time) + Event(Engine& engine, SPtr<Interface> client, int32_t id, FrameTime time) : _engine(engine) , _next(NULL) , _request_client(client) @@ -122,13 +122,13 @@ protected: return _status; } - Engine& _engine; - std::atomic<Event*> _next; - SharedPtr<Interface> _request_client; - int32_t _request_id; - FrameTime _time; - Status _status; - std::string _err_subject; + Engine& _engine; + std::atomic<Event*> _next; + SPtr<Interface> _request_client; + int32_t _request_id; + FrameTime _time; + Status _status; + std::string _err_subject; }; } // namespace Server diff --git a/src/server/EventWriter.hpp b/src/server/EventWriter.hpp index 68f93cbd..6d0fd2d2 100644 --- a/src/server/EventWriter.hpp +++ b/src/server/EventWriter.hpp @@ -23,7 +23,7 @@ #include "ingen/Interface.hpp" #include "ingen/Resource.hpp" -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" #include "types.hpp" @@ -42,11 +42,11 @@ public: Raul::URI uri() const { return Raul::URI("ingen:/clients/event_writer"); } - virtual SharedPtr<Interface> respondee() const { + virtual SPtr<Interface> respondee() const { return _respondee; } - virtual void set_respondee(SharedPtr<Interface> respondee) { + virtual void set_respondee(SPtr<Interface> respondee) { _respondee = respondee; } @@ -89,9 +89,9 @@ public: virtual void error(const std::string& msg) {} ///< N/A protected: - Engine& _engine; - SharedPtr<Interface> _respondee; - int32_t _request_id; + Engine& _engine; + SPtr<Interface> _respondee; + int32_t _request_id; private: SampleCount now() const; diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp index 14af654c..081b5b16 100644 --- a/src/server/GraphImpl.cpp +++ b/src/server/GraphImpl.cpp @@ -198,7 +198,7 @@ GraphImpl::remove_block(BlockImpl& block) } void -GraphImpl::add_arc(SharedPtr<ArcImpl> a) +GraphImpl::add_arc(SPtr<ArcImpl> a) { ThreadManager::assert_thread(THREAD_PRE_PROCESS); _arcs.insert(make_pair(make_pair(a->tail(), a->head()), a)); @@ -207,17 +207,17 @@ GraphImpl::add_arc(SharedPtr<ArcImpl> a) /** Remove an arc. * Preprocessing thread only. */ -SharedPtr<ArcImpl> +SPtr<ArcImpl> GraphImpl::remove_arc(const PortImpl* tail, const PortImpl* dst_port) { ThreadManager::assert_thread(THREAD_PRE_PROCESS); Arcs::iterator i = _arcs.find(make_pair(tail, dst_port)); if (i != _arcs.end()) { - SharedPtr<ArcImpl> arc = PtrCast<ArcImpl>(i->second); + SPtr<ArcImpl> arc = dynamic_ptr_cast<ArcImpl>(i->second); _arcs.erase(i); return arc; } else { - return SharedPtr<ArcImpl>(); + return SPtr<ArcImpl>(); } } diff --git a/src/server/GraphImpl.hpp b/src/server/GraphImpl.hpp index 450318ba..b6f3cf73 100644 --- a/src/server/GraphImpl.hpp +++ b/src/server/GraphImpl.hpp @@ -128,10 +128,10 @@ public: void remove_port(DuplexPort& port); void clear_ports(); - void add_arc(SharedPtr<ArcImpl> arc); + void add_arc(SPtr<ArcImpl> arc); - SharedPtr<ArcImpl> remove_arc(const PortImpl* tail, - const PortImpl* head); + SPtr<ArcImpl> remove_arc(const PortImpl* tail, + const PortImpl* head); bool has_arc(const PortImpl* tail, const PortImpl* head) const; diff --git a/src/server/InputPort.hpp b/src/server/InputPort.hpp index faf323f0..1f82425e 100644 --- a/src/server/InputPort.hpp +++ b/src/server/InputPort.hpp @@ -22,7 +22,7 @@ #include <boost/intrusive/slist.hpp> -#include "raul/SharedPtr.hpp" +#include "ingen/types.hpp" #include "ArcImpl.hpp" #include "PortImpl.hpp" diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index 33d11e92..20abb787 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -473,9 +473,9 @@ JackDriver::_session_cb(jack_session_event_t* event) % jack_get_client_name(_client) % event->client_uuid).str(); - SharedPtr<Serialisation::Serialiser> serialiser = _engine.world()->serialiser(); + SPtr<Serialisation::Serialiser> serialiser = _engine.world()->serialiser(); if (serialiser) { - SharedPtr<Node> root(_engine.root_graph(), NullDeleter<Node>); + SPtr<Node> root(_engine.root_graph(), NullDeleter<Node>); serialiser->write_bundle(root, string("file://") + event->session_dir); } diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp index e334c1f9..1d05137b 100644 --- a/src/server/LV2Block.cpp +++ b/src/server/LV2Block.cpp @@ -69,7 +69,7 @@ LV2Block::~LV2Block() delete _instances; } -SharedPtr<LilvInstance> +SPtr<LilvInstance> LV2Block::make_instance(URIs& uris, SampleRate rate, uint32_t voice, @@ -82,7 +82,7 @@ LV2Block::make_instance(URIs& uris, parent_graph()->engine().log().error( Raul::fmt("Failed to instantiate <%1%>\n") % _lv2_plugin->uri().c_str()); - return SharedPtr<LilvInstance>(); + return SPtr<LilvInstance>(); } const LV2_Options_Interface* options_iface = (const LV2_Options_Interface*) @@ -134,7 +134,7 @@ LV2Block::make_instance(URIs& uris, parent_graph()->engine().log().error( Raul::fmt("%1% auto-morphed to unknown type %2%\n") % port->path().c_str() % type); - return SharedPtr<LilvInstance>(); + return SPtr<LilvInstance>(); } } else { parent_graph()->engine().log().error( @@ -145,7 +145,7 @@ LV2Block::make_instance(URIs& uris, } } - return SharedPtr<LilvInstance>(inst, lilv_instance_free); + return SPtr<LilvInstance>(inst, lilv_instance_free); } bool @@ -161,9 +161,9 @@ LV2Block::prepare_poly(BufferFactory& bufs, uint32_t poly) const SampleRate rate = bufs.engine().driver()->sample_rate(); assert(!_prepared_instances); - _prepared_instances = new Instances(poly, *_instances, SharedPtr<void>()); + _prepared_instances = new Instances(poly, *_instances, SPtr<void>()); for (uint32_t i = _polyphony; i < _prepared_instances->size(); ++i) { - SharedPtr<LilvInstance> inst = make_instance(bufs.uris(), rate, i, true); + SPtr<LilvInstance> inst = make_instance(bufs.uris(), rate, i, true); if (!inst) { return false; } @@ -206,7 +206,7 @@ bool LV2Block::instantiate(BufferFactory& bufs) { const Ingen::URIs& uris = bufs.uris(); - SharedPtr<LV2Info> info = _lv2_plugin->lv2_info(); + SPtr<LV2Info> info = _lv2_plugin->lv2_info(); const LilvPlugin* plug = _lv2_plugin->lilv_plugin(); Ingen::Forge& forge = bufs.forge(); const uint32_t num_ports = lilv_plugin_get_num_ports(plug); @@ -401,7 +401,7 @@ LV2Block::instantiate(BufferFactory& bufs) // Actually create plugin instances and port buffers. const SampleRate rate = bufs.engine().driver()->sample_rate(); - _instances = new Instances(_polyphony, SharedPtr<void>()); + _instances = new Instances(_polyphony, SPtr<void>()); for (uint32_t i = 0; i < _polyphony; ++i) { _instances->at(i) = make_instance(bufs.uris(), rate, i, false); if (!_instances->at(i)) { diff --git a/src/server/LV2Block.hpp b/src/server/LV2Block.hpp index 2e45d350..a9cf0afc 100644 --- a/src/server/LV2Block.hpp +++ b/src/server/LV2Block.hpp @@ -19,7 +19,7 @@ #include "lilv/lilv.h" #include "lv2/lv2plug.in/ns/ext/worker/worker.h" -#include "raul/Disposable.hpp" +#include "raul/Maid.hpp" #include "BufferRef.hpp" #include "BlockImpl.hpp" @@ -63,18 +63,18 @@ public: BufferRef buf); protected: - SharedPtr<LilvInstance> make_instance(URIs& uris, - SampleRate rate, - uint32_t voice, - bool preparing); + SPtr<LilvInstance> make_instance(URIs& uris, + SampleRate rate, + uint32_t voice, + bool preparing); inline LilvInstance* instance(uint32_t voice) { return (LilvInstance*)(*_instances)[voice].get(); } - typedef Raul::Array< SharedPtr<void> > Instances; + typedef Raul::Array< SPtr<void> > Instances; - struct Response : public Raul::Disposable + struct Response : public Raul::Maid::Disposable , public Raul::Noncopyable , public boost::intrusive::slist_base_hook<> { @@ -101,12 +101,12 @@ protected: static LV2_Worker_Status work_respond( LV2_Worker_Respond_Handle handle, uint32_t size, const void* data); - LV2Plugin* _lv2_plugin; - Instances* _instances; - Instances* _prepared_instances; - const LV2_Worker_Interface* _worker_iface; - Responses _responses; - SharedPtr<LV2Features::FeatureArray> _features; + LV2Plugin* _lv2_plugin; + Instances* _instances; + Instances* _prepared_instances; + const LV2_Worker_Interface* _worker_iface; + Responses _responses; + SPtr<LV2Features::FeatureArray> _features; }; } // namespace Server diff --git a/src/server/LV2Info.cpp b/src/server/LV2Info.cpp index 841ee0fd..1e4b2aec 100644 --- a/src/server/LV2Info.cpp +++ b/src/server/LV2Info.cpp @@ -51,7 +51,7 @@ LV2Info::LV2Info(Ingen::World* world) , _world(world) { world->lv2_features().add_feature( - SharedPtr<LV2Features::Feature>(new ResizeFeature())); + SPtr<LV2Features::Feature>(new ResizeFeature())); } LV2Info::~LV2Info() diff --git a/src/server/LV2Options.hpp b/src/server/LV2Options.hpp index 19ddfd4b..cc42d68c 100644 --- a/src/server/LV2Options.hpp +++ b/src/server/LV2Options.hpp @@ -51,10 +51,10 @@ struct LV2Options : public Ingen::LV2Features::Feature { const char* uri() const { return LV2_OPTIONS__options; } - SharedPtr<LV2_Feature> feature(World* w, Node* n) { + SPtr<LV2_Feature> feature(World* w, Node* n) { BlockImpl* block = dynamic_cast<BlockImpl*>(n); if (!block) { - return SharedPtr<LV2_Feature>(); + return SPtr<LV2_Feature>(); } Engine& engine = block->parent_graph()->engine(); URIs& uris = engine.world()->uris(); @@ -72,7 +72,7 @@ struct LV2Options : public Ingen::LV2Features::Feature { f->URI = LV2_OPTIONS__options; f->data = malloc(sizeof(options)); memcpy(f->data, options, sizeof(options)); - return SharedPtr<LV2_Feature>(f, &delete_feature); + return SPtr<LV2_Feature>(f, &delete_feature); } private: diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp index cc0aee4c..22e7e9c4 100644 --- a/src/server/LV2Plugin.cpp +++ b/src/server/LV2Plugin.cpp @@ -28,7 +28,7 @@ using namespace std; namespace Ingen { namespace Server { -LV2Plugin::LV2Plugin(SharedPtr<LV2Info> lv2_info, const Raul::URI& uri) +LV2Plugin::LV2Plugin(SPtr<LV2Info> lv2_info, const Raul::URI& uri) : PluginImpl(lv2_info->world().uris(), Plugin::LV2, uri) , _lilv_plugin(NULL) , _lv2_info(lv2_info) diff --git a/src/server/LV2Plugin.hpp b/src/server/LV2Plugin.hpp index bec1b588..1bd4822a 100644 --- a/src/server/LV2Plugin.hpp +++ b/src/server/LV2Plugin.hpp @@ -19,8 +19,8 @@ #include <cstdlib> +#include "ingen/types.hpp" #include "lilv/lilv.h" -#include "raul/SharedPtr.hpp" #include "raul/URI.hpp" #include "PluginImpl.hpp" @@ -37,7 +37,7 @@ class BlockImpl; class LV2Plugin : public PluginImpl { public: - LV2Plugin(SharedPtr<LV2Info> lv2_info, const Raul::URI& uri); + LV2Plugin(SPtr<LV2Info> lv2_info, const Raul::URI& uri); BlockImpl* instantiate(BufferFactory& bufs, const Raul::Symbol& symbol, @@ -47,14 +47,14 @@ public: const Raul::Symbol symbol() const; - SharedPtr<LV2Info> lv2_info() const { return _lv2_info; } + SPtr<LV2Info> lv2_info() const { return _lv2_info; } const LilvPlugin* lilv_plugin() const { return _lilv_plugin; } void lilv_plugin(const LilvPlugin* p); private: - const LilvPlugin* _lilv_plugin; - SharedPtr<LV2Info> _lv2_info; + const LilvPlugin* _lilv_plugin; + SPtr<LV2Info> _lv2_info; }; } // namespace Server diff --git a/src/server/LV2ResizeFeature.hpp b/src/server/LV2ResizeFeature.hpp index aeabe47a..6712c74b 100644 --- a/src/server/LV2ResizeFeature.hpp +++ b/src/server/LV2ResizeFeature.hpp @@ -49,10 +49,10 @@ struct ResizeFeature : public Ingen::LV2Features::Feature { const char* uri() const { return LV2_RESIZE_PORT_URI; } - SharedPtr<LV2_Feature> feature(World* w, Node* n) { + SPtr<LV2_Feature> feature(World* w, Node* n) { BlockImpl* block = dynamic_cast<BlockImpl*>(n); if (!block) - return SharedPtr<LV2_Feature>(); + return SPtr<LV2_Feature>(); LV2_Resize_Port_Resize* data = (LV2_Resize_Port_Resize*)malloc(sizeof(LV2_Resize_Port_Resize)); data->data = block; @@ -60,7 +60,7 @@ struct ResizeFeature : public Ingen::LV2Features::Feature { LV2_Feature* f = (LV2_Feature*)malloc(sizeof(LV2_Feature)); f->URI = LV2_RESIZE_PORT_URI; f->data = data; - return SharedPtr<LV2_Feature>(f, &delete_feature); + return SPtr<LV2_Feature>(f, &delete_feature); } }; diff --git a/src/server/NodeImpl.hpp b/src/server/NodeImpl.hpp index 937d4dea..60aa2d3d 100644 --- a/src/server/NodeImpl.hpp +++ b/src/server/NodeImpl.hpp @@ -25,7 +25,6 @@ #include "ingen/Resource.hpp" #include "raul/Deletable.hpp" #include "raul/Path.hpp" -#include "raul/SharedPtr.hpp" namespace Raul { class Maid; } diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp index 5bf20609..8afc8a20 100644 --- a/src/server/Worker.cpp +++ b/src/server/Worker.cpp @@ -79,12 +79,12 @@ delete_feature(LV2_Feature* feature) free(feature); } -SharedPtr<LV2_Feature> +SPtr<LV2_Feature> Worker::Schedule::feature(World* world, Node* n) { LV2Block* block = dynamic_cast<LV2Block*>(n); if (!block) { - return SharedPtr<LV2_Feature>(); + return SPtr<LV2_Feature>(); } LV2_Worker_Schedule* data = (LV2_Worker_Schedule*)malloc( @@ -96,7 +96,7 @@ Worker::Schedule::feature(World* world, Node* n) f->URI = LV2_WORKER__schedule; f->data = data; - return SharedPtr<LV2_Feature>(f, &delete_feature); + return SPtr<LV2_Feature>(f, &delete_feature); } diff --git a/src/server/Worker.hpp b/src/server/Worker.hpp index 69597439..b90e117e 100644 --- a/src/server/Worker.hpp +++ b/src/server/Worker.hpp @@ -40,17 +40,17 @@ public: struct Schedule : public LV2Features::Feature { const char* uri() const { return LV2_WORKER__schedule; } - SharedPtr<LV2_Feature> feature(World* world, Node* n); + SPtr<LV2_Feature> feature(World* world, Node* n); }; LV2_Worker_Status request(LV2Block* block, uint32_t size, const void* data); - SharedPtr<Schedule> schedule_feature() { return _schedule; } + SPtr<Schedule> schedule_feature() { return _schedule; } private: - SharedPtr<Schedule> _schedule; + SPtr<Schedule> _schedule; Log& _log; Raul::Semaphore _sem; diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index cbdb67c5..4c4a3974 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -34,12 +34,12 @@ namespace Ingen { namespace Server { namespace Events { -Connect::Connect(Engine& engine, - SharedPtr<Interface> client, - int32_t id, - SampleCount timestamp, - const Raul::Path& tail_path, - const Raul::Path& head_path) +Connect::Connect(Engine& engine, + SPtr<Interface> client, + int32_t id, + SampleCount timestamp, + const Raul::Path& tail_path, + const Raul::Path& head_path) : Event(engine, client, id, timestamp) , _tail_path(tail_path) , _head_path(head_path) @@ -106,7 +106,7 @@ Connect::pre_process() return Event::pre_process_done(Status::EXISTS, _head_path); } - _arc = SharedPtr<ArcImpl>(new ArcImpl(tail_output, _head)); + _arc = SPtr<ArcImpl>(new ArcImpl(tail_output, _head)); rlock.release(); diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp index a84b9fcf..4b515087 100644 --- a/src/server/events/Connect.hpp +++ b/src/server/events/Connect.hpp @@ -45,12 +45,12 @@ namespace Events { class Connect : public Event { public: - Connect(Engine& engine, - SharedPtr<Interface> client, - int32_t id, - SampleCount timestamp, - const Raul::Path& tail, - const Raul::Path& head); + Connect(Engine& engine, + SPtr<Interface> client, + int32_t id, + SampleCount timestamp, + const Raul::Path& tail, + const Raul::Path& head); bool pre_process(); void execute(ProcessContext& context); @@ -62,7 +62,7 @@ private: GraphImpl* _graph; InputPort* _head; CompiledGraph* _compiled_graph; - SharedPtr<ArcImpl> _arc; + SPtr<ArcImpl> _arc; Raul::Array<BufferRef>* _buffers; }; diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index 90a76c1d..63b05b58 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -33,7 +33,7 @@ namespace Server { namespace Events { CreateBlock::CreateBlock(Engine& engine, - SharedPtr<Interface> client, + SPtr<Interface> client, int32_t id, SampleCount timestamp, const Raul::Path& path, diff --git a/src/server/events/CreateBlock.hpp b/src/server/events/CreateBlock.hpp index 4b706e53..36e35775 100644 --- a/src/server/events/CreateBlock.hpp +++ b/src/server/events/CreateBlock.hpp @@ -41,7 +41,7 @@ class CreateBlock : public Event { public: CreateBlock(Engine& engine, - SharedPtr<Interface> client, + SPtr<Interface> client, int32_t id, SampleCount timestamp, const Raul::Path& block_path, diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp index f2131246..8ab05a2e 100644 --- a/src/server/events/CreateGraph.cpp +++ b/src/server/events/CreateGraph.cpp @@ -30,7 +30,7 @@ namespace Server { namespace Events { CreateGraph::CreateGraph(Engine& engine, - SharedPtr<Interface> client, + SPtr<Interface> client, int32_t id, SampleCount timestamp, const Raul::Path& path, diff --git a/src/server/events/CreateGraph.hpp b/src/server/events/CreateGraph.hpp index 0f6a95dd..64fb92bd 100644 --- a/src/server/events/CreateGraph.hpp +++ b/src/server/events/CreateGraph.hpp @@ -36,7 +36,7 @@ class CreateGraph : public Event { public: CreateGraph(Engine& engine, - SharedPtr<Interface> client, + SPtr<Interface> client, int32_t id, SampleCount timestamp, const Raul::Path& path, diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index 818b0438..2e3e4d42 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -37,7 +37,7 @@ namespace Server { namespace Events { CreatePort::CreatePort(Engine& engine, - SharedPtr<Interface> client, + SPtr<Interface> client, int32_t id, SampleCount timestamp, const Raul::Path& path, diff --git a/src/server/events/CreatePort.hpp b/src/server/events/CreatePort.hpp index d35b58af..d5e2b29c 100644 --- a/src/server/events/CreatePort.hpp +++ b/src/server/events/CreatePort.hpp @@ -43,7 +43,7 @@ class CreatePort : public Event { public: CreatePort(Engine& engine, - SharedPtr<Interface> client, + SPtr<Interface> client, int32_t id, SampleCount timestamp, const Raul::Path& path, diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index bcfb209a..f21e0faf 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -34,11 +34,11 @@ namespace Ingen { namespace Server { namespace Events { -Delete::Delete(Engine& engine, - SharedPtr<Interface> client, - int32_t id, - FrameTime time, - const Raul::URI& uri) +Delete::Delete(Engine& engine, + SPtr<Interface> client, + int32_t id, + FrameTime time, + const Raul::URI& uri) : Event(engine, client, id, time) , _uri(uri) , _engine_port(NULL) @@ -73,8 +73,8 @@ Delete::pre_process() return Event::pre_process_done(Status::NOT_FOUND, _path); } - if (!(_block = PtrCast<BlockImpl>(iter->second))) { - _port = PtrCast<DuplexPort>(iter->second); + if (!(_block = dynamic_ptr_cast<BlockImpl>(iter->second))) { + _port = dynamic_ptr_cast<DuplexPort>(iter->second); } if (!_block && !_port) { diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp index 74046f82..3cf9a2dc 100644 --- a/src/server/events/Delete.hpp +++ b/src/server/events/Delete.hpp @@ -57,11 +57,11 @@ class DisconnectAll; class Delete : public Event { public: - Delete(Engine& engine, - SharedPtr<Interface> client, - int32_t id, - FrameTime timestamp, - const Raul::URI& uri); + Delete(Engine& engine, + SPtr<Interface> client, + int32_t id, + FrameTime timestamp, + const Raul::URI& uri); ~Delete(); @@ -70,17 +70,17 @@ public: void post_process(); private: - Raul::URI _uri; - Raul::Path _path; - SharedPtr<BlockImpl> _block; ///< Non-NULL iff a block - SharedPtr<DuplexPort> _port; ///< Non-NULL iff a port - EnginePort* _engine_port; - Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports for Graph - CompiledGraph* _compiled_graph; ///< Graph's new process order - DisconnectAll* _disconnect_event; - - SharedPtr<ControlBindings::Bindings> _removed_bindings; - Store::Objects _removed_objects; + Raul::URI _uri; + Raul::Path _path; + SPtr<BlockImpl> _block; ///< Non-NULL iff a block + SPtr<DuplexPort> _port; ///< Non-NULL iff a port + EnginePort* _engine_port; + Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports for Graph + CompiledGraph* _compiled_graph; ///< Graph's new process order + DisconnectAll* _disconnect_event; + + SPtr<ControlBindings::Bindings> _removed_bindings; + Store::Objects _removed_objects; Glib::RWLock::WriterLock _lock; }; diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 352aa56c..c7836ebd 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -44,15 +44,15 @@ namespace Events { typedef Resource::Properties Properties; -Delta::Delta(Engine& engine, - SharedPtr<Interface> client, - int32_t id, - SampleCount timestamp, - bool create, - Resource::Graph context, - const Raul::URI& subject, - const Properties& properties, - const Properties& remove) +Delta::Delta(Engine& engine, + SPtr<Interface> client, + int32_t id, + SampleCount timestamp, + bool create, + Resource::Graph context, + const Raul::URI& subject, + const Properties& properties, + const Properties& remove) : Event(engine, client, id, timestamp) , _create_event(NULL) , _subject(subject) diff --git a/src/server/events/Delta.hpp b/src/server/events/Delta.hpp index 34319591..7e3f5257 100644 --- a/src/server/events/Delta.hpp +++ b/src/server/events/Delta.hpp @@ -70,7 +70,7 @@ class Delta : public Event { public: Delta(Engine& engine, - SharedPtr<Interface> client, + SPtr<Interface> client, int32_t id, SampleCount timestamp, bool create, @@ -111,7 +111,7 @@ private: ControlBindings::Key _binding; bool _create; - SharedPtr<ControlBindings::Bindings> _old_bindings; + SPtr<ControlBindings::Bindings> _old_bindings; }; } // namespace Events diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index 874e0d99..a7f31316 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -39,12 +39,12 @@ namespace Ingen { namespace Server { namespace Events { -Disconnect::Disconnect(Engine& engine, - SharedPtr<Interface> client, - int32_t id, - SampleCount timestamp, - const Raul::Path& tail_path, - const Raul::Path& head_path) +Disconnect::Disconnect(Engine& engine, + SPtr<Interface> client, + int32_t id, + SampleCount timestamp, + const Raul::Path& tail_path, + const Raul::Path& head_path) : Event(engine, client, id, timestamp) , _tail_path(tail_path) , _head_path(head_path) diff --git a/src/server/events/Disconnect.hpp b/src/server/events/Disconnect.hpp index b0c9408c..58efba9f 100644 --- a/src/server/events/Disconnect.hpp +++ b/src/server/events/Disconnect.hpp @@ -45,12 +45,12 @@ namespace Events { class Disconnect : public Event { public: - Disconnect(Engine& engine, - SharedPtr<Interface> client, - int32_t id, - SampleCount timestamp, - const Raul::Path& tail_path, - const Raul::Path& head_path); + Disconnect(Engine& engine, + SPtr<Interface> client, + int32_t id, + SampleCount timestamp, + const Raul::Path& tail_path, + const Raul::Path& head_path); bool pre_process(); void execute(ProcessContext& context); @@ -72,7 +72,7 @@ public: OutputPort* _src_output_port; InputPort* _dst_input_port; GraphImpl* _graph; - SharedPtr<ArcImpl> _arc; + SPtr<ArcImpl> _arc; Raul::Array<BufferRef>* _buffers; }; diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index a3df4e77..c366508b 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -40,12 +40,12 @@ namespace Ingen { namespace Server { namespace Events { -DisconnectAll::DisconnectAll(Engine& engine, - SharedPtr<Interface> client, - int32_t id, - SampleCount timestamp, - const Raul::Path& parent_path, - const Raul::Path& path) +DisconnectAll::DisconnectAll(Engine& engine, + SPtr<Interface> client, + int32_t id, + SampleCount timestamp, + const Raul::Path& parent_path, + const Raul::Path& path) : Event(engine, client, id, timestamp) , _parent_path(parent_path) , _path(path) diff --git a/src/server/events/DisconnectAll.hpp b/src/server/events/DisconnectAll.hpp index 7db53bfa..43c3ec2b 100644 --- a/src/server/events/DisconnectAll.hpp +++ b/src/server/events/DisconnectAll.hpp @@ -43,12 +43,12 @@ class Disconnect; class DisconnectAll : public Event { public: - DisconnectAll(Engine& engine, - SharedPtr<Interface> client, - int32_t id, - SampleCount timestamp, - const Raul::Path& parent, - const Raul::Path& object); + DisconnectAll(Engine& engine, + SPtr<Interface> client, + int32_t id, + SampleCount timestamp, + const Raul::Path& parent, + const Raul::Path& object); DisconnectAll(Engine& engine, GraphImpl* parent, diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index f16654f7..9a5dd1fa 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -37,11 +37,11 @@ namespace Events { static void send_graph(Interface* client, const GraphImpl* graph); -Get::Get(Engine& engine, - SharedPtr<Interface> client, - int32_t id, - SampleCount timestamp, - const Raul::URI& uri) +Get::Get(Engine& engine, + SPtr<Interface> client, + int32_t id, + SampleCount timestamp, + const Raul::URI& uri) : Event(engine, client, id, timestamp) , _uri(uri) , _object(NULL) diff --git a/src/server/events/Get.hpp b/src/server/events/Get.hpp index 12f48b09..7a5830a3 100644 --- a/src/server/events/Get.hpp +++ b/src/server/events/Get.hpp @@ -37,11 +37,11 @@ namespace Events { class Get : public Event { public: - Get(Engine& engine, - SharedPtr<Interface> client, - int32_t id, - SampleCount timestamp, - const Raul::URI& uri); + Get(Engine& engine, + SPtr<Interface> client, + int32_t id, + SampleCount timestamp, + const Raul::URI& uri); bool pre_process(); void execute(ProcessContext& context) {} diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp index 700d5814..44939525 100644 --- a/src/server/events/Move.cpp +++ b/src/server/events/Move.cpp @@ -31,12 +31,12 @@ namespace Ingen { namespace Server { namespace Events { -Move::Move(Engine& engine, - SharedPtr<Interface> client, - int32_t id, - SampleCount timestamp, - const Raul::Path& path, - const Raul::Path& new_path) +Move::Move(Engine& engine, + SPtr<Interface> client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + const Raul::Path& new_path) : Event(engine, client, id, timestamp) , _old_path(path) , _new_path(new_path) diff --git a/src/server/events/Move.hpp b/src/server/events/Move.hpp index 6e30cba6..666ad7bd 100644 --- a/src/server/events/Move.hpp +++ b/src/server/events/Move.hpp @@ -46,12 +46,12 @@ namespace Events { class Move : public Event { public: - Move(Engine& engine, - SharedPtr<Interface> client, - int32_t id, - SampleCount timestamp, - const Raul::Path& old_path, - const Raul::Path& new_path); + Move(Engine& engine, + SPtr<Interface> client, + int32_t id, + SampleCount timestamp, + const Raul::Path& old_path, + const Raul::Path& new_path); ~Move(); diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp index f2399d8e..edef9e8c 100644 --- a/src/server/events/SetPortValue.cpp +++ b/src/server/events/SetPortValue.cpp @@ -34,12 +34,12 @@ namespace Server { namespace Events { /** Internal */ -SetPortValue::SetPortValue(Engine& engine, - SharedPtr<Interface> client, - int32_t id, - SampleCount timestamp, - PortImpl* port, - const Raul::Atom& value) +SetPortValue::SetPortValue(Engine& engine, + SPtr<Interface> client, + int32_t id, + SampleCount timestamp, + PortImpl* port, + const Raul::Atom& value) : Event(engine, client, id, timestamp) , _port(port) , _value(value) diff --git a/src/server/events/SetPortValue.hpp b/src/server/events/SetPortValue.hpp index a82553f5..32e8f768 100644 --- a/src/server/events/SetPortValue.hpp +++ b/src/server/events/SetPortValue.hpp @@ -37,12 +37,12 @@ namespace Events { class SetPortValue : public Event { public: - SetPortValue(Engine& engine, - SharedPtr<Interface> client, - int32_t id, - SampleCount timestamp, - PortImpl* port, - const Raul::Atom& value); + SetPortValue(Engine& engine, + SPtr<Interface> client, + int32_t id, + SampleCount timestamp, + PortImpl* port, + const Raul::Atom& value); ~SetPortValue(); diff --git a/src/server/ingen_engine.cpp b/src/server/ingen_engine.cpp index b020e28b..cd470f44 100644 --- a/src/server/ingen_engine.cpp +++ b/src/server/ingen_engine.cpp @@ -25,10 +25,11 @@ using namespace Ingen; struct IngenEngineModule : public Ingen::Module { virtual void load(Ingen::World* world) { Server::set_denormal_flags(world->log()); - SharedPtr<Server::Engine> engine(new Server::Engine(world)); + SPtr<Server::Engine> engine(new Server::Engine(world)); world->set_engine(engine); if (!world->interface()) { - world->set_interface(SharedPtr<Interface>(engine->interface(), NullDeleter<Interface>)); + world->set_interface( + SPtr<Interface>(engine->interface(), NullDeleter<Interface>)); } } }; diff --git a/src/server/ingen_jack.cpp b/src/server/ingen_jack.cpp index f273a209..9ebb0481 100644 --- a/src/server/ingen_jack.cpp +++ b/src/server/ingen_jack.cpp @@ -44,7 +44,7 @@ struct IngenJackModule : public Ingen::Module { world->conf().option("jack-name").get_string(), NULL); ((Server::Engine*)world->engine().get())->set_driver( - SharedPtr<Server::Driver>(driver)); + SPtr<Server::Driver>(driver)); } }; diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index e866ea0e..e6fab92a 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -42,8 +42,8 @@ #include "ingen/runtime_paths.hpp" #include "ingen/serialisation/Parser.hpp" #include "ingen/serialisation/Serialiser.hpp" +#include "ingen/types.hpp" #include "raul/Semaphore.hpp" -#include "raul/SharedPtr.hpp" #include "raul/Thread.hpp" #include "Buffer.hpp" @@ -74,7 +74,7 @@ class Lib { public: explicit Lib(const char* bundle_path); - typedef std::vector< SharedPtr<const LV2Graph> > Graphs; + typedef std::vector< Ingen::SPtr<const LV2Graph> > Graphs; Graphs graphs; }; @@ -401,8 +401,8 @@ using namespace Ingen::Server; class MainThread : public Raul::Thread { public: - explicit MainThread(SharedPtr<Engine> engine, - LV2Driver* driver) + explicit MainThread(SPtr<Engine> engine, + LV2Driver* driver) : Raul::Thread() , _engine(engine) , _driver(driver) @@ -424,8 +424,8 @@ private: } } - SharedPtr<Engine> _engine; - LV2Driver* _driver; + SPtr<Engine> _engine; + LV2Driver* _driver; }; struct IngenPlugin { @@ -466,8 +466,9 @@ find_graphs(const Glib::ustring& manifest_uri) if (!f.end()) { const uint8_t* file_uri = f.get_object().to_u_string(); uint8_t* file_path = serd_file_uri_parse(file_uri, NULL); - graphs.push_back(boost::shared_ptr<const LV2Graph>( - new LV2Graph(graph_uri, (const char*)file_path))); + graphs.push_back( + SPtr<const LV2Graph>( + new LV2Graph(graph_uri, (const char*)file_path))); free(file_path); } } @@ -568,11 +569,11 @@ ingen_instantiate(const LV2_Descriptor* descriptor, "queue-size", plugin->world->forge().make(std::max(block_length, seq_size) * 4)); - SharedPtr<Server::Engine> engine(new Server::Engine(plugin->world)); + SPtr<Server::Engine> engine(new Server::Engine(plugin->world)); plugin->world->set_engine(engine); - SharedPtr<EventWriter> interface = - SharedPtr<EventWriter>(engine->interface(), NullDeleter<EventWriter>); + SPtr<EventWriter> interface = SPtr<EventWriter>(engine->interface(), + NullDeleter<EventWriter>); plugin->world->set_interface(interface); @@ -580,7 +581,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor, Server::ThreadManager::single_threaded = true; LV2Driver* driver = new LV2Driver(*engine.get(), block_length, rate); - engine->set_driver(SharedPtr<Ingen::Server::Driver>(driver)); + engine->set_driver(SPtr<Ingen::Server::Driver>(driver)); plugin->main = new MainThread(engine, driver); @@ -604,7 +605,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor, /* Register client after loading graph so the to-ui ring does not overflow. Since we are not yet rolling, it won't be drained, causing a deadlock. */ - SharedPtr<Interface> client(&driver->writer(), NullDeleter<Interface>); + SPtr<Interface> client(&driver->writer(), NullDeleter<Interface>); interface->set_respondee(client); engine->register_client(Raul::URI("ingen:/clients/lv2"), client); @@ -660,8 +661,8 @@ static void ingen_cleanup(LV2_Handle instance) { IngenPlugin* me = (IngenPlugin*)instance; - me->world->set_engine(SharedPtr<Ingen::Server::Engine>()); - me->world->set_interface(SharedPtr<Ingen::Interface>()); + me->world->set_engine(SPtr<Ingen::Server::Engine>()); + me->world->set_interface(SPtr<Ingen::Interface>()); delete me->world; delete me; } diff --git a/src/socket/Socket.cpp b/src/socket/Socket.cpp index 2de88226..689e7eb6 100644 --- a/src/socket/Socket.cpp +++ b/src/socket/Socket.cpp @@ -21,6 +21,7 @@ #include <stdlib.h> #include <sys/socket.h> #include <sys/un.h> +#include <unistd.h> #include <string> @@ -142,7 +143,7 @@ Socket::listen() } } -SharedPtr<Socket> +SPtr<Socket> Socket::accept() { socklen_t client_addr_len = _addr_len; @@ -151,7 +152,7 @@ Socket::accept() int conn = ::accept(_sock, client_addr, &client_addr_len); if (conn == -1) { - return SharedPtr<Socket>(); + return SPtr<Socket>(); } Raul::URI client_uri = _uri; @@ -161,7 +162,7 @@ Socket::accept() client_uri = Raul::URI(_uri.scheme() + "://" + host); } - return SharedPtr<Socket>( + return SPtr<Socket>( new Socket(_type, client_uri, client_addr, client_addr_len, conn)); } diff --git a/src/socket/Socket.hpp b/src/socket/Socket.hpp index ed2ddb74..ebe9f68f 100644 --- a/src/socket/Socket.hpp +++ b/src/socket/Socket.hpp @@ -21,9 +21,10 @@ #include <sys/socket.h> #include "raul/Noncopyable.hpp" -#include "raul/SharedPtr.hpp" #include "raul/URI.hpp" +#include "ingen/types.hpp" + namespace Ingen { namespace Socket { @@ -71,7 +72,7 @@ public: /** Accept a connection. * @return An new open socket for the connection. */ - SharedPtr<Socket> accept(); + SPtr<Socket> accept(); /** Return the file descriptor for the socket. */ int fd() { return _sock; } diff --git a/src/socket/SocketClient.hpp b/src/socket/SocketClient.hpp index 14227c90..b05cb343 100644 --- a/src/socket/SocketClient.hpp +++ b/src/socket/SocketClient.hpp @@ -27,10 +27,10 @@ namespace Socket { class SocketClient : public SocketWriter { public: - SocketClient(World& world, - const Raul::URI& uri, - SharedPtr<Socket> sock, - SharedPtr<Interface> respondee) + SocketClient(World& world, + const Raul::URI& uri, + SPtr<Socket> sock, + SPtr<Interface> respondee) : SocketWriter(world.uri_map(), world.uris(), uri, sock) , _respondee(respondee) , _reader(world, *respondee.get(), sock) @@ -38,17 +38,17 @@ public: _reader.start(); } - virtual SharedPtr<Interface> respondee() const { + virtual SPtr<Interface> respondee() const { return _respondee; } - virtual void set_respondee(SharedPtr<Interface> respondee) { + virtual void set_respondee(SPtr<Interface> respondee) { _respondee = respondee; } private: - SharedPtr<Interface> _respondee; - SocketReader _reader; + SPtr<Interface> _respondee; + SocketReader _reader; }; } // namespace Socket diff --git a/src/socket/SocketListener.cpp b/src/socket/SocketListener.cpp index 0628b7a5..4e1f9512 100644 --- a/src/socket/SocketListener.cpp +++ b/src/socket/SocketListener.cpp @@ -109,14 +109,14 @@ SocketListener::_run() } if (pfds[0].revents & POLLIN) { - SharedPtr<Socket> conn = _unix_sock.accept(); + SPtr<Socket> conn = _unix_sock.accept(); if (conn) { new SocketServer(_world, *engine, conn); } } if (pfds[1].revents & POLLIN) { - SharedPtr<Socket> conn = _net_sock.accept(); + SPtr<Socket> conn = _net_sock.accept(); if (conn) { new SocketServer(_world, *engine, conn); } diff --git a/src/socket/SocketListener.hpp b/src/socket/SocketListener.hpp index c4700ed4..bea55da2 100644 --- a/src/socket/SocketListener.hpp +++ b/src/socket/SocketListener.hpp @@ -16,7 +16,6 @@ #include <string> -#include "raul/SharedPtr.hpp" #include "raul/Thread.hpp" #include "Socket.hpp" diff --git a/src/socket/SocketReader.cpp b/src/socket/SocketReader.cpp index cc5da947..4ff65b3b 100644 --- a/src/socket/SocketReader.cpp +++ b/src/socket/SocketReader.cpp @@ -30,9 +30,9 @@ namespace Ingen { namespace Socket { -SocketReader::SocketReader(Ingen::World& world, - Interface& iface, - SharedPtr<Socket> sock) +SocketReader::SocketReader(Ingen::World& world, + Interface& iface, + SPtr<Socket> sock) : Raul::Thread() , _world(world) , _iface(iface) diff --git a/src/socket/SocketReader.hpp b/src/socket/SocketReader.hpp index 51435368..ea2bcd8e 100644 --- a/src/socket/SocketReader.hpp +++ b/src/socket/SocketReader.hpp @@ -33,9 +33,9 @@ namespace Socket { class SocketReader : public Raul::Thread { public: - SocketReader(World& world, - Interface& iface, - SharedPtr<Socket> sock); + SocketReader(World& world, + Interface& iface, + SPtr<Socket> sock); ~SocketReader(); @@ -58,12 +58,12 @@ private: const SerdNode* object_datatype, const SerdNode* object_lang); - World& _world; - Interface& _iface; - SerdEnv* _env; - SordInserter* _inserter; - SordNode* _msg_node; - SharedPtr<Socket> _socket; + World& _world; + Interface& _iface; + SerdEnv* _env; + SordInserter* _inserter; + SordNode* _msg_node; + SPtr<Socket> _socket; }; } // namespace Ingen diff --git a/src/socket/SocketServer.hpp b/src/socket/SocketServer.hpp index 6bbd792d..371bd1e0 100644 --- a/src/socket/SocketServer.hpp +++ b/src/socket/SocketServer.hpp @@ -29,9 +29,9 @@ namespace Socket { class SocketServer : public Server::EventWriter, public SocketReader { public: - SocketServer(World& world, - Server::Engine& engine, - SharedPtr<Socket> sock) + SocketServer(World& world, + Server::Engine& engine, + SPtr<Socket> sock) : Server::EventWriter(engine) , SocketReader(world, *this, sock) , _engine(engine) @@ -49,8 +49,8 @@ public: } private: - Server::Engine& _engine; - SharedPtr<SocketWriter> _writer; + Server::Engine& _engine; + SPtr<SocketWriter> _writer; }; } // namespace Ingen diff --git a/src/socket/SocketWriter.cpp b/src/socket/SocketWriter.cpp index d2652dec..fd099e30 100644 --- a/src/socket/SocketWriter.cpp +++ b/src/socket/SocketWriter.cpp @@ -40,10 +40,10 @@ socket_sink(const void* buf, size_t len, void* stream) return ret; } -SocketWriter::SocketWriter(URIMap& map, - URIs& uris, - const Raul::URI& uri, - SharedPtr<Socket> sock) +SocketWriter::SocketWriter(URIMap& map, + URIs& uris, + const Raul::URI& uri, + SPtr<Socket> sock) : AtomWriter(map, uris, *this) , _map(map) , _sratom(sratom_new(&map.urid_map_feature()->urid_map)) diff --git a/src/socket/SocketWriter.hpp b/src/socket/SocketWriter.hpp index d6ba5dd3..141b0ca5 100644 --- a/src/socket/SocketWriter.hpp +++ b/src/socket/SocketWriter.hpp @@ -19,11 +19,11 @@ #include <stdint.h> -#include "ingen/Interface.hpp" #include "ingen/AtomSink.hpp" #include "ingen/AtomWriter.hpp" +#include "ingen/Interface.hpp" +#include "ingen/types.hpp" #include "raul/URI.hpp" -#include "raul/SharedPtr.hpp" #include "sratom/sratom.h" #include "Socket.hpp" @@ -36,10 +36,10 @@ namespace Socket { class SocketWriter : public AtomWriter, public AtomSink { public: - SocketWriter(URIMap& map, - URIs& uris, - const Raul::URI& uri, - SharedPtr<Socket> sock); + SocketWriter(URIMap& map, + URIs& uris, + const Raul::URI& uri, + SPtr<Socket> sock); ~SocketWriter(); @@ -51,14 +51,14 @@ public: Raul::URI uri() const { return _uri; } protected: - URIMap& _map; - Sratom* _sratom; - SerdNode _base; - SerdURI _base_uri; - SerdEnv* _env; - SerdWriter* _writer; - Raul::URI _uri; - SharedPtr<Socket> _socket; + URIMap& _map; + Sratom* _sratom; + SerdNode _base; + SerdURI _base_uri; + SerdEnv* _env; + SerdWriter* _writer; + Raul::URI _uri; + SPtr<Socket> _socket; }; } // namespace Socket diff --git a/src/socket/ingen_socket_client.cpp b/src/socket/ingen_socket_client.cpp index e835adc8..88842dde 100644 --- a/src/socket/ingen_socket_client.cpp +++ b/src/socket/ingen_socket_client.cpp @@ -23,21 +23,21 @@ #include "Socket.hpp" #include "SocketClient.hpp" -static SharedPtr<Ingen::Interface> -new_socket_interface(Ingen::World* world, - const Raul::URI& uri, - SharedPtr<Ingen::Interface> respondee) +static Ingen::SPtr<Ingen::Interface> +new_socket_interface(Ingen::World* world, + const Raul::URI& uri, + Ingen::SPtr<Ingen::Interface> respondee) { - SharedPtr<Ingen::Socket::Socket> sock( + Ingen::SPtr<Ingen::Socket::Socket> sock( new Ingen::Socket::Socket(Ingen::Socket::Socket::type_from_uri(uri))); if (!sock->connect(uri)) { world->log().error(Raul::fmt("Failed to connect <%1%> (%2%)\n") % sock->uri() % strerror(errno)); - return SharedPtr<Ingen::Interface>(); + return Ingen::SPtr<Ingen::Interface>(); } Ingen::Socket::SocketClient* client = new Ingen::Socket::SocketClient( *world, uri, sock, respondee); - return SharedPtr<Ingen::Interface>(client); + return Ingen::SPtr<Ingen::Interface>(client); } struct IngenSocketClientModule : public Ingen::Module { diff --git a/src/socket/ingen_socket_server.cpp b/src/socket/ingen_socket_server.cpp index 45c587ce..37b05bae 100644 --- a/src/socket/ingen_socket_server.cpp +++ b/src/socket/ingen_socket_server.cpp @@ -26,11 +26,11 @@ using namespace Ingen; struct IngenSocketServerModule : public Ingen::Module { void load(Ingen::World* world) { - listener = SharedPtr<Ingen::Socket::SocketListener>( + listener = SPtr<Ingen::Socket::SocketListener>( new Ingen::Socket::SocketListener(*world)); } - SharedPtr<Ingen::Socket::SocketListener> listener; + SPtr<Ingen::Socket::SocketListener> listener; }; extern "C" { diff --git a/tests/ingen_test.cpp b/tests/ingen_test.cpp index 8608b447..7bba3289 100644 --- a/tests/ingen_test.cpp +++ b/tests/ingen_test.cpp @@ -28,7 +28,6 @@ #include <glibmm/timer.h> #include "raul/Path.hpp" -#include "raul/SharedPtr.hpp" #include "raul/Thread.hpp" #include "serd/serd.h" @@ -48,6 +47,7 @@ #include "ingen/client/ThreadedSigClientInterface.hpp" #include "ingen/runtime_paths.hpp" #include "ingen/serialisation/Parser.hpp" +#include "ingen/types.hpp" #ifdef WITH_BINDINGS #include "bindings/ingen_bindings.hpp" #endif @@ -197,10 +197,10 @@ main(int argc, char** argv) // AtomWriter to serialise responses from the engine /* TestClient client; - SharedPtr<AtomWriter> atom_writer( + SPtr<AtomWriter> atom_writer( new AtomWriter(world->uri_map(), world->uris(), client)); */ - SharedPtr<Interface> client(new TestClient(world->log())); + SPtr<Interface> client(new TestClient(world->log())); world->interface()->set_respondee(client); world->engine()->register_client(Raul::URI("ingen:/clients/test"), |