From 30cb85c307b4c1273791721a782337742ade222c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 4 Oct 2006 21:45:20 +0000 Subject: Moved generic utility stuff to new library "raul". git-svn-id: http://svn.drobilla.net/lad/ingen@156 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/ConnectionModel.cpp | 6 +- src/libs/client/ConnectionModel.h | 20 ++--- src/libs/client/ControlModel.h | 2 +- src/libs/client/DeprecatedSerializer.cpp | 6 +- src/libs/client/DeprecatedSerializer.h | 8 +- src/libs/client/Makefile.am | 4 +- src/libs/client/NodeModel.cpp | 18 ++--- src/libs/client/NodeModel.h | 26 +++--- src/libs/client/OSCClientReceiver.cpp | 4 +- src/libs/client/OSCEngineSender.cpp | 6 +- src/libs/client/OSCEngineSender.h | 2 +- src/libs/client/ObjectModel.cpp | 2 +- src/libs/client/ObjectModel.h | 18 ++--- src/libs/client/PatchModel.cpp | 42 +++++----- src/libs/client/PatchModel.h | 24 +++--- src/libs/client/PluginModel.h | 2 +- src/libs/client/PortModel.h | 18 ++--- src/libs/client/Serializer.cpp | 30 +++---- src/libs/client/Serializer.h | 20 ++--- src/libs/client/Store.cpp | 114 +++++++++++++-------------- src/libs/client/Store.h | 52 ++++++------ src/libs/client/ThreadedSigClientInterface.h | 4 +- 22 files changed, 214 insertions(+), 214 deletions(-) (limited to 'src/libs/client') diff --git a/src/libs/client/ConnectionModel.cpp b/src/libs/client/ConnectionModel.cpp index e7f66077..bb2f2424 100644 --- a/src/libs/client/ConnectionModel.cpp +++ b/src/libs/client/ConnectionModel.cpp @@ -33,7 +33,7 @@ ConnectionModel::ConnectionModel(const Path& src_port, const Path& dst_port) } -ConnectionModel::ConnectionModel(CountedPtr src, CountedPtr dst) +ConnectionModel::ConnectionModel(SharedPtr src, SharedPtr dst) : _src_port_path(src->path()), _dst_port_path(dst->path()), _src_port(src), @@ -77,7 +77,7 @@ ConnectionModel::patch_path() const // Direct connection from patch input to patch output (pass through) // (parent patch is parent of ports) if (_src_port->parent() == _dst_port->parent()) { - CountedPtr parent_patch = PtrCast(_src_port->parent()); + SharedPtr parent_patch = PtrCast(_src_port->parent()); if (parent_patch) return parent_patch->path(); } @@ -101,7 +101,7 @@ ConnectionModel::patch_path() const return patch_path; } -typedef list > ConnectionList; +typedef list > ConnectionList; } // namespace Client diff --git a/src/libs/client/ConnectionModel.h b/src/libs/client/ConnectionModel.h index e1530f88..6dc85405 100644 --- a/src/libs/client/ConnectionModel.h +++ b/src/libs/client/ConnectionModel.h @@ -18,8 +18,8 @@ #define CONNECTIONMODEL_H #include -#include "util/Path.h" -#include "util/CountedPtr.h" +#include "raul/Path.h" +#include "raul/SharedPtr.h" #include "PortModel.h" #include using std::string; @@ -43,8 +43,8 @@ class Store; class ConnectionModel { public: - CountedPtr src_port() const { return _src_port; } - CountedPtr dst_port() const { return _dst_port; } + SharedPtr src_port() const { return _src_port; } + SharedPtr dst_port() const { return _dst_port; } const Path& src_port_path() const; const Path& dst_port_path() const; @@ -54,21 +54,21 @@ private: friend class Store; ConnectionModel(const Path& src_port, const Path& dst_port); - ConnectionModel(CountedPtr src, CountedPtr dst); + ConnectionModel(SharedPtr src, SharedPtr dst); - void set_src_port(CountedPtr port) { _src_port = port; _src_port_path = port->path(); } - void set_dst_port(CountedPtr port) { _dst_port = port; _dst_port_path = port->path(); } + void set_src_port(SharedPtr port) { _src_port = port; _src_port_path = port->path(); } + void set_dst_port(SharedPtr port) { _dst_port = port; _dst_port_path = port->path(); } void src_port_path(const string& s) { _src_port_path = s; } void dst_port_path(const string& s) { _dst_port_path = s; } Path _src_port_path; ///< Only used if _src_port == NULL Path _dst_port_path; ///< Only used if _dst_port == NULL - CountedPtr _src_port; - CountedPtr _dst_port; + SharedPtr _src_port; + SharedPtr _dst_port; }; -typedef list > ConnectionList; +typedef list > ConnectionList; } // namespace Client diff --git a/src/libs/client/ControlModel.h b/src/libs/client/ControlModel.h index 08143c73..337acfc6 100644 --- a/src/libs/client/ControlModel.h +++ b/src/libs/client/ControlModel.h @@ -18,7 +18,7 @@ #define CONTROLMODEL_H #include -#include "util/Path.h" +#include "raul/Path.h" namespace Ingen { namespace Client { diff --git a/src/libs/client/DeprecatedSerializer.cpp b/src/libs/client/DeprecatedSerializer.cpp index 1526c527..d3d5a09f 100644 --- a/src/libs/client/DeprecatedSerializer.cpp +++ b/src/libs/client/DeprecatedSerializer.cpp @@ -26,7 +26,7 @@ #include "PresetModel.h" #include "ModelEngineInterface.h" #include "PluginModel.h" -#include "util/Path.h" +#include "raul/Path.h" #include #include #include @@ -335,7 +335,7 @@ DeprecatedSerializer::load_node(const Path& parent, xmlDocPtr doc, const xmlNode assert(Path::is_valid(path)); // FIXME: /nasty/ assumptions - CountedPtr pm(new PortModel(Path(path).base() + port_name, + SharedPtr pm(new PortModel(Path(path).base() + port_name, PortModel::CONTROL, PortModel::INPUT, PortModel::NONE, 0.0, user_min, user_max)); //pm->set_parent(nm); @@ -459,7 +459,7 @@ DeprecatedSerializer::load_node(const Path& parent, xmlDocPtr doc, const xmlNode _engine->set_metadata_map(path, initial_data); - return CountedPtr(); + return SharedPtr(); } else { if (plugin_label == "note_in") { diff --git a/src/libs/client/DeprecatedSerializer.h b/src/libs/client/DeprecatedSerializer.h index 645c03f7..5ffe8731 100644 --- a/src/libs/client/DeprecatedSerializer.h +++ b/src/libs/client/DeprecatedSerializer.h @@ -22,8 +22,8 @@ #include #include #include -#include "util/CountedPtr.h" -#include "util/Path.h" +#include "raul/SharedPtr.h" +#include "raul/Path.h" #include "ObjectModel.h" using std::string; @@ -45,7 +45,7 @@ class ModelEngineInterface; class DeprecatedSerializer { public: - DeprecatedSerializer(CountedPtr engine) + DeprecatedSerializer(SharedPtr engine) : _patch_search_path("."), _engine(engine) { assert(_engine); @@ -67,7 +67,7 @@ private: string translate_load_path(const string& path); string _patch_search_path; - CountedPtr _engine; + SharedPtr _engine; /// Translations of paths from the loading file to actual paths (for deprecated patches) std::map _load_path_translations; diff --git a/src/libs/client/Makefile.am b/src/libs/client/Makefile.am index de9b1ca4..6c8b93dd 100644 --- a/src/libs/client/Makefile.am +++ b/src/libs/client/Makefile.am @@ -3,8 +3,8 @@ AM_CXXFLAGS = -I$(top_srcdir)/src/common if BUILD_CLIENT_LIB noinst_LTLIBRARIES = libingenclient.la -libingenclient_la_CXXFLAGS = -I$(top_srcdir)/src/common -DPKGDATADIR=\"$(pkgdatadir)\" @LXML2_CFLAGS@ @RAPTOR_CFLAGS@ @LSIGCPP_CFLAGS@ -libingenclient_la_LIBADD = @LXML2_LIBS@ @LOSC_LIBS@ @RAPTOR_LIBS@ @LSIGCPP_LIBS@ +libingenclient_la_CXXFLAGS = -I$(top_srcdir)/src/common -DPKGDATADIR=\"$(pkgdatadir)\" @LXML2_CFLAGS@ @RAPTOR_CFLAGS@ @LSIGCPP_CFLAGS@ @RAUL_CFLAGS@ +libingenclient_la_LIBADD = @LXML2_LIBS@ @LOSC_LIBS@ @RAPTOR_LIBS@ @LSIGCPP_LIBS@ @RAUL_LIBS@ libingenclient_la_SOURCES = \ OSCEngineSender.h \ diff --git a/src/libs/client/NodeModel.cpp b/src/libs/client/NodeModel.cpp index c5e399d2..56df1a12 100644 --- a/src/libs/client/NodeModel.cpp +++ b/src/libs/client/NodeModel.cpp @@ -22,7 +22,7 @@ namespace Ingen { namespace Client { -NodeModel::NodeModel(CountedPtr plugin, const Path& path, bool polyphonic) +NodeModel::NodeModel(SharedPtr plugin, const Path& path, bool polyphonic) : ObjectModel(path), m_polyphonic(polyphonic), m_plugin_uri(plugin->uri()), @@ -45,7 +45,7 @@ NodeModel::~NodeModel() void -NodeModel::remove_port(CountedPtr port) +NodeModel::remove_port(SharedPtr port) { m_ports.remove(port); removed_port_sig.emit(port); @@ -89,30 +89,30 @@ NodeModel::set_path(const Path& p) void -NodeModel::add_child(CountedPtr c) +NodeModel::add_child(SharedPtr c) { assert(c->parent().get() == this); - CountedPtr pm = PtrCast(c); + SharedPtr pm = PtrCast(c); assert(pm); add_port(pm); } void -NodeModel::remove_child(CountedPtr c) +NodeModel::remove_child(SharedPtr c) { assert(c->path().is_child_of(_path)); assert(c->parent().get() == this); - CountedPtr pm = PtrCast(c); + SharedPtr pm = PtrCast(c); assert(pm); remove_port(pm); } void -NodeModel::add_port(CountedPtr pm) +NodeModel::add_port(SharedPtr pm) { assert(pm); assert(pm->path().is_child_of(_path)); @@ -128,14 +128,14 @@ NodeModel::add_port(CountedPtr pm) } -CountedPtr +SharedPtr NodeModel::get_port(const string& port_name) const { assert(port_name.find("/") == string::npos); for (PortModelList::const_iterator i = m_ports.begin(); i != m_ports.end(); ++i) if ((*i)->path().name() == port_name) return (*i); - return CountedPtr(); + return SharedPtr(); } diff --git a/src/libs/client/NodeModel.h b/src/libs/client/NodeModel.h index 71c77022..e251d8ad 100644 --- a/src/libs/client/NodeModel.h +++ b/src/libs/client/NodeModel.h @@ -24,8 +24,8 @@ #include #include "ObjectModel.h" #include "PortModel.h" -#include "util/Path.h" -#include "util/CountedPtr.h" +#include "raul/Path.h" +#include "raul/SharedPtr.h" #include "PluginModel.h" using std::string; using std::map; using std::find; @@ -47,30 +47,30 @@ class NodeModel : public ObjectModel public: virtual ~NodeModel(); - CountedPtr get_port(const string& port_name) const; + SharedPtr get_port(const string& port_name) const; const map >& get_programs() const { return m_banks; } const string& plugin_uri() const { return m_plugin_uri; } - CountedPtr plugin() const { return m_plugin; } + SharedPtr plugin() const { return m_plugin; } int num_ports() const { return m_ports.size(); } const PortModelList& ports() const { return m_ports; } virtual bool polyphonic() const { return m_polyphonic; } // Signals - sigc::signal > new_port_sig; - sigc::signal > removed_port_sig; + sigc::signal > new_port_sig; + sigc::signal > removed_port_sig; protected: friend class Store; NodeModel(const string& plugin_uri, const Path& path, bool polyphonic); - NodeModel(CountedPtr plugin, const Path& path, bool polyphonic); + NodeModel(SharedPtr plugin, const Path& path, bool polyphonic); NodeModel(const Path& path); - void add_child(CountedPtr c); - void remove_child(CountedPtr c); - void add_port(CountedPtr pm); - void remove_port(CountedPtr pm); + void add_child(SharedPtr c); + void remove_child(SharedPtr c); + void add_port(SharedPtr pm); + void remove_port(SharedPtr pm); void remove_port(const Path& port_path); void add_program(int bank, int program, const string& name); void remove_program(int bank, int program); @@ -83,7 +83,7 @@ protected: bool m_polyphonic; PortModelList m_ports; ///< List of ports (not a map to preserve order) string m_plugin_uri; ///< Plugin URI (if PluginModel is unknown) - CountedPtr m_plugin; ///< The plugin this node is an instance of + SharedPtr m_plugin; ///< The plugin this node is an instance of map > m_banks; ///< DSSI banks private: @@ -93,7 +93,7 @@ private: }; -typedef map > NodeModelMap; +typedef map > NodeModelMap; } // namespace Client diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp index 0ae41e75..eb320df0 100644 --- a/src/libs/client/OSCClientReceiver.cpp +++ b/src/libs/client/OSCClientReceiver.cpp @@ -15,7 +15,7 @@ */ #include "OSCClientReceiver.h" -#include "util/LibloAtom.h" +#include "raul/AtomLiblo.h" #include #include #include @@ -338,7 +338,7 @@ OSCClientReceiver::m_metadata_update_cb(const char* path, const char* types, lo_ const char* obj_path = &argv[0]->s; const char* key = &argv[1]->s; - Atom value = LibloAtom::lo_arg_to_atom(types[2], argv[2]); + Atom value = AtomLiblo::lo_arg_to_atom(types[2], argv[2]); metadata_update(obj_path, key, value); diff --git a/src/libs/client/OSCEngineSender.cpp b/src/libs/client/OSCEngineSender.cpp index 826b53b2..6ba3dfb5 100644 --- a/src/libs/client/OSCEngineSender.cpp +++ b/src/libs/client/OSCEngineSender.cpp @@ -17,7 +17,7 @@ #include #include "OSCEngineSender.h" #include "interface/ClientKey.h" -#include "util/LibloAtom.h" +#include "raul/AtomLiblo.h" using std::cout; using std::cerr; using std::endl; namespace Ingen { @@ -107,7 +107,7 @@ OSCEngineSender::attach(int32_t ping_id, bool block) * traversal. It is a parameter to remain compatible with EngineInterface. */ void -OSCEngineSender::register_client(ClientKey key, CountedPtr client) +OSCEngineSender::register_client(ClientKey key, SharedPtr client) { // FIXME: use parameters.. er, somehow. assert(_engine_addr); @@ -381,7 +381,7 @@ OSCEngineSender::set_metadata(const string& obj_path, lo_message_add_int32(m, next_id()); lo_message_add_string(m, obj_path.c_str()); lo_message_add_string(m, predicate.c_str()); - LibloAtom::lo_message_add_atom(m, value); + AtomLiblo::lo_message_add_atom(m, value); lo_send_message(_engine_addr, "/om/metadata/set", m); } diff --git a/src/libs/client/OSCEngineSender.h b/src/libs/client/OSCEngineSender.h index fb133706..e46542b6 100644 --- a/src/libs/client/OSCEngineSender.h +++ b/src/libs/client/OSCEngineSender.h @@ -58,7 +58,7 @@ public: /* *** EngineInterface implementation below here *** */ // Client registration - void register_client(ClientKey key, CountedPtr client); + void register_client(ClientKey key, SharedPtr client); void unregister_client(ClientKey key); diff --git a/src/libs/client/ObjectModel.cpp b/src/libs/client/ObjectModel.cpp index 50f8b56d..6b60c5a4 100644 --- a/src/libs/client/ObjectModel.cpp +++ b/src/libs/client/ObjectModel.cpp @@ -63,7 +63,7 @@ ObjectModel::add_metadata(const MetadataMap& data) * @a model as correct. The paths of the two models MUST be equal. */ void -ObjectModel::set(CountedPtr model) +ObjectModel::set(SharedPtr model) { assert(_path == model->path()); diff --git a/src/libs/client/ObjectModel.h b/src/libs/client/ObjectModel.h index bc780cba..8b6b72ba 100644 --- a/src/libs/client/ObjectModel.h +++ b/src/libs/client/ObjectModel.h @@ -24,9 +24,9 @@ #include #include #include -#include "util/Atom.h" -#include "util/Path.h" -#include "util/CountedPtr.h" +#include "raul/Atom.h" +#include "raul/Path.h" +#include "raul/SharedPtr.h" using std::string; using std::map; using std::find; using std::cout; using std::cerr; using std::endl; @@ -56,7 +56,7 @@ public: const MetadataMap& metadata() const { return _metadata; } inline const Path& path() const { return _path; } - CountedPtr parent() const { return _parent; } + SharedPtr parent() const { return _parent; } // Signals sigc::signal metadata_update_sig; @@ -68,20 +68,20 @@ protected: ObjectModel(const Path& path); virtual void set_path(const Path& p) { _path = p; } - virtual void set_parent(CountedPtr p) { assert(p); _parent = p; } - virtual void add_child(CountedPtr c) = 0; - virtual void remove_child(CountedPtr c) = 0; + virtual void set_parent(SharedPtr p) { assert(p); _parent = p; } + virtual void add_child(SharedPtr c) = 0; + virtual void remove_child(SharedPtr c) = 0; void add_metadata(const MetadataMap& data); - void set(CountedPtr model); + void set(SharedPtr model); void set_metadata(const string& key, const Atom& value) { _metadata[key] = value; metadata_update_sig.emit(key, value); } Path _path; - CountedPtr _parent; + SharedPtr _parent; MetadataMap _metadata; diff --git a/src/libs/client/PatchModel.cpp b/src/libs/client/PatchModel.cpp index 1d2078c2..22d39d42 100644 --- a/src/libs/client/PatchModel.cpp +++ b/src/libs/client/PatchModel.cpp @@ -41,7 +41,7 @@ PatchModel::set_path(const Path& new_path) #ifdef DEBUG // Be sure connection paths are updated and sane - for (list >::iterator j = m_connections.begin(); + for (list >::iterator j = m_connections.begin(); j != m_connections.end(); ++j) { assert((*j)->src_port_path().parent().parent() == new_path); assert((*j)->src_port_path().parent().parent() == new_path); @@ -51,17 +51,17 @@ PatchModel::set_path(const Path& new_path) void -PatchModel::add_child(CountedPtr c) +PatchModel::add_child(SharedPtr c) { assert(c->parent().get() == this); - CountedPtr pm = PtrCast(c); + SharedPtr pm = PtrCast(c); if (pm) { add_port(pm); return; } - CountedPtr nm = PtrCast(c); + SharedPtr nm = PtrCast(c); if (nm) { add_node(nm); return; @@ -70,18 +70,18 @@ PatchModel::add_child(CountedPtr c) void -PatchModel::remove_child(CountedPtr c) +PatchModel::remove_child(SharedPtr c) { assert(c->path().is_child_of(_path)); assert(c->parent().get() == this); - CountedPtr pm = PtrCast(c); + SharedPtr pm = PtrCast(c); if (pm) { remove_port(pm); return; } - CountedPtr nm = PtrCast(c); + SharedPtr nm = PtrCast(c); if (nm) { remove_node(nm); return; @@ -89,17 +89,17 @@ PatchModel::remove_child(CountedPtr c) } -CountedPtr +SharedPtr PatchModel::get_node(const string& name) const { assert(name.find("/") == string::npos); NodeModelMap::const_iterator i = m_nodes.find(name); - return ((i != m_nodes.end()) ? (*i).second : CountedPtr()); + return ((i != m_nodes.end()) ? (*i).second : SharedPtr()); } void -PatchModel::add_node(CountedPtr nm) +PatchModel::add_node(SharedPtr nm) { assert(nm); assert(nm->path().is_child_of(_path)); @@ -116,7 +116,7 @@ PatchModel::add_node(CountedPtr nm) void -PatchModel::remove_node(CountedPtr nm) +PatchModel::remove_node(SharedPtr nm) { assert(nm->path().is_child_of(_path)); assert(nm->parent().get() == this); @@ -155,7 +155,7 @@ PatchModel::remove_node(const string& name) void PatchModel::clear() { - //for (list >::iterator j = m_connections.begin(); j != m_connections.end(); ++j) + //for (list >::iterator j = m_connections.begin(); j != m_connections.end(); ++j) // delete (*j); for (NodeModelMap::iterator i = m_nodes.begin(); i != m_nodes.end(); ++i) { @@ -190,8 +190,8 @@ PatchModel::rename_node(const Path& old_path, const Path& new_path) NodeModelMap::iterator i = m_nodes.find(old_path.name()); if (i != m_nodes.end()) { - CountedPtr nm = (*i).second; - for (list >::iterator j = m_connections.begin(); j != m_connections.end(); ++j) { + SharedPtr nm = (*i).second; + for (list >::iterator j = m_connections.begin(); j != m_connections.end(); ++j) { if ((*j)->src_port_path().parent() == old_path) (*j)->src_port_path(new_path.base() + (*j)->src_port_path().name()); if ((*j)->dst_port_path().parent() == old_path) @@ -208,13 +208,13 @@ PatchModel::rename_node(const Path& old_path, const Path& new_path) } -CountedPtr +SharedPtr PatchModel::get_connection(const string& src_port_path, const string& dst_port_path) const { - for (list >::const_iterator i = m_connections.begin(); i != m_connections.end(); ++i) + for (list >::const_iterator i = m_connections.begin(); i != m_connections.end(); ++i) if ((*i)->src_port_path() == src_port_path && (*i)->dst_port_path() == dst_port_path) return (*i); - return CountedPtr(); + return SharedPtr(); } @@ -226,7 +226,7 @@ PatchModel::get_connection(const string& src_port_path, const string& dst_port_p * this patch is a fatal error. */ void -PatchModel::add_connection(CountedPtr cm) +PatchModel::add_connection(SharedPtr cm) { // Store should have 'resolved' the connection already assert(cm); @@ -240,7 +240,7 @@ PatchModel::add_connection(CountedPtr cm) assert(cm->dst_port()->parent().get() == this || cm->dst_port()->parent()->parent().get() == this); - CountedPtr existing = get_connection(cm->src_port_path(), cm->dst_port_path()); + SharedPtr existing = get_connection(cm->src_port_path(), cm->dst_port_path()); if (existing) { assert(cm->src_port() == existing->src_port()); @@ -256,8 +256,8 @@ void PatchModel::remove_connection(const string& src_port_path, const string& dst_port_path) { cerr << path() << " PatchModel::remove_connection: " << src_port_path << " -> " << dst_port_path << endl; - for (list >::iterator i = m_connections.begin(); i != m_connections.end(); ++i) { - CountedPtr cm = (*i); + for (list >::iterator i = m_connections.begin(); i != m_connections.end(); ++i) { + SharedPtr cm = (*i); if (cm->src_port_path() == src_port_path && cm->dst_port_path() == dst_port_path) { m_connections.erase(i); // cuts our reference assert(!get_connection(src_port_path, dst_port_path)); // no duplicates diff --git a/src/libs/client/PatchModel.h b/src/libs/client/PatchModel.h index a7679b15..7dbad00b 100644 --- a/src/libs/client/PatchModel.h +++ b/src/libs/client/PatchModel.h @@ -23,7 +23,7 @@ #include #include #include "NodeModel.h" -#include "util/CountedPtr.h" +#include "raul/SharedPtr.h" #include "ConnectionModel.h" using std::list; using std::string; using std::map; @@ -44,8 +44,8 @@ public: const NodeModelMap& nodes() const { return m_nodes; } const ConnectionList& connections() const { return m_connections; } - CountedPtr get_connection(const string& src_port_path, const string& dst_port_path) const; - CountedPtr get_node(const string& node_name) const; + SharedPtr get_connection(const string& src_port_path, const string& dst_port_path) const; + SharedPtr get_node(const string& node_name) const; size_t poly() const { return m_poly; } const string& filename() const { return m_filename; } @@ -53,9 +53,9 @@ public: bool polyphonic() const; // Signals - sigc::signal > new_node_sig; - sigc::signal > removed_node_sig; - sigc::signal > new_connection_sig; + sigc::signal > new_node_sig; + sigc::signal > removed_node_sig; + sigc::signal > new_connection_sig; sigc::signal removed_connection_sig; sigc::signal enabled_sig; sigc::signal disabled_sig; @@ -76,12 +76,12 @@ private: void disable(); void clear(); void set_path(const Path& path); - void add_node(CountedPtr nm); - void remove_node(CountedPtr nm); - void add_child(CountedPtr c); - void remove_child(CountedPtr c); + void add_node(SharedPtr nm); + void remove_node(SharedPtr nm); + void add_child(SharedPtr c); + void remove_child(SharedPtr c); - void add_connection(CountedPtr cm); + void add_connection(SharedPtr cm); void remove_connection(const string& src_port_path, const string& dst_port_path); void rename_node(const Path& old_path, const Path& new_path); @@ -98,7 +98,7 @@ private: size_t m_poly; }; -typedef map > PatchModelMap; +typedef map > PatchModelMap; } // namespace Client diff --git a/src/libs/client/PluginModel.h b/src/libs/client/PluginModel.h index 42548f64..e4b4233d 100644 --- a/src/libs/client/PluginModel.h +++ b/src/libs/client/PluginModel.h @@ -19,7 +19,7 @@ #include #include -#include "util/Path.h" +#include "raul/Path.h" using std::string; using std::cerr; using std::endl; namespace Ingen { diff --git a/src/libs/client/PortModel.h b/src/libs/client/PortModel.h index c4b08ce8..b9254b84 100644 --- a/src/libs/client/PortModel.h +++ b/src/libs/client/PortModel.h @@ -22,8 +22,8 @@ #include #include #include "ObjectModel.h" -#include "util/CountedPtr.h" -#include "util/Path.h" +#include "raul/SharedPtr.h" +#include "raul/Path.h" using std::string; using std::list; namespace Ingen { @@ -58,8 +58,8 @@ public: // Signals sigc::signal control_change_sig; ///< "Control" ports only - sigc::signal > connection_sig; - sigc::signal > disconnection_sig; + sigc::signal > connection_sig; + sigc::signal > disconnection_sig; private: friend class Store; @@ -86,15 +86,15 @@ private: inline void value(float f) { m_current_val = f; control_change_sig.emit(f); } - void add_child(CountedPtr c) { throw; } - void remove_child(CountedPtr c) { throw; } + void add_child(SharedPtr c) { throw; } + void remove_child(SharedPtr c) { throw; } // Prevent copies (undefined) PortModel(const PortModel& copy); PortModel& operator=(const PortModel& copy); - void connected_to(CountedPtr p) { ++m_connections; connection_sig.emit(p); } - void disconnected_from(CountedPtr p) { --m_connections; disconnection_sig.emit(p); } + void connected_to(SharedPtr p) { ++m_connections; connection_sig.emit(p); } + void disconnected_from(SharedPtr p) { --m_connections; disconnection_sig.emit(p); } Type m_type; @@ -104,7 +104,7 @@ private: size_t m_connections; }; -typedef list > PortModelList; +typedef list > PortModelList; } // namespace Client diff --git a/src/libs/client/Serializer.cpp b/src/libs/client/Serializer.cpp index 6bfa08d6..bfcb0de6 100644 --- a/src/libs/client/Serializer.cpp +++ b/src/libs/client/Serializer.cpp @@ -34,9 +34,9 @@ #include "PresetModel.h" #include "ModelEngineInterface.h" #include "PluginModel.h" -#include "util/Path.h" -#include "util/Atom.h" -#include "util/RedlandAtom.h" +#include "raul/Path.h" +#include "raul/Atom.h" +#include "raul/AtomRaptor.h" #define U(x) ((const unsigned char*)(x)) @@ -47,7 +47,7 @@ namespace Ingen { namespace Client { -Serializer::Serializer(CountedPtr engine) +Serializer::Serializer(SharedPtr engine) : _serializer(NULL) , _string_output(NULL) , _patch_search_path(".") @@ -70,7 +70,7 @@ Serializer::~Serializer() * This must be called before any serializing methods. */ void -Serializer::start_to_filename(const string& filename) throw(std::logic_error) +Serializer::start_to_filename(const string& filename) throw (std::logic_error) { if (_serializer) throw std::logic_error("start_to_string called with serialization in progress"); @@ -90,7 +90,7 @@ Serializer::start_to_filename(const string& filename) throw(std::logic_error) * the desired objects have been serialized. */ void -Serializer::start_to_string() throw(std::logic_error) +Serializer::start_to_string() throw (std::logic_error) { if (_serializer) throw std::logic_error("start_to_string called with serialization in progress"); @@ -282,31 +282,31 @@ Serializer::serialize_atom( triple.predicate = (void*)raptor_new_uri((const unsigned char*)predicate_uri.c_str()); triple.predicate_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE; - RedlandAtom::atom_to_triple_object(&triple, atom); + AtomRaptor::atom_to_triple_object(&triple, atom); raptor_serialize_statement(_serializer, &triple); } void -Serializer::serialize(CountedPtr object) throw (std::logic_error) +Serializer::serialize(SharedPtr object) throw (std::logic_error) { if (!_serializer) throw std::logic_error("serialize_patch called without serialization in progress"); - CountedPtr patch = PtrCast(object); + SharedPtr patch = PtrCast(object); if (patch) { serialize_patch(patch); return; } - CountedPtr node = PtrCast(object); + SharedPtr node = PtrCast(object); if (node) { serialize_node(node); return; } - CountedPtr port = PtrCast(object); + SharedPtr port = PtrCast(object); if (port) { serialize_port(port); return; @@ -318,7 +318,7 @@ Serializer::serialize(CountedPtr object) throw (std::logic_error) void -Serializer::serialize_patch(CountedPtr patch) +Serializer::serialize_patch(SharedPtr patch) { assert(_serializer); @@ -361,7 +361,7 @@ Serializer::serialize_patch(CountedPtr patch) void Serializer::serialize_node( - CountedPtr node, const string ns_prefix) + SharedPtr node, const string ns_prefix) { assert(_serializer); @@ -394,7 +394,7 @@ Serializer::serialize_node( void -Serializer::serialize_port(CountedPtr port, const string ns_prefix) +Serializer::serialize_port(SharedPtr port, const string ns_prefix) { assert(_serializer); @@ -417,7 +417,7 @@ Serializer::serialize_port(CountedPtr port, const string ns_prefix) void -Serializer::serialize_connection(CountedPtr connection) throw (std::logic_error) +Serializer::serialize_connection(SharedPtr connection) throw (std::logic_error) { assert(_serializer); diff --git a/src/libs/client/Serializer.h b/src/libs/client/Serializer.h index 1af18de7..15c49101 100644 --- a/src/libs/client/Serializer.h +++ b/src/libs/client/Serializer.h @@ -23,9 +23,9 @@ #include #include #include -#include "util/CountedPtr.h" -#include "util/Path.h" -#include "util/Atom.h" +#include "raul/SharedPtr.h" +#include "raul/Path.h" +#include "raul/Atom.h" #include "ObjectModel.h" using std::string; @@ -53,7 +53,7 @@ class ModelEngineInterface; class Serializer { public: - Serializer(CountedPtr engine); + Serializer(SharedPtr engine); ~Serializer(); void path(const string& path) { _patch_search_path = path; } @@ -70,19 +70,19 @@ public: void start_to_filename(const string& filename) throw (std::logic_error); void start_to_string() throw (std::logic_error); - void serialize(CountedPtr object) throw (std::logic_error); - void serialize_connection(CountedPtr c) throw (std::logic_error); + void serialize(SharedPtr object) throw (std::logic_error); + void serialize_connection(SharedPtr c) throw (std::logic_error); string finish() throw (std::logic_error); private: // Model -> RDF - void serialize_patch(CountedPtr p); + void serialize_patch(SharedPtr p); - void serialize_node(CountedPtr n, const string ns_prefix=""); + void serialize_node(SharedPtr n, const string ns_prefix=""); - void serialize_port(CountedPtr p, const string ns_prefix=""); + void serialize_port(SharedPtr p, const string ns_prefix=""); @@ -110,7 +110,7 @@ private: unsigned char* _string_output; string _patch_search_path; map _prefixes; - CountedPtr _engine; + SharedPtr _engine; }; diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp index fb16697b..30942ae3 100644 --- a/src/libs/client/Store.cpp +++ b/src/libs/client/Store.cpp @@ -28,7 +28,7 @@ namespace Client { -Store::Store(CountedPtr engine, CountedPtr emitter) +Store::Store(SharedPtr engine, SharedPtr emitter) : _engine(engine) , _emitter(emitter) { @@ -57,12 +57,12 @@ Store::clear() void -Store::add_plugin_orphan(CountedPtr node) +Store::add_plugin_orphan(SharedPtr node) { cerr << "WARNING: Node " << node->path() << " received, but plugin " << node->plugin_uri() << " unknown." << endl; - map > >::iterator spawn + map > >::iterator spawn = _plugin_orphans.find(node->plugin_uri()); _engine->request_plugin(node->plugin_uri()); @@ -70,7 +70,7 @@ Store::add_plugin_orphan(CountedPtr node) if (spawn != _plugin_orphans.end()) { spawn->second.push_back(node); } else { - list > l; + list > l; l.push_back(node); _plugin_orphans[node->plugin_uri()] = l; } @@ -78,18 +78,18 @@ Store::add_plugin_orphan(CountedPtr node) void -Store::resolve_plugin_orphans(CountedPtr plugin) +Store::resolve_plugin_orphans(SharedPtr plugin) { - map > >::iterator n + map > >::iterator n = _plugin_orphans.find(plugin->uri()); if (n != _plugin_orphans.end()) { - list > spawn = n->second; // take a copy + list > spawn = n->second; // take a copy _plugin_orphans.erase(plugin->uri()); // prevent infinite recursion - for (list >::iterator i = spawn.begin(); + for (list >::iterator i = spawn.begin(); i != spawn.end(); ++i) { add_object(*i); } @@ -98,7 +98,7 @@ Store::resolve_plugin_orphans(CountedPtr plugin) void -Store::add_connection_orphan(CountedPtr connection) +Store::add_connection_orphan(SharedPtr connection) { cerr << "WARNING: Orphan connection " << connection->src_port_path() << " -> " << connection->dst_port_path() << " received." << endl; @@ -108,11 +108,11 @@ Store::add_connection_orphan(CountedPtr connection) void -Store::resolve_connection_orphans(CountedPtr port) +Store::resolve_connection_orphans(SharedPtr port) { assert(port->parent()); - for (list >::iterator c = _connection_orphans.begin(); + for (list >::iterator c = _connection_orphans.begin(); c != _connection_orphans.end(); ) { if ((*c)->src_port_path() == port->path()) @@ -121,11 +121,11 @@ Store::resolve_connection_orphans(CountedPtr port) if ((*c)->dst_port_path() == port->path()) (*c)->set_dst_port(port); - list >::iterator next = c; + list >::iterator next = c; ++next; if ((*c)->src_port() && (*c)->dst_port()) { - CountedPtr patch = PtrCast(this->object((*c)->patch_path())); + SharedPtr patch = PtrCast(this->object((*c)->patch_path())); if (patch) { cerr << "Resolved orphan connection " << (*c)->src_port_path() << (*c)->dst_port_path() << endl; @@ -140,11 +140,11 @@ Store::resolve_connection_orphans(CountedPtr port) void -Store::add_orphan(CountedPtr child) +Store::add_orphan(SharedPtr child) { cerr << "WARNING: Orphan object " << child->path() << " received." << endl; - map > >::iterator children + map > >::iterator children = _orphans.find(child->path().parent()); _engine->request_object(child->path().parent()); @@ -152,7 +152,7 @@ Store::add_orphan(CountedPtr child) if (children != _orphans.end()) { children->second.push_back(child); } else { - list > l; + list > l; l.push_back(child); _orphans[child->path().parent()] = l; } @@ -178,7 +178,7 @@ Store::add_metadata_orphan(const Path& subject_path, const string& predicate, co void -Store::resolve_metadata_orphans(CountedPtr subject) +Store::resolve_metadata_orphans(SharedPtr subject) { map > >::iterator v = _metadata_orphans.find(subject->path()); @@ -198,18 +198,18 @@ Store::resolve_metadata_orphans(CountedPtr subject) void -Store::resolve_orphans(CountedPtr parent) +Store::resolve_orphans(SharedPtr parent) { - map > >::iterator c + map > >::iterator c = _orphans.find(parent->path()); if (c != _orphans.end()) { - list > children = c->second; // take a copy + list > children = c->second; // take a copy _orphans.erase(parent->path()); // prevent infinite recursion - for (list >::iterator i = children.begin(); + for (list >::iterator i = children.begin(); i != children.end(); ++i) { add_object(*i); } @@ -218,7 +218,7 @@ Store::resolve_orphans(CountedPtr parent) void -Store::add_object(CountedPtr object) +Store::add_object(SharedPtr object) { // If we already have "this" object, merge the existing one into the new // one (with precedence to the new values). @@ -228,7 +228,7 @@ Store::add_object(CountedPtr object) } else { if (object->path() != "/") { - CountedPtr parent = this->object(object->path().parent()); + SharedPtr parent = this->object(object->path().parent()); if (parent) { assert(object->path().is_child_of(parent->path())); object->set_parent(parent); @@ -241,7 +241,7 @@ Store::add_object(CountedPtr object) resolve_metadata_orphans(parent); resolve_orphans(parent); - CountedPtr port = PtrCast(object); + SharedPtr port = PtrCast(object); if (port) resolve_connection_orphans(port); @@ -259,14 +259,14 @@ Store::add_object(CountedPtr object) } -CountedPtr +SharedPtr Store::remove_object(const Path& path) { - map >::iterator i = _objects.find(path); + map >::iterator i = _objects.find(path); if (i != _objects.end()) { assert((*i).second->path() == path); - CountedPtr result = (*i).second; + SharedPtr result = (*i).second; _objects.erase(i); //cout << "[Store] Removed " << path << endl; @@ -276,7 +276,7 @@ Store::remove_object(const Path& path) if (result->path() != "/") { assert(result->parent()); - CountedPtr parent = this->object(result->path().parent()); + SharedPtr parent = this->object(result->path().parent()); if (parent) { parent->remove_child(result); } @@ -288,30 +288,30 @@ Store::remove_object(const Path& path) } else { cerr << "[Store] Unable to find object " << path << " to remove." << endl; - return CountedPtr(); + return SharedPtr(); } } -CountedPtr +SharedPtr Store::plugin(const string& uri) { assert(uri.length() > 0); - map >::iterator i = _plugins.find(uri); + map >::iterator i = _plugins.find(uri); if (i == _plugins.end()) - return CountedPtr(); + return SharedPtr(); else return (*i).second; } -CountedPtr +SharedPtr Store::object(const Path& path) { assert(path.length() > 0); - map >::iterator i = _objects.find(path); + map >::iterator i = _objects.find(path); if (i == _objects.end()) { - return CountedPtr(); + return SharedPtr(); } else { assert(i->second->path() == "/" || i->second->parent()); return i->second; @@ -319,7 +319,7 @@ Store::object(const Path& path) } void -Store::add_plugin(CountedPtr pm) +Store::add_plugin(SharedPtr pm) { // FIXME: dupes? merge, like with objects? @@ -334,7 +334,7 @@ Store::add_plugin(CountedPtr pm) void Store::destruction_event(const Path& path) { - CountedPtr removed = remove_object(path); + SharedPtr removed = remove_object(path); removed.reset(); @@ -345,7 +345,7 @@ Store::destruction_event(const Path& path) void Store::new_plugin_event(const string& uri, const string& name) { - CountedPtr p(new PluginModel(uri, name)); + SharedPtr p(new PluginModel(uri, name)); add_plugin(p); resolve_plugin_orphans(p); } @@ -354,7 +354,7 @@ Store::new_plugin_event(const string& uri, const string& name) void Store::new_patch_event(const Path& path, uint32_t poly) { - CountedPtr p(new PatchModel(path, poly)); + SharedPtr p(new PatchModel(path, poly)); add_object(p); } @@ -364,12 +364,12 @@ Store::new_node_event(const string& plugin_uri, const Path& node_path, bool is_p { // FIXME: num_ports unused - CountedPtr plug = plugin(plugin_uri); + SharedPtr plug = plugin(plugin_uri); if (!plug) { - CountedPtr n(new NodeModel(plugin_uri, node_path, is_polyphonic)); + SharedPtr n(new NodeModel(plugin_uri, node_path, is_polyphonic)); add_plugin_orphan(n); } else { - CountedPtr n(new NodeModel(plug, node_path, is_polyphonic)); + SharedPtr n(new NodeModel(plug, node_path, is_polyphonic)); add_object(n); } } @@ -388,7 +388,7 @@ Store::new_port_event(const Path& path, const string& type, bool is_output) PortModel::Direction pdir = is_output ? PortModel::OUTPUT : PortModel::INPUT; - CountedPtr p(new PortModel(path, ptype, pdir)); + SharedPtr p(new PortModel(path, ptype, pdir)); add_object(p); if (p->parent()) resolve_connection_orphans(p); @@ -398,7 +398,7 @@ Store::new_port_event(const Path& path, const string& type, bool is_output) void Store::patch_enabled_event(const Path& path) { - CountedPtr patch = PtrCast(object(path)); + SharedPtr patch = PtrCast(object(path)); if (patch) patch->enable(); } @@ -407,7 +407,7 @@ Store::patch_enabled_event(const Path& path) void Store::patch_disabled_event(const Path& path) { - CountedPtr patch = PtrCast(object(path)); + SharedPtr patch = PtrCast(object(path)); if (patch) patch->disable(); } @@ -416,7 +416,7 @@ Store::patch_disabled_event(const Path& path) void Store::patch_cleared_event(const Path& path) { - CountedPtr patch = PtrCast(object(path)); + SharedPtr patch = PtrCast(object(path)); if (patch) { NodeModelMap children = patch->nodes(); // take a copy for (NodeModelMap::iterator i = children.begin(); i != children.end(); ++i) { @@ -429,7 +429,7 @@ Store::patch_cleared_event(const Path& path) void Store::metadata_update_event(const Path& subject_path, const string& predicate, const Atom& value) { - CountedPtr subject = object(subject_path); + SharedPtr subject = object(subject_path); if (subject) { subject->set_metadata(predicate, value); @@ -443,7 +443,7 @@ Store::metadata_update_event(const Path& subject_path, const string& predicate, void Store::control_change_event(const Path& port_path, float value) { - CountedPtr port = PtrCast(object(port_path)); + SharedPtr port = PtrCast(object(port_path)); if (port) port->value(value); else @@ -454,20 +454,20 @@ Store::control_change_event(const Path& port_path, float value) void Store::connection_event(const Path& src_port_path, const Path& dst_port_path) { - CountedPtr src_port = PtrCast(object(src_port_path)); - CountedPtr dst_port = PtrCast(object(dst_port_path)); + SharedPtr src_port = PtrCast(object(src_port_path)); + SharedPtr dst_port = PtrCast(object(dst_port_path)); - CountedPtr dangling_cm(new ConnectionModel(src_port_path, dst_port_path)); + SharedPtr dangling_cm(new ConnectionModel(src_port_path, dst_port_path)); if (src_port && dst_port) { assert(src_port->parent()); assert(dst_port->parent()); - CountedPtr patch = PtrCast(this->object(dangling_cm->patch_path())); + SharedPtr patch = PtrCast(this->object(dangling_cm->patch_path())); assert(patch); - CountedPtr cm(new ConnectionModel(src_port, dst_port)); + SharedPtr cm(new ConnectionModel(src_port, dst_port)); src_port->connected_to(dst_port); dst_port->connected_to(src_port); @@ -488,8 +488,8 @@ Store::disconnection_event(const Path& src_port_path, const Path& dst_port_path) // Find the ports and create a ConnectionModel just to get at the parent path // finding logic in ConnectionModel. So I'm lazy. - CountedPtr src_port = PtrCast(object(src_port_path)); - CountedPtr dst_port = PtrCast(object(dst_port_path)); + SharedPtr src_port = PtrCast(object(src_port_path)); + SharedPtr dst_port = PtrCast(object(dst_port_path)); assert(src_port); assert(dst_port); @@ -497,9 +497,9 @@ Store::disconnection_event(const Path& src_port_path, const Path& dst_port_path) src_port->disconnected_from(dst_port); dst_port->disconnected_from(src_port); - CountedPtr cm(new ConnectionModel(src_port, dst_port)); + SharedPtr cm(new ConnectionModel(src_port, dst_port)); - CountedPtr patch = PtrCast(this->object(cm->patch_path())); + SharedPtr patch = PtrCast(this->object(cm->patch_path())); if (patch) patch->remove_connection(src_port_path, dst_port_path); diff --git a/src/libs/client/Store.h b/src/libs/client/Store.h index 6a8700f9..d1599423 100644 --- a/src/libs/client/Store.h +++ b/src/libs/client/Store.h @@ -21,10 +21,10 @@ #include #include #include -#include "util/CountedPtr.h" +#include "raul/SharedPtr.h" #include -#include "util/Path.h" -#include "util/Atom.h" +#include "raul/Path.h" +#include "raul/Atom.h" #include "interface/EngineInterface.h" using std::string; using std::map; using std::list; using Ingen::Shared::EngineInterface; @@ -47,39 +47,39 @@ class ConnectionModel; */ class Store : public sigc::trackable { // FIXME: is trackable necessary? public: - Store(CountedPtr engine, CountedPtr emitter); + Store(SharedPtr engine, SharedPtr emitter); - CountedPtr plugin(const string& uri); - CountedPtr object(const Path& path); + SharedPtr plugin(const string& uri); + SharedPtr object(const Path& path); void clear(); size_t num_object() { return _objects.size(); } - const map >& plugins() const { return _plugins; } - const map >& objects() const { return _objects; } + const map >& plugins() const { return _plugins; } + const map >& objects() const { return _objects; } - sigc::signal > new_object_sig; + sigc::signal > new_object_sig; private: - void add_object(CountedPtr object); - CountedPtr remove_object(const Path& path); + void add_object(SharedPtr object); + SharedPtr remove_object(const Path& path); - void add_plugin(CountedPtr plugin); + void add_plugin(SharedPtr plugin); // It would be nice to integrate these somehow.. - void add_orphan(CountedPtr orphan); - void resolve_orphans(CountedPtr parent); + void add_orphan(SharedPtr orphan); + void resolve_orphans(SharedPtr parent); - void add_connection_orphan(CountedPtr orphan); - void resolve_connection_orphans(CountedPtr port); + void add_connection_orphan(SharedPtr orphan); + void resolve_connection_orphans(SharedPtr port); - void add_plugin_orphan(CountedPtr orphan); - void resolve_plugin_orphans(CountedPtr plugin); + void add_plugin_orphan(SharedPtr orphan); + void resolve_plugin_orphans(SharedPtr plugin); void add_metadata_orphan(const Path& subject, const string& predicate, const Atom& value); - void resolve_metadata_orphans(CountedPtr subject); + void resolve_metadata_orphans(SharedPtr subject); // Slots for SigClientInterface signals void destruction_event(const Path& path); @@ -95,27 +95,27 @@ private: void connection_event(const Path& src_port_path, const Path& dst_port_path); void disconnection_event(const Path& src_port_path, const Path& dst_port_path); - CountedPtr _engine; - CountedPtr _emitter; + SharedPtr _engine; + SharedPtr _emitter; - typedef map > ObjectMap; + typedef map > ObjectMap; ObjectMap _objects; ///< Keyed by Ingen path - map > _plugins; ///< Keyed by URI + map > _plugins; ///< Keyed by URI /** Objects we've received, but depend on the existance of another unknown object. * Keyed by the path of the depended-on object (for tolerance of orderless comms) */ - map > > _orphans; + map > > _orphans; /** Same idea, except with plugins instead of parents. * It's unfortunate everything doesn't just have a URI and this was the same.. ahem.. */ - map > > _plugin_orphans; + map > > _plugin_orphans; /** Not orphans OF metadata like the above, but orphans which are metadata */ map > > _metadata_orphans; /** Ditto */ - list > _connection_orphans; + list > _connection_orphans; }; diff --git a/src/libs/client/ThreadedSigClientInterface.h b/src/libs/client/ThreadedSigClientInterface.h index f29d3cc4..056540fb 100644 --- a/src/libs/client/ThreadedSigClientInterface.h +++ b/src/libs/client/ThreadedSigClientInterface.h @@ -22,8 +22,8 @@ #include #include "interface/ClientInterface.h" #include "SigClientInterface.h" -#include "util/Queue.h" -#include "util/Atom.h" +#include "raul/Queue.h" +#include "raul/Atom.h" using std::string; /** Returns nothing and takes no parameters (because they have all been bound) */ -- cgit v1.2.1