diff options
author | David Robillard <d@drobilla.net> | 2009-05-13 04:05:32 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-05-13 04:05:32 +0000 |
commit | 19928bb583e72802746b89e322f71ecc0fcb7427 (patch) | |
tree | 95912dc84d8c9dcf57939398514feaf148c1cd63 /src/client | |
parent | 96f839e64de70a23210847e322d24690299287fe (diff) | |
download | ingen-19928bb583e72802746b89e322f71ecc0fcb7427.tar.gz ingen-19928bb583e72802746b89e322f71ecc0fcb7427.tar.bz2 ingen-19928bb583e72802746b89e322f71ecc0fcb7427.zip |
The great ID refactoring of 2009.
Path is now actually URI (scheme path: for now).
Therefore ingen nodes and such live in the same namespace as ... well, everything.
Including plugins.
Thar be profit, laddies.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1992 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/ClientStore.cpp | 255 | ||||
-rw-r--r-- | src/client/ClientStore.hpp | 84 | ||||
-rw-r--r-- | src/client/ConnectionModel.hpp | 4 | ||||
-rw-r--r-- | src/client/DeprecatedLoader.cpp | 22 | ||||
-rw-r--r-- | src/client/DeprecatedLoader.hpp | 44 | ||||
-rw-r--r-- | src/client/HTTPClientReceiver.cpp | 2 | ||||
-rw-r--r-- | src/client/HTTPEngineSender.cpp | 86 | ||||
-rw-r--r-- | src/client/HTTPEngineSender.hpp | 123 | ||||
-rw-r--r-- | src/client/NodeModel.cpp | 5 | ||||
-rw-r--r-- | src/client/NodeModel.hpp | 12 | ||||
-rw-r--r-- | src/client/OSCEngineSender.cpp | 90 | ||||
-rw-r--r-- | src/client/OSCEngineSender.hpp | 118 | ||||
-rw-r--r-- | src/client/ObjectModel.cpp | 7 | ||||
-rw-r--r-- | src/client/ObjectModel.hpp | 43 | ||||
-rw-r--r-- | src/client/PatchModel.cpp | 9 | ||||
-rw-r--r-- | src/client/PatchModel.hpp | 15 | ||||
-rw-r--r-- | src/client/PluginModel.cpp | 6 | ||||
-rw-r--r-- | src/client/PluginModel.hpp | 25 | ||||
-rw-r--r-- | src/client/PluginUI.cpp | 2 | ||||
-rw-r--r-- | src/client/PortModel.cpp | 2 | ||||
-rw-r--r-- | src/client/PortModel.hpp | 38 | ||||
-rw-r--r-- | src/client/SigClientInterface.hpp | 83 | ||||
-rw-r--r-- | src/client/ThreadedSigClientInterface.hpp | 82 |
23 files changed, 454 insertions, 703 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index c73150d0..f120e7ed 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -29,6 +29,7 @@ using namespace std; using namespace Raul; namespace Ingen { +using namespace Shared; namespace Client { @@ -69,178 +70,6 @@ ClientStore::clear() void -ClientStore::add_plugin_orphan(SharedPtr<NodeModel> node) -{ - if (!_handle_orphans) - return; - - Raul::Table<string, list<SharedPtr<NodeModel> > >::iterator spawn - = _plugin_orphans.find(node->plugin_uri()); - - if (spawn != _plugin_orphans.end()) { - spawn->second.push_back(node); - } else { - cerr << "WARNING: Orphans of plugin " << node->plugin_uri() << " received" << endl; - _engine->request_plugin(node->plugin_uri()); - list<SharedPtr<NodeModel> > l; - l.push_back(node); - _plugin_orphans[node->plugin_uri()] = l; - } -} - - -void -ClientStore::resolve_plugin_orphans(SharedPtr<PluginModel> plugin) -{ - if (!_handle_orphans) - return; - Raul::Table<string, list<SharedPtr<NodeModel> > >::iterator n - = _plugin_orphans.find(plugin->uri()); - - if (n != _plugin_orphans.end()) { - - list<SharedPtr<NodeModel> > spawn = n->second; // take a copy - cerr << "Missing dependant " << plugin->uri() << " received" << endl; - - _plugin_orphans.erase(plugin->uri()); // prevent infinite recursion - - for (list<SharedPtr<NodeModel> >::iterator i = spawn.begin(); - i != spawn.end(); ++i) { - (*i)->_plugin = plugin; - //add_object(*i); - } - } -} - - -void -ClientStore::add_connection_orphan(std::pair<Path, Path> orphan) -{ - // Do this anyway, it's needed to get the connections for copy&paste - //if (!_handle_orphans) - //return; - - if (_handle_orphans) - cerr << "WARNING: Orphan connection " << orphan.first - << " -> " << orphan.second << " received." << endl; - - _connection_orphans.push_back(orphan); -} - - -void -ClientStore::resolve_connection_orphans(SharedPtr<PortModel> port) -{ - if (!_handle_orphans) - return; - assert(port->parent()); - - for (list< pair<Path, Path> >::iterator c = _connection_orphans.begin(); - c != _connection_orphans.end(); ) { - - list< pair<Path, Path> >::iterator next = c; - ++next; - - if (c->first == port->path() || c->second == port->path()) { - cerr << "Missing dependant (" << c->first << " -> " << c->second << ") received" << endl; - bool success = attempt_connection(c->first, c->second); - if (success) - _connection_orphans.erase(c); - } - - c = next; - } -} - - -void -ClientStore::add_orphan(SharedPtr<ObjectModel> child) -{ - if (!_handle_orphans) - return; - cerr << "WARNING: Orphan object " << child->path() << " received." << endl; - - Raul::PathTable<list<SharedPtr<ObjectModel> > >::iterator children - = _orphans.find(child->path().parent()); - - _engine->request_object(child->path().parent()); - - if (children != _orphans.end()) { - children->second.push_back(child); - } else { - list<SharedPtr<ObjectModel> > l; - l.push_back(child); - _orphans.insert(make_pair(child->path().parent(), l)); - } -} - - -void -ClientStore::add_variable_orphan(const Path& subject_path, const string& predicate, const Atom& value) -{ - if (!_handle_orphans) - return; - Raul::PathTable<list<std::pair<string, Atom> > >::iterator orphans - = _variable_orphans.find(subject_path); - - //_engine->request_object(subject_path); - - if (orphans != _variable_orphans.end()) { - orphans->second.push_back(std::pair<string, Atom>(predicate, value)); - } else { - list<std::pair<string, Atom> > l; - l.push_back(std::pair<string, Atom>(predicate, value)); - _variable_orphans[subject_path] = l; - } -} - - -void -ClientStore::resolve_variable_orphans(SharedPtr<ObjectModel> subject) -{ - if (!_handle_orphans) - return; - Raul::PathTable<list<std::pair<string, Atom> > >::iterator v - = _variable_orphans.find(subject->path()); - - if (v != _variable_orphans.end()) { - - list<std::pair<string, Atom> > values = v->second; // take a copy - - _variable_orphans.erase(subject->path()); - cerr << "Missing dependant " << subject->path() << " received" << endl; - - for (list<std::pair<string, Atom> >::iterator i = values.begin(); - i != values.end(); ++i) { - subject->set_variable(i->first, i->second); - } - } -} - - -void -ClientStore::resolve_orphans(SharedPtr<ObjectModel> parent) -{ - if (!_handle_orphans) - return; - Raul::PathTable<list<SharedPtr<ObjectModel> > >::iterator c - = _orphans.find(parent->path()); - - if (c != _orphans.end()) { - - list<SharedPtr<ObjectModel> > children = c->second; // take a copy - - _orphans.erase(parent->path()); // prevent infinite recursion - - for (list<SharedPtr<ObjectModel> >::iterator i = children.begin(); - i != children.end(); ++i) { - add_object(*i); - } - } -} - - -void ClientStore::add_object(SharedPtr<ObjectModel> object) { // If we already have "this" object, merge the existing one into the new @@ -250,7 +79,7 @@ ClientStore::add_object(SharedPtr<ObjectModel> object) PtrCast<ObjectModel>(existing->second)->set(object); } else { - if (object->path() != "/") { + if (!object->path().is_root()) { SharedPtr<ObjectModel> parent = this->object(object->path().parent()); if (parent) { assert(object->path().is_child_of(parent->path())); @@ -261,15 +90,17 @@ ClientStore::add_object(SharedPtr<ObjectModel> object) (*this)[object->path()] = object; signal_new_object.emit(object); +#if 0 resolve_variable_orphans(parent); resolve_orphans(parent); SharedPtr<PortModel> port = PtrCast<PortModel>(object); if (port) resolve_connection_orphans(port); +#endif } else { - add_orphan(object); + //add_orphan(object); } } else { (*this)[object->path()] = object; @@ -308,7 +139,7 @@ ClientStore::remove_object(const Path& path) if (result) result->signal_destroyed.emit(); - if (result->path() != "/") { + if (!result->path().is_root()) { assert(result->parent()); SharedPtr<ObjectModel> parent = this->object(result->path().parent()); @@ -328,7 +159,7 @@ ClientStore::remove_object(const Path& path) SharedPtr<PluginModel> -ClientStore::plugin(const string& uri) +ClientStore::plugin(const URI& uri) { assert(uri.length() > 0); Plugins::iterator i = _plugins->find(uri); @@ -349,7 +180,7 @@ ClientStore::object(const Path& path) } else { SharedPtr<ObjectModel> model = PtrCast<ObjectModel>(i->second); assert(model); - assert(model->path() == "/" || model->parent()); + assert(model->path().is_root() || model->parent()); return model; } } @@ -369,7 +200,7 @@ ClientStore::add_plugin(SharedPtr<PluginModel> pm) void -ClientStore::destroy(const std::string& path) +ClientStore::destroy(const Path& path) { SharedPtr<ObjectModel> removed = remove_object(path); removed.reset(); @@ -377,13 +208,8 @@ ClientStore::destroy(const std::string& path) } void -ClientStore::rename(const std::string& old_path_str, const std::string& new_path_str) +ClientStore::rename(const Path& old_path_str, const Path& new_path_str) { - if (!Path::is_valid(old_path_str) || !Path::is_valid(new_path_str)) { - cerr << "[Store] Bad path renaming " << old_path_str << " to " << new_path_str << endl; - return; - } - Path old_path(old_path_str); Path new_path(new_path_str); @@ -427,12 +253,12 @@ ClientStore::rename(const std::string& old_path_str, const std::string& new_path } void -ClientStore::new_plugin(const string& uri, const string& type_uri, const string& symbol) +ClientStore::new_plugin(const URI& uri, const URI& type_uri, const Symbol& symbol) { SharedPtr<PluginModel> p(new PluginModel(uri, type_uri)); p->set_property("lv2:symbol", Atom(Atom::STRING, symbol)); add_plugin(p); - resolve_plugin_orphans(p); + //resolve_plugin_orphans(p); } @@ -464,7 +290,7 @@ ClientStore::new_object(const Shared::GraphObject* object) void -ClientStore::new_patch(const string& path, uint32_t poly) +ClientStore::new_patch(const Path& path, uint32_t poly) { SharedPtr<PatchModel> p(new PatchModel(path, poly)); add_object(p); @@ -472,12 +298,12 @@ ClientStore::new_patch(const string& path, uint32_t poly) void -ClientStore::new_node(const string& path, const string& plugin_uri) +ClientStore::new_node(const Path& path, const URI& plugin_uri) { SharedPtr<PluginModel> plug = plugin(plugin_uri); if (!plug) { SharedPtr<NodeModel> n(new NodeModel(plugin_uri, path)); - add_plugin_orphan(n); + //add_plugin_orphan(n); add_object(n); } else { SharedPtr<NodeModel> n(new NodeModel(plug, path)); @@ -487,27 +313,20 @@ ClientStore::new_node(const string& path, const string& plugin_uri) void -ClientStore::new_port(const string& path, const string& type, uint32_t index, bool is_output) +ClientStore::new_port(const Path& path, const URI& type, uint32_t index, bool is_output) { PortModel::Direction pdir = is_output ? PortModel::OUTPUT : PortModel::INPUT; SharedPtr<PortModel> p(new PortModel(path, index, type, pdir)); add_object(p); - if (p->parent()) - resolve_connection_orphans(p); + /*if (p->parent()) + resolve_connection_orphans(p);*/ } void -ClientStore::clear_patch(const std::string& path_str) +ClientStore::clear_patch(const Path& path) { - if (!Path::is_valid(path_str)) { - cerr << "[Store] Illegal path in clear: " << path_str << endl; - return; - } - - Path path(path_str); - iterator i = find(path); if (i != end()) { assert((*i).second->path() == path); @@ -534,7 +353,7 @@ ClientStore::clear_patch(const std::string& path_str) void -ClientStore::set_variable(const string& subject_path, const string& predicate, const Atom& value) +ClientStore::set_variable(const Path& subject_path, const URI& predicate, const Atom& value) { SharedPtr<ObjectModel> subject = object(subject_path); @@ -543,40 +362,28 @@ ClientStore::set_variable(const string& subject_path, const string& predicate, c } else if (subject) { subject->set_variable(predicate, value); } else { - add_variable_orphan(subject_path, predicate, value); + //add_variable_orphan(subject_path, predicate, value); cerr << "WARNING: variable '" << predicate << "' for unknown object " << subject_path << endl; } } void -ClientStore::set_property(const string& subject_path, const string& predicate, const Atom& value) +ClientStore::set_property(const Path& subject_path, const URI& predicate, const Atom& value) { if (!value.is_valid()) cerr << "WARNING: property '" << predicate << "' is NULL" << endl; - if (Path::is_valid(subject_path)) { - SharedPtr<ObjectModel> obj = object(subject_path); - if (obj) - obj->set_property(predicate, value); - else + SharedPtr<ObjectModel> obj = object(subject_path); + if (obj) + obj->set_property(predicate, value); + else cerr << "WARNING: property '" << predicate << "' for unknown object " << subject_path << endl; - } else { - if (subject_path.find(":") != string::npos - && predicate == "rdf:type" && value.type() == Atom::URI) { - const std::string& type = value.get_uri(); - if ( (type == "http://drobilla.net/ns/ingen#LADSPAPlugin") - || (type == "http://drobilla.net/ns/ingen#Internal") - || (type == "http://lv2plug.in/ns/lv2core#Plugin")) { - add_plugin(SharedPtr<PluginModel>(new PluginModel(subject_path, type))); - } - } - } } void -ClientStore::set_port_value(const string& port_path, const Raul::Atom& value) +ClientStore::set_port_value(const Path& port_path, const Atom& value) { SharedPtr<PortModel> port = PtrCast<PortModel>(object(port_path)); if (port) @@ -587,7 +394,7 @@ ClientStore::set_port_value(const string& port_path, const Raul::Atom& value) void -ClientStore::set_voice_value(const string& port_path, uint32_t voice, const Raul::Atom& value) +ClientStore::set_voice_value(const Path& port_path, uint32_t voice, const Atom& value) { SharedPtr<PortModel> port = PtrCast<PortModel>(object(port_path)); if (port) @@ -654,7 +461,7 @@ ClientStore::attempt_connection(const Path& src_port_path, const Path& dst_port_ patch->add_connection(cm); return true; } else if (add_orphan) { - add_connection_orphan(make_pair(src_port_path, dst_port_path)); + //add_connection_orphan(make_pair(src_port_path, dst_port_path)); } return false; @@ -662,14 +469,14 @@ ClientStore::attempt_connection(const Path& src_port_path, const Path& dst_port_ void -ClientStore::connect(const string& src_port_path, const string& dst_port_path) +ClientStore::connect(const Path& src_port_path, const Path& dst_port_path) { attempt_connection(src_port_path, dst_port_path, true); } void -ClientStore::disconnect(const string& src_port_path, const string& dst_port_path) +ClientStore::disconnect(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. diff --git a/src/client/ClientStore.hpp b/src/client/ClientStore.hpp index d3ab2978..9fb95b0b 100644 --- a/src/client/ClientStore.hpp +++ b/src/client/ClientStore.hpp @@ -31,11 +31,6 @@ namespace Raul { class Atom; } -using namespace std; -using Ingen::Shared::EngineInterface; -using Raul::Path; -using Raul::Atom; - namespace Ingen { namespace Shared { class GraphObject; } @@ -57,37 +52,34 @@ class ConnectionModel; */ class ClientStore : public Shared::Store, public Shared::CommonInterface, public sigc::trackable { public: - ClientStore(SharedPtr<EngineInterface> engine=SharedPtr<EngineInterface>(), + ClientStore(SharedPtr<Shared::EngineInterface> engine=SharedPtr<Shared::EngineInterface>(), SharedPtr<SigClientInterface> emitter=SharedPtr<SigClientInterface>()); - SharedPtr<PluginModel> plugin(const string& uri); - SharedPtr<ObjectModel> object(const Path& path); + SharedPtr<PluginModel> plugin(const Raul::URI& uri); + SharedPtr<ObjectModel> object(const Raul::Path& path); void clear(); - typedef Raul::Table<string, SharedPtr<PluginModel> > Plugins; + typedef Raul::Table<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; } // CommonInterface - void new_plugin(const string& uri, const string& type_uri, const string& symbol); + void new_plugin(const Raul::URI& uri, const Raul::URI& type_uri, const Raul::Symbol& symbol); bool new_object(const Shared::GraphObject* object); - void new_patch(const string& path, uint32_t poly); - void new_node(const string& path, const string& plugin_uri); - void new_port(const string& path, const string& type, uint32_t index, bool is_output); - void rename(const string& old_path, const string& new_path); - void set_variable(const string& subject_path, const string& predicate, const Atom& value); - void set_property(const string& subject_path, const string& predicate, const Atom& value); - void set_port_value(const string& port_path, const Raul::Atom& value); - void set_voice_value(const string& port_path, uint32_t voice, const Raul::Atom& value); - void connect(const string& src_port_path, const string& dst_port_path); - void disconnect(const string& src_port_path, const string& dst_port_path); - void destroy(const string& path); + void new_patch(const Raul::Path& path, uint32_t poly); + void new_node(const Raul::Path& path, const Raul::URI& plugin_uri); + void new_port(const Raul::Path& path, const Raul::URI& type, uint32_t index, bool is_output); + void rename(const Raul::Path& old_path, const Raul::Path& new_path); + void set_variable(const Raul::Path& subject_path, const Raul::URI& predicate, const Raul::Atom& value); + void set_property(const Raul::Path& subject_path, const Raul::URI& predicate, const Raul::Atom& value); + void set_port_value(const Raul::Path& port_path, const Raul::Atom& value); + void set_voice_value(const Raul::Path& port_path, uint32_t voice, const Raul::Atom& value); + void connect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path); + void disconnect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path); + void destroy(const Raul::Path& path); - typedef list< std::pair<Path, Path> > ConnectionRecords; - const ConnectionRecords& connection_records() { return _connection_orphans; } - sigc::signal<void, SharedPtr<ObjectModel> > signal_new_object; sigc::signal<void, SharedPtr<PluginModel> > signal_new_plugin; @@ -96,56 +88,28 @@ private: void add(Shared::GraphObject* o) { throw; } void add_object(SharedPtr<ObjectModel> object); - SharedPtr<ObjectModel> remove_object(const Path& path); + SharedPtr<ObjectModel> remove_object(const Raul::Path& path); void add_plugin(SharedPtr<PluginModel> plugin); - SharedPtr<PatchModel> connection_patch(const Path& src_port_path, const Path& dst_port_path); + SharedPtr<PatchModel> connection_patch(const Raul::Path& src_port_path, const Raul::Path& dst_port_path); - // It would be nice to integrate these somehow.. - - void add_orphan(SharedPtr<ObjectModel> orphan); - void resolve_orphans(SharedPtr<ObjectModel> parent); - - void add_connection_orphan(std::pair<Path, Path> orphan); - void resolve_connection_orphans(SharedPtr<PortModel> port); - - void add_plugin_orphan(SharedPtr<NodeModel> orphan); - void resolve_plugin_orphans(SharedPtr<PluginModel> plugin); - - void add_variable_orphan(const Path& subject, const string& predicate, const Atom& value); - void resolve_variable_orphans(SharedPtr<ObjectModel> subject); - void bundle_begin() {} void bundle_end() {} // Slots for SigClientInterface signals - void object_renamed(const Path& old_path, const Path& new_path); - void clear_patch(const std::string& path); - void activity(const Path& path); + void object_renamed(const Raul::Path& old_path, const Raul::Path& new_path); + void clear_patch(const Raul::Path& path); + void activity(const Raul::Path& path); - bool attempt_connection(const Path& src_port_path, const Path& dst_port_path, bool add_orphan=false); + bool attempt_connection(const Raul::Path& src_port_path, const Raul::Path& dst_port_path, bool add_orphan=false); bool _handle_orphans; - SharedPtr<EngineInterface> _engine; - SharedPtr<SigClientInterface> _emitter; + SharedPtr<Shared::EngineInterface> _engine; + SharedPtr<SigClientInterface> _emitter; SharedPtr<Plugins> _plugins; ///< Map, keyed by plugin 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) */ - Raul::PathTable<list<SharedPtr<ObjectModel> > > _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.. */ - Raul::Table<string, list<SharedPtr<NodeModel> > > _plugin_orphans; - - /** Not orphans OF variable like the above, but orphans which are variable */ - Raul::PathTable<list<std::pair<string, Atom> > > _variable_orphans; - - /** Ditto */ - ConnectionRecords _connection_orphans; }; diff --git a/src/client/ConnectionModel.hpp b/src/client/ConnectionModel.hpp index 46b9050a..d0f98ec7 100644 --- a/src/client/ConnectionModel.hpp +++ b/src/client/ConnectionModel.hpp @@ -48,8 +48,8 @@ public: SharedPtr<PortModel> src_port() const { return _src_port; } SharedPtr<PortModel> dst_port() const { return _dst_port; } - const Path src_port_path() const { return _src_port->path(); } - const Path dst_port_path() const { return _dst_port->path(); } + const Raul::Path src_port_path() const { return _src_port->path(); } + const Raul::Path dst_port_path() const { return _dst_port->path(); } private: friend class ClientStore; diff --git a/src/client/DeprecatedLoader.cpp b/src/client/DeprecatedLoader.cpp index 5a315813..c0591609 100644 --- a/src/client/DeprecatedLoader.cpp +++ b/src/client/DeprecatedLoader.cpp @@ -36,8 +36,10 @@ #define NS_INTERNALS "http://drobilla.net/ns/ingen-internals#" using namespace std; +using namespace Raul; namespace Ingen { +using namespace Shared; namespace Client { @@ -48,21 +50,21 @@ namespace Client { class ControlModel { public: - ControlModel(const Path& port_path, float value) + ControlModel(const Raul::Path& port_path, float value) : _port_path(port_path) , _value(value) { assert(_port_path.find("//") == string::npos); } - const Path& port_path() const { return _port_path; } - void port_path(const string& p) { _port_path = p; } - float value() const { return _value; } - void value(float v) { _value = v; } + const Raul::Path& port_path() const { return _port_path; } + void port_path(const string& p) { _port_path = p; } + float value() const { return _value; } + void value(float v) { _value = v; } private: - Path _port_path; - float _value; + Raul::Path _port_path; + float _value; }; @@ -289,7 +291,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, poly = 1; // Create it, if we're not merging - if (!existing && path != "/") { + if (!existing && !path.is_root()) { _engine->new_patch(path, poly); for (GraphObject::Properties::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) _engine->set_variable(path, i->first, i->second); @@ -333,7 +335,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, list<ControlModel>::const_iterator i = pm->controls().begin(); for ( ; i != pm->controls().end(); ++i) { const float value = i->value(); - _engine->set_port_value(translate_load_path(i->port_path()), Atom(value)); + _engine->set_port_value(translate_load_path(i->port_path().str()), Atom(value)); } } else { cerr << "WARNING: Unknown preset: \"" << pm->name() << endl; @@ -354,7 +356,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, _load_path_translations.clear(); - return path; + return path.str(); } diff --git a/src/client/DeprecatedLoader.hpp b/src/client/DeprecatedLoader.hpp index dd391ca1..c229017c 100644 --- a/src/client/DeprecatedLoader.hpp +++ b/src/client/DeprecatedLoader.hpp @@ -30,10 +30,6 @@ #include "interface/GraphObject.hpp" #include "ObjectModel.hpp" -using std::string; -using Ingen::Shared::EngineInterface; -using Ingen::Shared::GraphObject; - namespace Raul { class Path; } namespace Ingen { @@ -52,41 +48,35 @@ class PresetModel; // defined in DeprecatedLoader.cpp class DeprecatedLoader { public: - DeprecatedLoader(SharedPtr<EngineInterface> engine) - : /*_patch_search_path(".")*/ _engine(engine) + DeprecatedLoader(SharedPtr<Shared::EngineInterface> engine) + : _engine(engine) { assert(_engine); } - /*void path(const string& path) { _patch_search_path = path; } - const string& path() { return _patch_search_path; }*/ - - string find_file(const string& filename, const string& additional_path = ""); - - string load_patch(const Glib::ustring& filename, - bool merge, - boost::optional<Path> parent_path, - boost::optional<Symbol> name, - GraphObject::Properties initial_data, - bool existing = false); + std::string load_patch(const Glib::ustring& filename, + bool merge, + boost::optional<Raul::Path> parent_path, + boost::optional<Raul::Symbol> name, + Shared::GraphObject::Properties initial_data, + bool existing = false); private: - void add_variable(GraphObject::Properties& data, string key, string value); + void add_variable(Shared::GraphObject::Properties& data, std::string key, std::string value); - string nameify_if_invalid(const string& name); - string translate_load_path(const string& path); + std::string nameify_if_invalid(const std::string& name); + std::string translate_load_path(const std::string& path); - //string _patch_search_path; - SharedPtr<EngineInterface> _engine; + SharedPtr<Shared::EngineInterface> _engine; /// Translations of paths from the loading file to actual paths (for deprecated patches) - std::map<string, string> _load_path_translations; + std::map<std::string, std::string> _load_path_translations; - bool load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); - bool load_connection(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); - bool load_subpatch(const string& base_filename, const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); + bool load_node(const Raul::Path& parent, xmlDocPtr doc, const xmlNodePtr cur); + bool load_connection(const Raul::Path& parent, xmlDocPtr doc, const xmlNodePtr cur); + bool load_subpatch(const std::string& base_filename, const Raul::Path& parent, xmlDocPtr doc, const xmlNodePtr cur); - SharedPtr<PresetModel> load_preset(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); + SharedPtr<PresetModel> load_preset(const Raul::Path& parent, xmlDocPtr doc, const xmlNodePtr cur); }; diff --git a/src/client/HTTPClientReceiver.cpp b/src/client/HTTPClientReceiver.cpp index 969d617e..78e0ef7c 100644 --- a/src/client/HTTPClientReceiver.cpp +++ b/src/client/HTTPClientReceiver.cpp @@ -135,7 +135,7 @@ HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, voi { HTTPClientReceiver* me = (HTTPClientReceiver*)ptr; const string path = soup_message_get_uri(msg)->path; - if (path == "/") { + if (path == Path::root_uri) { me->_target->response_ok(0); me->_target->enable(); diff --git a/src/client/HTTPEngineSender.cpp b/src/client/HTTPEngineSender.cpp index 55119160..828af743 100644 --- a/src/client/HTTPEngineSender.cpp +++ b/src/client/HTTPEngineSender.cpp @@ -20,12 +20,14 @@ #include "HTTPEngineSender.hpp" using namespace std; +using namespace Raul; namespace Ingen { +using namespace Shared; namespace Client { -HTTPEngineSender::HTTPEngineSender(const string& engine_url) +HTTPEngineSender::HTTPEngineSender(const URI& engine_url) : _engine_url(engine_url) , _id(0) , _enabled(true) @@ -67,7 +69,7 @@ HTTPEngineSender::register_client(ClientInterface* client) void -HTTPEngineSender::unregister_client(const string& uri) +HTTPEngineSender::unregister_client(const URI& uri) { } @@ -108,22 +110,22 @@ HTTPEngineSender::new_object(const Shared::GraphObject* object) void -HTTPEngineSender::new_patch(const string& path, - uint32_t poly) +HTTPEngineSender::new_patch(const Path& path, + uint32_t poly) { } void -HTTPEngineSender::new_port(const string& path, - const string& type, - uint32_t index, - bool is_output) +HTTPEngineSender::new_port(const Path& path, + const URI& type, + uint32_t index, + bool is_output) { - const string uri = _engine_url + "/patch" + path; + const string uri = _engine_url.str() + "/patch" + path.str(); cout << "HTTP " << uri << " NEW PORT: " << path << endl; SoupMessage* msg = soup_message_new("PUT", uri.c_str()); - string str = string("NEW PORT").append(path).append(type); + string str = string("NEW PORT").append(path.str()).append(type.str()); soup_message_set_request(msg, "application/x-turtle", SOUP_MEMORY_COPY, str.c_str(), str.length()); soup_session_send_message(_session, msg); @@ -131,93 +133,93 @@ HTTPEngineSender::new_port(const string& path, void -HTTPEngineSender::new_node(const string& path, - const string& plugin_uri) +HTTPEngineSender::new_node(const Path& path, + const URI& plugin_uri) { } void -HTTPEngineSender::rename(const string& old_path, - const string& new_name) +HTTPEngineSender::rename(const Path& old_path, + const Path& new_path) { } void -HTTPEngineSender::destroy(const string& path) +HTTPEngineSender::destroy(const Path& path) { } void -HTTPEngineSender::clear_patch(const string& patch_path) +HTTPEngineSender::clear_patch(const Path& patch_path) { } void -HTTPEngineSender::connect(const string& src_port_path, - const string& dst_port_path) +HTTPEngineSender::connect(const Path& src_port_path, + const Path& dst_port_path) { } void -HTTPEngineSender::disconnect(const string& src_port_path, - const string& dst_port_path) +HTTPEngineSender::disconnect(const Path& src_port_path, + const Path& dst_port_path) { } void -HTTPEngineSender::disconnect_all(const string& parent_patch_path, - const string& path) +HTTPEngineSender::disconnect_all(const Path& parent_patch_path, + const Path& path) { } void -HTTPEngineSender::set_port_value(const string& port_path, - const Raul::Atom& value) +HTTPEngineSender::set_port_value(const Path& port_path, + const Atom& value) { } void -HTTPEngineSender::set_voice_value(const string& port_path, - uint32_t voice, - const Raul::Atom& value) +HTTPEngineSender::set_voice_value(const Path& port_path, + uint32_t voice, + const Atom& value) { } void -HTTPEngineSender::set_program(const string& node_path, - uint32_t bank, - uint32_t program) +HTTPEngineSender::set_program(const Path& node_path, + uint32_t bank, + uint32_t program) { } void -HTTPEngineSender::midi_learn(const string& node_path) +HTTPEngineSender::midi_learn(const Path& node_path) { } void -HTTPEngineSender::set_variable(const string& obj_path, - const string& predicate, - const Raul::Atom& value) +HTTPEngineSender::set_variable(const Path& path, + const URI& predicate, + const Atom& value) { } void -HTTPEngineSender::set_property(const string& obj_path, - const string& predicate, - const Raul::Atom& value) +HTTPEngineSender::set_property(const Path& path, + const URI& predicate, + const Atom& value) { } @@ -232,31 +234,31 @@ HTTPEngineSender::ping() void -HTTPEngineSender::request_plugin(const string& uri) +HTTPEngineSender::request_plugin(const URI& uri) { } void -HTTPEngineSender::request_object(const string& path) +HTTPEngineSender::request_object(const Path& path) { } void -HTTPEngineSender::request_port_value(const string& port_path) +HTTPEngineSender::request_port_value(const Path& port_path) { } void -HTTPEngineSender::request_variable(const string& object_path, const string& key) +HTTPEngineSender::request_variable(const Path& object_path, const URI& key) { } void -HTTPEngineSender::request_property(const string& object_path, const string& key) +HTTPEngineSender::request_property(const Path& object_path, const URI& key) { } diff --git a/src/client/HTTPEngineSender.hpp b/src/client/HTTPEngineSender.hpp index 1579e120..7de785fc 100644 --- a/src/client/HTTPEngineSender.hpp +++ b/src/client/HTTPEngineSender.hpp @@ -21,10 +21,8 @@ #include <inttypes.h> #include <string> #include <libsoup/soup.h> +#include "raul/Path.hpp" #include "interface/EngineInterface.hpp" -using std::string; -using Ingen::Shared::EngineInterface; -using Ingen::Shared::ClientInterface; namespace Ingen { namespace Client { @@ -37,12 +35,12 @@ namespace Client { * * \ingroup IngenClient */ -class HTTPEngineSender : public EngineInterface { +class HTTPEngineSender : public Shared::EngineInterface { public: - HTTPEngineSender(const string& engine_url); + HTTPEngineSender(const Raul::URI& engine_url); ~HTTPEngineSender(); - string uri() const { return _engine_url; } + Raul::URI uri() const { return _engine_url; } inline int32_t next_id() { int32_t ret = (_id == -1) ? -1 : _id++; return ret; } @@ -65,8 +63,8 @@ public: void transfer_end() {} // Client registration - void register_client(ClientInterface* client); - void unregister_client(const string& uri); + void register_client(Shared::ClientInterface* client); + void unregister_client(const Raul::URI& uri); // Engine commands void load_plugins(); @@ -76,72 +74,73 @@ public: // Object commands - bool new_object(const Shared::GraphObject* object); + virtual bool new_object(const Shared::GraphObject* object); - void new_patch(const string& path, - uint32_t poly); - - void new_port(const string& path, - const string& type, - uint32_t index, - bool is_output); - - void new_node(const string& path, - const string& plugin_uri); + virtual void new_patch(const Raul::Path& path, + uint32_t poly); - void rename(const string& old_path, - const string& new_name); - - void destroy(const string& path); - - void clear_patch(const string& patch_path); + virtual void new_node(const Raul::Path& path, + const Raul::URI& plugin_uri); - void connect(const string& src_port_path, - const string& dst_port_path); - - void disconnect(const string& src_port_path, - const string& dst_port_path); - - void disconnect_all(const string& parent_patch_path, - const string& path); - - void set_port_value(const string& port_path, - const Raul::Atom& value); - - void set_voice_value(const string& port_path, - uint32_t voice, - const Raul::Atom& value); + virtual void new_port(const Raul::Path& path, + const Raul::URI& type, + uint32_t index, + bool is_output); - void set_program(const string& node_path, - uint32_t bank, - uint32_t program); - - void midi_learn(const string& node_path); - - void set_variable(const string& obj_path, - const string& predicate, - const Raul::Atom& value); + virtual void clear_patch(const Raul::Path& path); + + virtual void destroy(const Raul::Path& path); - void set_property(const string& obj_path, - const string& predicate, - const Raul::Atom& value); + virtual void rename(const Raul::Path& old_path, + const Raul::Path& new_path); + virtual void connect(const Raul::Path& src_port_path, + const Raul::Path& dst_port_path); + + virtual void disconnect(const Raul::Path& src_port_path, + const Raul::Path& dst_port_path); + + virtual void disconnect_all(const Raul::Path& parent_patch_path, + const Raul::Path& path); + + virtual void set_variable(const Raul::Path& subject_path, + const Raul::URI& predicate, + const Raul::Atom& value); + + virtual void set_property(const Raul::Path& subject_path, + const Raul::URI& predicate, + const Raul::Atom& value); + + virtual void set_port_value(const Raul::Path& port_path, + const Raul::Atom& value); + + virtual void set_voice_value(const Raul::Path& port_path, + uint32_t voice, + const Raul::Atom& value); + + virtual void set_program(const Raul::Path& node_path, + uint32_t bank, + uint32_t program); + + virtual void midi_learn(const Raul::Path& node_path); + + // Requests // void ping(); - void request_plugin(const string& uri); - void request_object(const string& path); - void request_port_value(const string& port_path); - void request_variable(const string& path, const string& key); - void request_property(const string& path, const string& key); + void request_plugin(const Raul::URI& uri); + void request_object(const Raul::Path& path); + void request_port_value(const Raul::Path& port_path); + void request_variable(const Raul::Path& path, const Raul::URI& key); + void request_property(const Raul::Path& path, const Raul::URI& key); void request_plugins(); void request_all_objects(); protected: - SoupSession* _session; - const string _engine_url; - int _client_port; - int32_t _id; - bool _enabled; + SoupSession* _session; + const Raul::URI _engine_url; + int _client_port; + int32_t _id; + bool _enabled; }; diff --git a/src/client/NodeModel.cpp b/src/client/NodeModel.cpp index 5c8f0d28..97743098 100644 --- a/src/client/NodeModel.cpp +++ b/src/client/NodeModel.cpp @@ -21,6 +21,9 @@ #include "interface/Port.hpp" #include "NodeModel.hpp" +using namespace std; +using namespace Raul; + namespace Ingen { namespace Client { @@ -35,7 +38,7 @@ NodeModel::NodeModel(SharedPtr<PluginModel> plugin, const Path& path) { } -NodeModel::NodeModel(const string& plugin_uri, const Path& path) +NodeModel::NodeModel(const URI& plugin_uri, const Path& path) : ObjectModel(path) , _plugin_uri(plugin_uri) , _num_values(0) diff --git a/src/client/NodeModel.hpp b/src/client/NodeModel.hpp index 1cf7233a..cc9811fd 100644 --- a/src/client/NodeModel.hpp +++ b/src/client/NodeModel.hpp @@ -54,7 +54,7 @@ public: Shared::Port* port(uint32_t index) const; - const std::string& plugin_uri() const { return _plugin_uri; } + const Raul::URI& plugin_uri() const { return _plugin_uri; } const Shared::Plugin* plugin() const { return _plugin.get(); } uint32_t num_ports() const { return _ports.size(); } const Ports& ports() const { return _ports; } @@ -68,15 +68,15 @@ public: protected: friend class ClientStore; - NodeModel(const std::string& plugin_uri, const Path& path); - NodeModel(SharedPtr<PluginModel> plugin, const Path& path); + NodeModel(const Raul::URI& plugin_uri, const Raul::Path& path); + NodeModel(SharedPtr<PluginModel> plugin, const Raul::Path& path); - NodeModel(const Path& path); + NodeModel(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 remove_port(const Path& port_path); + void remove_port(const Raul::Path& port_path); void add_program(int bank, int program, const std::string& name); void remove_program(int bank, int program); void set(SharedPtr<ObjectModel> model); @@ -84,7 +84,7 @@ protected: virtual void clear(); Ports _ports; ///< Vector of ports (not a Table to preserve order) - std::string _plugin_uri; ///< Plugin URI (if PluginModel is unknown) + Raul::URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown) SharedPtr<PluginModel> _plugin; ///< The plugin this node is an instance of private: diff --git a/src/client/OSCEngineSender.cpp b/src/client/OSCEngineSender.cpp index 8ff0b226..5bbbf5a0 100644 --- a/src/client/OSCEngineSender.cpp +++ b/src/client/OSCEngineSender.cpp @@ -17,13 +17,14 @@ #include <iostream> #include "raul/AtomLiblo.hpp" +#include "raul/Path.hpp" #include "OSCEngineSender.hpp" #include "common/interface/Patch.hpp" #include "common/interface/Port.hpp" #include "common/interface/Plugin.hpp" using namespace std; -using Raul::Atom; +using namespace Raul; namespace Ingen { namespace Client { @@ -33,7 +34,7 @@ namespace Client { * from the most recently created server, so create the OSC listener before * this to have it all happen on the same port. Yeah, this is a big magic :/ */ -OSCEngineSender::OSCEngineSender(const string& engine_url) +OSCEngineSender::OSCEngineSender(const URI& engine_url) : _engine_url(engine_url) , _id(0) { @@ -84,7 +85,7 @@ OSCEngineSender::attach(int32_t ping_id, bool block) * traversal. It is a parameter to remain compatible with EngineInterface. */ void -OSCEngineSender::register_client(ClientInterface* client) +OSCEngineSender::register_client(Shared::ClientInterface* client) { // FIXME: use parameters.. er, somehow. send("/ingen/register_client", "i", next_id(), LO_ARGS_END, LO_ARGS_END); @@ -92,7 +93,7 @@ OSCEngineSender::register_client(ClientInterface* client) void -OSCEngineSender::unregister_client(const string& uri) +OSCEngineSender::unregister_client(const URI& uri) { send("/ingen/unregister_client", "i", next_id(), LO_ARGS_END); } @@ -159,8 +160,8 @@ OSCEngineSender::new_object(const Shared::GraphObject* object) void -OSCEngineSender::new_patch(const string& path, - uint32_t poly) +OSCEngineSender::new_patch(const Path& path, + uint32_t poly) { send("/ingen/new_patch", "isi", next_id(), @@ -171,10 +172,10 @@ OSCEngineSender::new_patch(const string& path, void -OSCEngineSender::new_port(const string& path, - const string& type, - uint32_t index, - bool is_output) +OSCEngineSender::new_port(const Path& path, + const URI& type, + uint32_t index, + bool is_output) { // FIXME: use index send("/ingen/new_port", "issi", @@ -187,8 +188,8 @@ OSCEngineSender::new_port(const string& path, void -OSCEngineSender::new_node(const string& path, - const string& plugin_uri) +OSCEngineSender::new_node(const Path& path, + const URI& plugin_uri) { send("/ingen/new_node", "iss", @@ -200,19 +201,19 @@ OSCEngineSender::new_node(const string& path, void -OSCEngineSender::rename(const string& old_path, - const string& new_name) +OSCEngineSender::rename(const Path& old_path, + const Path& new_path) { send("/ingen/rename", "iss", next_id(), old_path.c_str(), - new_name.c_str(), + new_path.c_str(), LO_ARGS_END); } void -OSCEngineSender::destroy(const string& path) +OSCEngineSender::destroy(const Path& path) { send("/ingen/destroy", "is", next_id(), @@ -222,7 +223,7 @@ OSCEngineSender::destroy(const string& path) void -OSCEngineSender::clear_patch(const string& patch_path) +OSCEngineSender::clear_patch(const Path& patch_path) { send("/ingen/clear_patch", "is", next_id(), @@ -232,8 +233,8 @@ OSCEngineSender::clear_patch(const string& patch_path) void -OSCEngineSender::connect(const string& src_port_path, - const string& dst_port_path) +OSCEngineSender::connect(const Path& src_port_path, + const Path& dst_port_path) { send("/ingen/connect", "iss", next_id(), @@ -244,8 +245,8 @@ OSCEngineSender::connect(const string& src_port_path, void -OSCEngineSender::disconnect(const string& src_port_path, - const string& dst_port_path) +OSCEngineSender::disconnect(const Path& src_port_path, + const Path& dst_port_path) { send("/ingen/disconnect", "iss", next_id(), @@ -256,8 +257,8 @@ OSCEngineSender::disconnect(const string& src_port_path, void -OSCEngineSender::disconnect_all(const string& parent_patch_path, - const string& path) +OSCEngineSender::disconnect_all(const Path& parent_patch_path, + const Path& path) { send("/ingen/disconnect_all", "iss", next_id(), @@ -268,8 +269,8 @@ OSCEngineSender::disconnect_all(const string& parent_patch_path, void -OSCEngineSender::set_port_value(const string& port_path, - const Raul::Atom& value) +OSCEngineSender::set_port_value(const Path& port_path, + const Atom& value) { lo_message m = lo_message_new(); lo_message_add_int32(m, next_id()); @@ -282,9 +283,9 @@ OSCEngineSender::set_port_value(const string& port_path, void -OSCEngineSender::set_voice_value(const string& port_path, - uint32_t voice, - const Raul::Atom& value) +OSCEngineSender::set_voice_value(const Path& port_path, + uint32_t voice, + const Atom& value) { lo_message m = lo_message_new(); lo_message_add_int32(m, next_id()); @@ -298,11 +299,11 @@ OSCEngineSender::set_voice_value(const string& port_path, void -OSCEngineSender::set_program(const string& node_path, - uint32_t bank, - uint32_t program) +OSCEngineSender::set_program(const Path& node_path, + uint32_t bank, + uint32_t program) { - send((string("/dssi") + node_path + "/program").c_str(), + send((string("/dssi") + node_path.str() + "/program").c_str(), "ii", bank, program, @@ -311,7 +312,7 @@ OSCEngineSender::set_program(const string& node_path, void -OSCEngineSender::midi_learn(const string& node_path) +OSCEngineSender::midi_learn(const Path& node_path) { send("/ingen/midi_learn", "is", next_id(), @@ -321,9 +322,9 @@ OSCEngineSender::midi_learn(const string& node_path) void -OSCEngineSender::set_variable(const string& obj_path, - const string& predicate, - const Raul::Atom& value) +OSCEngineSender::set_variable(const Path& obj_path, + const URI& predicate, + const Atom& value) { lo_message m = lo_message_new(); lo_message_add_int32(m, next_id()); @@ -335,9 +336,9 @@ OSCEngineSender::set_variable(const string& obj_path, void -OSCEngineSender::set_property(const string& obj_path, - const string& predicate, - const Raul::Atom& value) +OSCEngineSender::set_property(const Path& obj_path, + const URI& predicate, + const Atom& value) { lo_message m = lo_message_new(); lo_message_add_int32(m, next_id()); @@ -359,7 +360,7 @@ OSCEngineSender::ping() void -OSCEngineSender::request_plugin(const string& uri) +OSCEngineSender::request_plugin(const URI& uri) { send("/ingen/request_plugin", "is", next_id(), @@ -369,7 +370,7 @@ OSCEngineSender::request_plugin(const string& uri) void -OSCEngineSender::request_object(const string& path) +OSCEngineSender::request_object(const Path& path) { send("/ingen/request_object", "is", next_id(), @@ -379,7 +380,7 @@ OSCEngineSender::request_object(const string& path) void -OSCEngineSender::request_port_value(const string& port_path) +OSCEngineSender::request_port_value(const Path& port_path) { send("/ingen/request_port_value", "is", next_id(), @@ -389,7 +390,7 @@ OSCEngineSender::request_port_value(const string& port_path) void -OSCEngineSender::request_variable(const string& object_path, const string& key) +OSCEngineSender::request_variable(const Path& object_path, const URI& key) { send("/ingen/request_variable", "iss", next_id(), @@ -400,7 +401,7 @@ OSCEngineSender::request_variable(const string& object_path, const string& key) void -OSCEngineSender::request_property(const string& object_path, const string& key) +OSCEngineSender::request_property(const Path& object_path, const URI& key) { send("/ingen/request_property", "iss", next_id(), @@ -424,7 +425,6 @@ OSCEngineSender::request_all_objects() } - } // namespace Client } // namespace Ingen diff --git a/src/client/OSCEngineSender.hpp b/src/client/OSCEngineSender.hpp index cae8586a..6771de71 100644 --- a/src/client/OSCEngineSender.hpp +++ b/src/client/OSCEngineSender.hpp @@ -23,9 +23,6 @@ #include <lo/lo.h> #include "interface/EngineInterface.hpp" #include "shared/OSCSender.hpp" -using std::string; -using Ingen::Shared::EngineInterface; -using Ingen::Shared::ClientInterface; namespace Ingen { namespace Client { @@ -38,16 +35,16 @@ namespace Client { * * \ingroup IngenClient */ -class OSCEngineSender : public EngineInterface, public Shared::OSCSender { +class OSCEngineSender : public Shared::EngineInterface, public Shared::OSCSender { public: - OSCEngineSender(const string& engine_url); + OSCEngineSender(const Raul::URI& engine_url); ~OSCEngineSender(); - static OSCEngineSender* create(const std::string& engine_url) { + static OSCEngineSender* create(const Raul::URI& engine_url) { return new OSCEngineSender(engine_url); } - std::string uri() const { return _engine_url; } + Raul::URI uri() const { return _engine_url; } inline int32_t next_id() { int32_t ret = (_id == -1) ? -1 : _id++; return ret; } @@ -69,8 +66,8 @@ public: void transfer_end() { OSCSender::transfer_end(); } // Client registration - void register_client(ClientInterface* client); - void unregister_client(const string& uri); + void register_client(Shared::ClientInterface* client); + void unregister_client(const Raul::URI& uri); // Engine commands void load_plugins(); @@ -80,70 +77,71 @@ public: // Object commands - bool new_object(const Shared::GraphObject* object); - - void new_patch(const string& path, - uint32_t poly); - - void new_port(const string& path, - const string& type, - uint32_t index, - bool is_output); + virtual bool new_object(const Shared::GraphObject* object); - void new_node(const string& path, - const string& plugin_uri); + virtual void new_patch(const Raul::Path& path, + uint32_t poly); - void rename(const string& old_path, - const string& new_name); - - void destroy(const string& path); - - void clear_patch(const string& patch_path); + virtual void new_node(const Raul::Path& path, + const Raul::URI& plugin_uri); - void connect(const string& src_port_path, - const string& dst_port_path); - - void disconnect(const string& src_port_path, - const string& dst_port_path); - - void disconnect_all(const string& parent_patch_path, - const string& path); - - void set_port_value(const string& port_path, - const Raul::Atom& value); - - void set_voice_value(const string& port_path, - uint32_t voice, - const Raul::Atom& value); + virtual void new_port(const Raul::Path& path, + const Raul::URI& type, + uint32_t index, + bool is_output); + + virtual void clear_patch(const Raul::Path& path); + + virtual void destroy(const Raul::Path& path); - void set_program(const string& node_path, - uint32_t bank, - uint32_t program); + virtual void rename(const Raul::Path& old_path, + const Raul::Path& new_path); + + virtual void connect(const Raul::Path& src_port_path, + const Raul::Path& dst_port_path); + + virtual void disconnect(const Raul::Path& src_port_path, + const Raul::Path& dst_port_path); + + virtual void disconnect_all(const Raul::Path& parent_patch_path, + const Raul::Path& path); + + virtual void set_variable(const Raul::Path& subject_path, + const Raul::URI& predicate, + const Raul::Atom& value); + + virtual void set_property(const Raul::Path& subject_path, + const Raul::URI& predicate, + const Raul::Atom& value); + + virtual void set_port_value(const Raul::Path& port_path, + const Raul::Atom& value); + + virtual void set_voice_value(const Raul::Path& port_path, + uint32_t voice, + const Raul::Atom& value); + + virtual void set_program(const Raul::Path& node_path, + uint32_t bank, + uint32_t program); - void midi_learn(const string& node_path); + virtual void midi_learn(const Raul::Path& node_path); - void set_variable(const string& obj_path, - const string& predicate, - const Raul::Atom& value); - - void set_property(const string& obj_path, - const string& predicate, - const Raul::Atom& value); // Requests // void ping(); - void request_plugin(const string& uri); - void request_object(const string& path); - void request_port_value(const string& port_path); - void request_variable(const string& path, const string& key); - void request_property(const string& path, const string& key); + void request_plugin(const Raul::URI& uri); + void request_object(const Raul::Path& path); + void request_port_value(const Raul::Path& port_path); + void request_variable(const Raul::Path& path, const Raul::URI& key); + void request_property(const Raul::Path& path, const Raul::URI& key); void request_plugins(); void request_all_objects(); protected: - const string _engine_url; - int _client_port; - int32_t _id; + const Raul::URI _engine_url; + int _client_port; + int32_t _id; }; diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp index f5972af5..68326a3d 100644 --- a/src/client/ObjectModel.cpp +++ b/src/client/ObjectModel.cpp @@ -21,13 +21,14 @@ #include "ObjectModel.hpp" using namespace std; +using namespace Raul; namespace Ingen { namespace Client { ObjectModel::ObjectModel(const Path& path) - : ResourceImpl(string("patch/") + path) + : ResourceImpl(path) , _path(path) { } @@ -43,7 +44,7 @@ ObjectModel::~ObjectModel() * @return Metadata value with key @a key, empty string otherwise. */ const Atom& -ObjectModel::get_variable(const string& key) const +ObjectModel::get_variable(const URI& key) const { static const Atom null_atom; @@ -60,7 +61,7 @@ ObjectModel::get_variable(const string& key) const * @return Metadata value with key @a key, empty string otherwise. */ Atom& -ObjectModel::get_variable( string& key) +ObjectModel::get_variable(URI& key) { static Atom null_atom; diff --git a/src/client/ObjectModel.hpp b/src/client/ObjectModel.hpp index 4d02e546..230a030e 100644 --- a/src/client/ObjectModel.hpp +++ b/src/client/ObjectModel.hpp @@ -20,22 +20,17 @@ #include <cstdlib> #include <iostream> -#include <string> #include <algorithm> #include <cassert> #include <boost/utility.hpp> #include <sigc++/sigc++.h> #include "raul/Atom.hpp" #include "raul/Path.hpp" +#include "raul/URI.hpp" #include "raul/SharedPtr.hpp" #include "interface/GraphObject.hpp" #include "shared/ResourceImpl.hpp" -using std::string; -using Raul::Atom; -using Raul::Path; -using Raul::Symbol; - namespace Ingen { namespace Client { @@ -59,50 +54,50 @@ class ObjectModel : virtual public Ingen::Shared::GraphObject public: virtual ~ObjectModel(); - const Atom& get_variable(const string& key) const; - Atom& get_variable(string& key); + const Raul::Atom& get_variable(const Raul::URI& key) const; + Raul::Atom& get_variable(Raul::URI& key); - virtual void set_property(const string& key, const Atom& value) { + virtual void set_property(const Raul::URI& key, const Raul::Atom& value) { ResourceImpl::set_property(key, value); signal_property.emit(key, value); } - virtual void set_variable(const string& key, const Atom& value) + virtual void set_variable(const Raul::URI& key, const Raul::Atom& value) { _variables[key] = value; signal_variable.emit(key, value); } - const Properties& variables() const { return _variables; } - Properties& variables() { return _variables; } - const Path path() const { return _path; } - const Symbol symbol() const { return _path.name(); } + const Properties& variables() const { return _variables; } + Properties& variables() { return _variables; } + const Raul::Path path() const { return _path; } + const Raul::Symbol symbol() const { return _path.name(); } SharedPtr<ObjectModel> parent() const { return _parent; } bool polyphonic() const; GraphObject* graph_parent() const { return _parent.get(); } // Signals - sigc::signal<void, SharedPtr<ObjectModel> > signal_new_child; - sigc::signal<void, SharedPtr<ObjectModel> > signal_removed_child; - sigc::signal<void, const string&, const Atom&> signal_variable; - sigc::signal<void, const string&, const Atom&> signal_property; - sigc::signal<void> signal_destroyed; - sigc::signal<void> signal_renamed; + sigc::signal<void, SharedPtr<ObjectModel> > signal_new_child; + sigc::signal<void, SharedPtr<ObjectModel> > signal_removed_child; + sigc::signal<void, const Raul::URI&, const Raul::Atom&> signal_variable; + sigc::signal<void, const Raul::URI&, const Raul::Atom&> signal_property; + sigc::signal<void> signal_destroyed; + sigc::signal<void> signal_renamed; protected: friend class ClientStore; - ObjectModel(const Path& path); + ObjectModel(const Raul::Path& path); - virtual void set_path(const Path& p) { _path = p; signal_renamed.emit(); } + virtual void set_path(const Raul::Path& p) { _path = p; signal_renamed.emit(); } virtual void set_parent(SharedPtr<ObjectModel> p) { assert(p); _parent = p; } virtual void add_child(SharedPtr<ObjectModel> c) {} virtual bool remove_child(SharedPtr<ObjectModel> c) { return true; } virtual void set(SharedPtr<ObjectModel> model); - Path _path; + Raul::Path _path; SharedPtr<ObjectModel> _parent; - Properties _variables; + Properties _variables; }; diff --git a/src/client/PatchModel.cpp b/src/client/PatchModel.cpp index 980a902c..1f322259 100644 --- a/src/client/PatchModel.cpp +++ b/src/client/PatchModel.cpp @@ -23,6 +23,7 @@ #include "ClientStore.hpp" using namespace std; +using namespace Raul; namespace Ingen { namespace Client { @@ -97,7 +98,7 @@ PatchModel::clear() SharedPtr<ConnectionModel> -PatchModel::get_connection(const string& src_port_path, const string& dst_port_path) const +PatchModel::get_connection(const Path& src_port_path, const Path& dst_port_path) const { for (Connections::const_iterator i = _connections->begin(); i != _connections->end(); ++i) if ((*i)->src_port_path() == src_port_path && (*i)->dst_port_path() == dst_port_path) @@ -142,7 +143,7 @@ PatchModel::add_connection(SharedPtr<ConnectionModel> cm) void -PatchModel::remove_connection(const string& src_port_path, const string& dst_port_path) +PatchModel::remove_connection(const Path& src_port_path, const Path& dst_port_path) { for (Connections::iterator i = _connections->begin(); i != _connections->end(); ++i) { SharedPtr<ConnectionModel> cm = PtrCast<ConnectionModel>(*i); @@ -169,10 +170,10 @@ PatchModel::enabled() const void -PatchModel::set_variable(const std::string& key, const Atom& value) +PatchModel::set_variable(const Raul::URI& key, const Atom& value) { NodeModel::set_variable(key, value); - if (key == "ingen:polyphony") + if (key.str() == "ingen:polyphony") _poly = value.get_int32(); } diff --git a/src/client/PatchModel.hpp b/src/client/PatchModel.hpp index 4a8b3ee7..b07924cc 100644 --- a/src/client/PatchModel.hpp +++ b/src/client/PatchModel.hpp @@ -19,7 +19,6 @@ #define PATCHMODEL_H #include <cassert> -#include <string> #include <sigc++/sigc++.h> #include "raul/SharedPtr.hpp" #include "interface/Patch.hpp" @@ -27,8 +26,6 @@ #include "ConnectionModel.hpp" -using std::string; - namespace Ingen { namespace Client { @@ -46,8 +43,8 @@ public: const Connections& connections() const { return *_connections.get(); } - SharedPtr<ConnectionModel> get_connection(const string& src_port_path, - const string& dst_port_path) const; + SharedPtr<ConnectionModel> get_connection(const Raul::Path& src_port_path, + const Raul::Path& dst_port_path) const; uint32_t poly() const { return _poly; } uint32_t internal_polyphony() const { return _poly; } @@ -63,7 +60,7 @@ public: signal_editable.emit(e); } } - virtual void set_variable(const string& key, const Atom& value); + virtual void set_variable(const Raul::URI& key, const Raul::Atom& value); // Signals sigc::signal<void, SharedPtr<NodeModel> > signal_new_node; @@ -75,7 +72,7 @@ public: private: friend class ClientStore; - PatchModel(const Path& patch_path, size_t internal_poly) + PatchModel(const Raul::Path& patch_path, size_t internal_poly) : NodeModel("ingen:Patch", patch_path) , _connections(new Connections()) , _poly(internal_poly) @@ -88,15 +85,13 @@ private: bool remove_child(SharedPtr<ObjectModel> c); void add_connection(SharedPtr<ConnectionModel> cm); - void remove_connection(const string& src_port_path, const string& dst_port_path); + void remove_connection(const Raul::Path& src_port_path, const Raul::Path& dst_port_path); SharedPtr<Connections> _connections; uint32_t _poly; bool _editable; }; -typedef Raul::Table<string, SharedPtr<PatchModel> > PatchModelMap; - } // namespace Client } // namespace Ingen diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 02d68330..6f6aa715 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -24,7 +24,7 @@ #include "PluginUI.hpp" using namespace std; -using Ingen::Shared::EngineInterface; +using namespace Raul; namespace Ingen { namespace Client { @@ -37,9 +37,9 @@ SLV2Plugins PluginModel::_slv2_plugins = NULL; Redland::World* PluginModel::_rdf_world = NULL; -PluginModel::PluginModel(const string& uri, const string& type_uri) +PluginModel::PluginModel(const URI& uri, const URI& type_uri) : ResourceImpl(uri) - , _type(type_from_uri(_rdf_world->prefixes().qualify(type_uri))) + , _type(type_from_uri(_rdf_world->prefixes().qualify(type_uri.str()))) { Glib::Mutex::Lock lock(_rdf_world->mutex()); assert(_rdf_world); diff --git a/src/client/PluginModel.hpp b/src/client/PluginModel.hpp index c50aef6f..b2f4cd0e 100644 --- a/src/client/PluginModel.hpp +++ b/src/client/PluginModel.hpp @@ -19,7 +19,6 @@ #define PLUGINMODEL_H #include "ingen-config.h" -#include <string> #include <iostream> #include "raul/SharedPtr.hpp" #include "redlandmm/World.hpp" @@ -31,8 +30,6 @@ #include "module/World.hpp" #include "shared/ResourceImpl.hpp" -using std::string; - namespace Ingen { namespace Client { @@ -49,16 +46,16 @@ class PluginModel : public Ingen::Shared::Plugin , public Ingen::Shared::ResourceImpl { public: - PluginModel(const string& uri, const string& type_uri); + PluginModel(const Raul::URI& uri, const Raul::URI& type_uri); Type type() const { return _type; } - const string symbol() const { return string_property("lv2:symbol"); } - const string name() const { return string_property("doap:name"); } + const std::string symbol() const { return string_property("lv2:symbol"); } + const std::string name() const { return string_property("doap:name"); } - string default_node_symbol() const; - string human_name(); - string port_human_name(uint32_t index) const; + std::string default_node_symbol() const; + std::string human_name(); + std::string port_human_name(uint32_t index) const; #ifdef HAVE_SLV2 static SLV2World slv2_world() { return _slv2_world; } @@ -80,8 +77,8 @@ public: SharedPtr<PluginUI> ui(Ingen::Shared::World* world, SharedPtr<NodeModel> node) const; - const string& icon_path() const; - static string get_lv2_icon_path(SLV2Plugin plugin); + const std::string& icon_path() const; + static std::string get_lv2_icon_path(SLV2Plugin plugin); #endif static void set_rdf_world(Redland::World& world) { @@ -93,14 +90,14 @@ public: private: const Type _type; - const string string_property(const std::string& name) const; + const std::string string_property(const std::string& name) const; #ifdef HAVE_SLV2 static SLV2World _slv2_world; static SLV2Plugins _slv2_plugins; - SLV2Plugin _slv2_plugin; - mutable string _icon_path; + SLV2Plugin _slv2_plugin; + mutable std::string _icon_path; #endif static Redland::World* _rdf_world; diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index 6898dd71..63bef6b2 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -23,7 +23,7 @@ #include "PortModel.hpp" using namespace std; -using Ingen::Shared::EngineInterface; +using namespace Raul; using Ingen::Shared::LV2URIMap; using Ingen::Shared::LV2Features; diff --git a/src/client/PortModel.cpp b/src/client/PortModel.cpp index af257ebf..d62aa236 100644 --- a/src/client/PortModel.cpp +++ b/src/client/PortModel.cpp @@ -24,7 +24,7 @@ namespace Client { bool PortModel::has_hint(const std::string& qname) const { - const Atom& hint = get_variable(qname); + const Raul::Atom& hint = get_variable(qname); return (hint.is_valid() && hint.get_bool() > 0); } diff --git a/src/client/PortModel.hpp b/src/client/PortModel.hpp index 3c4d779c..23fce480 100644 --- a/src/client/PortModel.hpp +++ b/src/client/PortModel.hpp @@ -41,12 +41,12 @@ class PortModel : public ObjectModel, public Ingen::Shared::Port public: enum Direction { INPUT, OUTPUT }; - inline uint32_t index() const { return _index; } - inline DataType type() const { return _type; } - inline const Atom& value() const { return _current_val; } - inline bool connected() const { return (_connections > 0); } - inline bool is_input() const { return (_direction == INPUT); } - inline bool is_output() const { return (_direction == OUTPUT); } + inline uint32_t index() const { return _index; } + inline DataType type() const { return _type; } + inline const Raul::Atom& value() const { return _current_val; } + inline bool connected() const { return (_connections > 0); } + inline bool is_input() const { return (_direction == INPUT); } + inline bool is_output() const { return (_direction == OUTPUT); } bool has_hint(const std::string& qname) const; @@ -56,29 +56,29 @@ public: inline bool operator==(const PortModel& pm) const { return (_path == pm._path); } - inline void value(const Atom& val) { + inline void value(const Raul::Atom& val) { if (val != _current_val) { _current_val = val; signal_value_changed.emit(val); } } - inline void value(uint32_t voice, const Atom& val) { + inline void value(uint32_t voice, const Raul::Atom& val) { // FIXME: implement properly signal_voice_changed.emit(voice, val); } // Signals - sigc::signal<void, const Atom&> signal_value_changed; ///< Value ports - sigc::signal<void, uint32_t, const Atom&> signal_voice_changed; ///< Polyphonic value ports - sigc::signal<void> signal_activity; ///< Message ports - sigc::signal<void, SharedPtr<PortModel> > signal_connection; - sigc::signal<void, SharedPtr<PortModel> > signal_disconnection; + sigc::signal<void, const Raul::Atom&> signal_value_changed; ///< Value ports + sigc::signal<void, uint32_t, const Raul::Atom&> signal_voice_changed; ///< Polyphonic value ports + sigc::signal<void> signal_activity; ///< Message ports + sigc::signal<void, SharedPtr<PortModel> > signal_connection; + sigc::signal<void, SharedPtr<PortModel> > signal_disconnection; private: friend class ClientStore; - PortModel(const Path& path, uint32_t index, DataType type, Direction dir) + PortModel(const Raul::Path& path, uint32_t index, DataType type, Direction dir) : ObjectModel(path) , _index(index) , _type(type) @@ -98,11 +98,11 @@ private: void set(SharedPtr<ObjectModel> model); - uint32_t _index; - DataType _type; - Direction _direction; - Atom _current_val; - size_t _connections; + uint32_t _index; + DataType _type; + Direction _direction; + Raul::Atom _current_val; + size_t _connections; }; diff --git a/src/client/SigClientInterface.hpp b/src/client/SigClientInterface.hpp index ff54bab5..40b30e47 100644 --- a/src/client/SigClientInterface.hpp +++ b/src/client/SigClientInterface.hpp @@ -19,10 +19,9 @@ #define SIGCLIENTINTERFACE_H #include <inttypes.h> -#include <string> #include <sigc++/sigc++.h> +#include "raul/Path.hpp" #include "interface/ClientInterface.hpp" -using std::string; namespace Ingen { namespace Client { @@ -44,32 +43,32 @@ public: bool enabled() const { return _enabled; } - std::string uri() const { return "(internal)"; } + Raul::URI uri() const { return "ingen:internal"; } // Signal parameters match up directly with ClientInterface calls sigc::signal<bool, const Shared::GraphObject*> signal_new_object; - sigc::signal<void, int32_t> signal_response_ok; - sigc::signal<void, int32_t, string> signal_response_error; - sigc::signal<void> signal_bundle_begin; - sigc::signal<void> signal_bundle_end; - sigc::signal<void, string> signal_error; - sigc::signal<void, string, string, string> signal_new_plugin; - sigc::signal<void, string, uint32_t> signal_new_patch; - sigc::signal<void, string, string> signal_new_node; - sigc::signal<void, string, string, uint32_t, bool> signal_new_port; - sigc::signal<void, string> signal_clear_patch; - sigc::signal<void, string, string> signal_object_renamed; - sigc::signal<void, string> signal_object_destroyed; - sigc::signal<void, string, string> signal_connection; - sigc::signal<void, string, string> signal_disconnection; - sigc::signal<void, string, string, Raul::Atom> signal_variable_change; - sigc::signal<void, string, string, Raul::Atom> signal_property_change; - sigc::signal<void, string, Raul::Atom> signal_port_value; - sigc::signal<void, string, uint32_t, Raul::Atom> signal_voice_value; - sigc::signal<void, string> signal_activity; - sigc::signal<void, string, uint32_t, uint32_t, string> signal_program_add; - sigc::signal<void, string, uint32_t, uint32_t> signal_program_remove; + sigc::signal<void, int32_t> signal_response_ok; + sigc::signal<void, int32_t, std::string> signal_response_error; + sigc::signal<void> signal_bundle_begin; + sigc::signal<void> signal_bundle_end; + sigc::signal<void, std::string> signal_error; + sigc::signal<void, Raul::URI, Raul::URI, Raul::Symbol> signal_new_plugin; + sigc::signal<void, Raul::Path, uint32_t> signal_new_patch; + sigc::signal<void, Raul::Path, Raul::URI> signal_new_node; + sigc::signal<void, Raul::Path, Raul::URI, uint32_t, bool> signal_new_port; + sigc::signal<void, Raul::Path> signal_clear_patch; + sigc::signal<void, Raul::Path, Raul::Path> signal_object_renamed; + sigc::signal<void, Raul::Path> signal_object_destroyed; + sigc::signal<void, Raul::Path, Raul::Path> signal_connection; + sigc::signal<void, Raul::Path, Raul::Path> signal_disconnection; + sigc::signal<void, Raul::Path, Raul::URI, Raul::Atom> signal_variable_change; + sigc::signal<void, Raul::Path, Raul::URI, Raul::Atom> signal_property_change; + sigc::signal<void, Raul::Path, Raul::Atom> signal_port_value; + sigc::signal<void, Raul::Path, uint32_t, Raul::Atom> signal_voice_value; + sigc::signal<void, Raul::Path> signal_activity; + sigc::signal<void, Raul::Path, uint32_t, uint32_t, std::string> signal_program_add; + sigc::signal<void, Raul::Path, uint32_t, uint32_t> signal_program_remove; /** Fire pending signals. Only does anything on derived classes (that may queue) */ virtual bool emit_signals() { return false; } @@ -95,61 +94,61 @@ protected: void response_ok(int32_t id) { if (_enabled) signal_response_ok.emit(id); } - void response_error(int32_t id, const string& msg) + void response_error(int32_t id, const std::string& msg) { if (_enabled) signal_response_error.emit(id, msg); } - void error(const string& msg) + void error(const std::string& msg) { if (_enabled) signal_error.emit(msg); } - void new_plugin(const string& uri, const string& type_uri, const string& symbol) + void new_plugin(const Raul::URI& uri, const Raul::URI& type_uri, const Raul::Symbol& symbol) { if (_enabled) signal_new_plugin.emit(uri, type_uri, symbol); } bool new_object(const Shared::GraphObject* object) { if (_enabled) signal_new_object.emit(object); return false; } - void new_patch(const string& path, uint32_t poly) + void new_patch(const Raul::Path& path, uint32_t poly) { if (_enabled) signal_new_patch.emit(path, poly); } - void new_node(const string& path, const string& plugin_uri) + void new_node(const Raul::Path& path, const Raul::URI& plugin_uri) { if (_enabled) signal_new_node.emit(path, plugin_uri); } - void new_port(const string& path, const string& type, uint32_t index, bool is_output) + void new_port(const Raul::Path& path, const Raul::URI& type, uint32_t index, bool is_output) { if (_enabled) signal_new_port.emit(path, type, index, is_output); } - void connect(const string& src_port_path, const string& dst_port_path) + void connect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path) { if (_enabled) signal_connection.emit(src_port_path, dst_port_path); } - void destroy(const string& path) + void destroy(const Raul::Path& path) { if (_enabled) signal_object_destroyed.emit(path); } - void clear_patch(const string& path) + void clear_patch(const Raul::Path& path) { if (_enabled) signal_clear_patch.emit(path); } - void rename(const string& old_path, const string& new_path) + void rename(const Raul::Path& old_path, const Raul::Path& new_path) { if (_enabled) signal_object_renamed.emit(old_path, new_path); } - void disconnect(const string& src_port_path, const string& dst_port_path) + void disconnect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path) { if (_enabled) signal_disconnection.emit(src_port_path, dst_port_path); } - void set_variable(const string& path, const string& key, const Raul::Atom& value) + void set_variable(const Raul::Path& path, const Raul::URI& key, const Raul::Atom& value) { if (_enabled) signal_variable_change.emit(path, key, value); } - void set_property(const string& path, const string& key, const Raul::Atom& value) + void set_property(const Raul::Path& path, const Raul::URI& key, const Raul::Atom& value) { if (_enabled) signal_property_change.emit(path, key, value); } - void set_port_value(const string& port_path, const Raul::Atom& value) + void set_port_value(const Raul::Path& port_path, const Raul::Atom& value) { if (_enabled) signal_port_value.emit(port_path, value); } - void set_voice_value(const string& port_path, uint32_t voice, const Raul::Atom& value) + void set_voice_value(const Raul::Path& port_path, uint32_t voice, const Raul::Atom& value) { if (_enabled) signal_voice_value.emit(port_path, voice, value); } - void activity(const string& port_path) + void activity(const Raul::Path& port_path) { if (_enabled) signal_activity.emit(port_path); } - void program_add(const string& path, uint32_t bank, uint32_t program, const string& name) + void program_add(const Raul::Path& path, uint32_t bank, uint32_t program, const std::string& name) { if (_enabled) signal_program_add.emit(path, bank, program, name); } - void program_remove(const string& path, uint32_t bank, uint32_t program) + void program_remove(const Raul::Path& path, uint32_t bank, uint32_t program) { if (_enabled) signal_program_remove.emit(path, bank, program); } }; diff --git a/src/client/ThreadedSigClientInterface.hpp b/src/client/ThreadedSigClientInterface.hpp index 1e4a2beb..714465c8 100644 --- a/src/client/ThreadedSigClientInterface.hpp +++ b/src/client/ThreadedSigClientInterface.hpp @@ -27,8 +27,6 @@ #include "SigClientInterface.hpp" #include "raul/SRSWQueue.hpp" -using std::string; - /** Returns nothing and takes no parameters (because they have all been bound) */ typedef sigc::slot<void> Closure; @@ -70,7 +68,7 @@ public: { } - virtual std::string uri() const { return "(internal)"; } + virtual Raul::URI uri() const { return "ingen:internal"; } virtual void subscribe(Shared::EngineInterface* engine) { throw; } @@ -88,60 +86,60 @@ public: void response_ok(int32_t id) { push_sig(sigc::bind(response_ok_slot, id)); } - void response_error(int32_t id, const string& msg) + void response_error(int32_t id, const std::string& msg) { push_sig(sigc::bind(response_error_slot, id, msg)); } - void error(const string& msg) + void error(const std::string& msg) { push_sig(sigc::bind(error_slot, msg)); } - void new_plugin(const string& uri, const string& type_uri, const string& symbol) + void new_plugin(const Raul::URI& uri, const Raul::URI& type_uri, const Raul::Symbol& symbol) { push_sig(sigc::bind(new_plugin_slot, uri, type_uri, symbol)); } bool new_object(const Shared::GraphObject* object); - void new_patch(const string& path, uint32_t poly) + void new_patch(const Raul::Path& path, uint32_t poly) { push_sig(sigc::bind(new_patch_slot, path, poly)); } - void new_node(const string& path, const string& plugin_uri) + void new_node(const Raul::Path& path, const Raul::URI& plugin_uri) { push_sig(sigc::bind(new_node_slot, path, plugin_uri)); } - void new_port(const string& path, const string& type, uint32_t index, bool is_output) + void new_port(const Raul::Path& path, const Raul::URI& type, uint32_t index, bool is_output) { push_sig(sigc::bind(new_port_slot, path, type, index, is_output)); } - void connect(const string& src_port_path, const string& dst_port_path) + void connect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path) { push_sig(sigc::bind(connection_slot, src_port_path, dst_port_path)); } - void destroy(const string& path) + void destroy(const Raul::Path& path) { push_sig(sigc::bind(object_destroyed_slot, path)); } - void clear_patch(const string& path) + void clear_patch(const Raul::Path& path) { push_sig(sigc::bind(clear_patch_slot, path)); } - void rename(const string& old_path, const string& new_path) + void rename(const Raul::Path& old_path, const Raul::Path& new_path) { push_sig(sigc::bind(object_renamed_slot, old_path, new_path)); } - void disconnect(const string& src_port_path, const string& dst_port_path) + void disconnect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path) { push_sig(sigc::bind(disconnection_slot, src_port_path, dst_port_path)); } - void set_variable(const string& path, const string& key, const Raul::Atom& value) + void set_variable(const Raul::Path& path, const Raul::URI& key, const Raul::Atom& value) { push_sig(sigc::bind(variable_change_slot, path, key, value)); } - void set_property(const string& path, const string& key, const Raul::Atom& value) + void set_property(const Raul::Path& path, const Raul::URI& key, const Raul::Atom& value) { push_sig(sigc::bind(property_change_slot, path, key, value)); } - void set_port_value(const string& port_path, const Raul::Atom& value) + void set_port_value(const Raul::Path& port_path, const Raul::Atom& value) { push_sig(sigc::bind(port_value_slot, port_path, value)); } - void set_voice_value(const string& port_path, uint32_t voice, const Raul::Atom& value) + void set_voice_value(const Raul::Path& port_path, uint32_t voice, const Raul::Atom& value) { push_sig(sigc::bind(voice_value_slot, port_path, voice, value)); } - void activity(const string& port_path) + void activity(const Raul::Path& port_path) { push_sig(sigc::bind(activity_slot, port_path)); } - void program_add(const string& path, uint32_t bank, uint32_t program, const string& name) + void program_add(const Raul::Path& path, uint32_t bank, uint32_t program, const std::string& name) { push_sig(sigc::bind(program_add_slot, path, bank, program, name)); } - void program_remove(const string& path, uint32_t bank, uint32_t program) + void program_remove(const Raul::Path& path, uint32_t bank, uint32_t program) { push_sig(sigc::bind(program_remove_slot, path, bank, program)); } /** Process all queued events - Called from GTK thread to emit signals. */ @@ -156,27 +154,27 @@ private: Raul::SRSWQueue<Closure> _sigs; bool _attached; - sigc::slot<void> bundle_begin_slot; - sigc::slot<void> bundle_end_slot; - sigc::slot<void, int32_t> response_ok_slot; - sigc::slot<void, int32_t, string> response_error_slot; - sigc::slot<void, string> error_slot; - sigc::slot<void, string, string, string> new_plugin_slot; - sigc::slot<void, string, uint32_t> new_patch_slot; - sigc::slot<void, string, string> new_node_slot; - sigc::slot<void, string, string, uint32_t, bool> new_port_slot; - sigc::slot<void, string, string> connection_slot; - sigc::slot<void, string> clear_patch_slot; - sigc::slot<void, string> object_destroyed_slot; - sigc::slot<void, string, string> object_renamed_slot; - sigc::slot<void, string, string> disconnection_slot; - sigc::slot<void, string, string, Raul::Atom> variable_change_slot; - sigc::slot<void, string, string, Raul::Atom> property_change_slot; - sigc::slot<void, string, Raul::Atom> port_value_slot; - sigc::slot<void, string, uint32_t, Raul::Atom> voice_value_slot; - sigc::slot<void, string> activity_slot; - sigc::slot<void, string, uint32_t, uint32_t, string> program_add_slot; - sigc::slot<void, string, uint32_t, uint32_t> program_remove_slot; + sigc::slot<void> bundle_begin_slot; + sigc::slot<void> bundle_end_slot; + sigc::slot<void, int32_t> response_ok_slot; + sigc::slot<void, int32_t, std::string> response_error_slot; + sigc::slot<void, std::string> error_slot; + sigc::slot<void, Raul::URI, Raul::URI, Raul::Symbol> new_plugin_slot; + sigc::slot<void, Raul::Path, uint32_t> new_patch_slot; + sigc::slot<void, Raul::Path, Raul::URI> new_node_slot; + sigc::slot<void, Raul::Path, Raul::URI, uint32_t, bool> new_port_slot; + sigc::slot<void, Raul::Path, Raul::Path> connection_slot; + sigc::slot<void, Raul::Path> clear_patch_slot; + sigc::slot<void, Raul::Path> object_destroyed_slot; + sigc::slot<void, Raul::Path, Raul::Path> object_renamed_slot; + sigc::slot<void, Raul::Path, Raul::Path> disconnection_slot; + sigc::slot<void, Raul::Path, Raul::URI, Raul::Atom> variable_change_slot; + sigc::slot<void, Raul::Path, Raul::URI, Raul::Atom> property_change_slot; + sigc::slot<void, Raul::Path, Raul::Atom> port_value_slot; + sigc::slot<void, Raul::Path, uint32_t, Raul::Atom> voice_value_slot; + sigc::slot<void, Raul::Path> activity_slot; + sigc::slot<void, Raul::Path, uint32_t, uint32_t, std::string> program_add_slot; + sigc::slot<void, Raul::Path, uint32_t, uint32_t> program_remove_slot; }; |