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/engine | |
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/engine')
65 files changed, 526 insertions, 658 deletions
diff --git a/src/engine/ClientBroadcaster.cpp b/src/engine/ClientBroadcaster.cpp index c9f881aa..b81a4f8a 100644 --- a/src/engine/ClientBroadcaster.cpp +++ b/src/engine/ClientBroadcaster.cpp @@ -35,7 +35,7 @@ namespace Ingen { /** Register a client to receive messages over the notification band. */ void -ClientBroadcaster::register_client(const string& uri, ClientInterface* client) +ClientBroadcaster::register_client(const URI& uri, ClientInterface* client) { Clients::iterator i = _clients.find(uri); @@ -53,7 +53,7 @@ ClientBroadcaster::register_client(const string& uri, ClientInterface* client) * @return true if client was found and removed. */ bool -ClientBroadcaster::unregister_client(const string& uri) +ClientBroadcaster::unregister_client(const URI& uri) { size_t erased = _clients.erase(uri); @@ -74,7 +74,7 @@ ClientBroadcaster::unregister_client(const string& uri) * events, in anticipation of libom and multiple ways of responding to clients). */ ClientInterface* -ClientBroadcaster::client(const string& uri) +ClientBroadcaster::client(const URI& uri) { Clients::iterator i = _clients.find(uri); if (i != _clients.end()) { @@ -131,16 +131,15 @@ ClientBroadcaster::send_plugins(const NodeFactory::Plugins& plugins) void -ClientBroadcaster::send_destroyed(const string& path) +ClientBroadcaster::send_destroyed(const Path& path) { - assert(path != "/"); for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->destroy(path); } void -ClientBroadcaster::send_clear_patch(const string& patch_path) +ClientBroadcaster::send_clear_patch(const Path& patch_path) { for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->clear_patch(patch_path); @@ -150,12 +149,12 @@ void ClientBroadcaster::send_connection(const SharedPtr<const ConnectionImpl> c) { for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) - (*i).second->connect(c->src_port()->path(), c->dst_port()->path()); + (*i).second->connect(c->src_port()->path().str(), c->dst_port()->path().str()); } void -ClientBroadcaster::send_disconnection(const string& src_port_path, const string& dst_port_path) +ClientBroadcaster::send_disconnection(const Path& src_port_path, const Path& dst_port_path) { for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->disconnect(src_port_path, dst_port_path); @@ -167,7 +166,7 @@ ClientBroadcaster::send_disconnection(const string& src_port_path, const string& * Like control changes, does not send update to client that set the variable, if applicable. */ void -ClientBroadcaster::send_variable_change(const string& node_path, const string& key, const Atom& value) +ClientBroadcaster::send_variable_change(const Path& node_path, const URI& key, const Atom& value) { for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->set_variable(node_path, key, value); @@ -179,7 +178,7 @@ ClientBroadcaster::send_variable_change(const string& node_path, const string& k * Like control changes, does not send update to client that set the property, if applicable. */ void -ClientBroadcaster::send_property_change(const string& node_path, const string& key, const Atom& value) +ClientBroadcaster::send_property_change(const Path& node_path, const URI& key, const Atom& value) { for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->set_property(node_path, key, value); @@ -193,7 +192,7 @@ ClientBroadcaster::send_property_change(const string& node_path, const string& k * forcing clients to ignore things to avoid feedback loops etc). */ void -ClientBroadcaster::send_port_value(const string& port_path, const Raul::Atom& value) +ClientBroadcaster::send_port_value(const Path& port_path, const Raul::Atom& value) { for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->set_port_value(port_path, value); @@ -201,7 +200,7 @@ ClientBroadcaster::send_port_value(const string& port_path, const Raul::Atom& va void -ClientBroadcaster::send_activity(const string& path) +ClientBroadcaster::send_activity(const Path& path) { for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->activity(path); @@ -209,7 +208,7 @@ ClientBroadcaster::send_activity(const string& path) void -ClientBroadcaster::send_program_add(const string& node_path, int bank, int program, const string& name) +ClientBroadcaster::send_program_add(const Path& node_path, int bank, int program, const string& name) { for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->program_add(node_path, bank, program, name); @@ -217,7 +216,7 @@ ClientBroadcaster::send_program_add(const string& node_path, int bank, int progr void -ClientBroadcaster::send_program_remove(const string& node_path, int bank, int program) +ClientBroadcaster::send_program_remove(const Path& node_path, int bank, int program) { for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->program_remove(node_path, bank, program); @@ -239,7 +238,7 @@ ClientBroadcaster::send_object(const GraphObjectImpl* p, bool recursive) /** Sends notification of an GraphObject's renaming */ void -ClientBroadcaster::send_rename(const string& old_path, const string& new_path) +ClientBroadcaster::send_rename(const Path& old_path, const Path& new_path) { for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->rename(old_path, new_path); diff --git a/src/engine/ClientBroadcaster.hpp b/src/engine/ClientBroadcaster.hpp index 80405d24..72d1dd90 100644 --- a/src/engine/ClientBroadcaster.hpp +++ b/src/engine/ClientBroadcaster.hpp @@ -26,7 +26,8 @@ #include "interface/ClientInterface.hpp" #include "NodeFactory.hpp" -using std::string; +using Raul::URI; +using Raul::Path; namespace Ingen { @@ -52,10 +53,10 @@ using Shared::ClientInterface; class ClientBroadcaster { public: - void register_client(const string& uri, ClientInterface* client); - bool unregister_client(const string& uri); + void register_client(const URI& uri, ClientInterface* client); + bool unregister_client(const URI& uri); - ClientInterface* client(const string& uri); + ClientInterface* client(const URI& uri); //void send_client_registration(const string& url, int client_id); @@ -63,26 +64,26 @@ public: void bundle_end(); // Error that isn't the direct result of a request - void send_error(const string& msg); + void send_error(const std::string& msg); void send_plugins(const NodeFactory::Plugins& plugin_list); void send_object(const GraphObjectImpl* p, bool recursive); - void send_destroyed(const string& path); - void send_clear_patch(const string& patch_path); + void send_destroyed(const Path& path); + void send_clear_patch(const Path& patch_path); void send_connection(const SharedPtr<const ConnectionImpl> connection); - void send_disconnection(const string& src_port_path, const string& dst_port_path); - void send_rename(const string& old_path, const string& new_path); - void send_variable_change(const string& node_path, const string& key, const Raul::Atom& value); - void send_property_change(const string& node_path, const string& key, const Raul::Atom& value); - void send_port_value(const string& port_path, const Raul::Atom& value); - void send_activity(const string& path); - void send_program_add(const string& node_path, int bank, int program, const string& name); - void send_program_remove(const string& node_path, int bank, int program); + void send_disconnection(const Path& src_port_path, const Path& dst_port_path); + void send_rename(const Path& old_path, const Path& new_path); + void send_variable_change(const Path& node_path, const URI& key, const Raul::Atom& value); + void send_property_change(const Path& node_path, const URI& key, const Raul::Atom& value); + void send_port_value(const Path& port_path, const Raul::Atom& value); + void send_activity(const Path& path); + void send_program_add(const Path& node_path, int bank, int program, const std::string& name); + void send_program_remove(const Path& node_path, int bank, int program); void send_plugins_to(ClientInterface*, const NodeFactory::Plugins& plugin_list); private: - typedef std::map<string, ClientInterface*> Clients; + typedef std::map<URI, ClientInterface*> Clients; Clients _clients; }; diff --git a/src/engine/Event.hpp b/src/engine/Event.hpp index ddfb58c9..ee2658b5 100644 --- a/src/engine/Event.hpp +++ b/src/engine/Event.hpp @@ -21,6 +21,7 @@ #include <cassert> #include "raul/SharedPtr.hpp" #include "raul/Deletable.hpp" +#include "raul/Path.hpp" #include "types.hpp" namespace Ingen { @@ -57,10 +58,10 @@ public: protected: Event(Engine& engine, SharedPtr<Responder> responder, FrameTime time) - : _engine(engine) - , _responder(responder) - , _time(time) - , _executed(false) + : _engine(engine) + , _responder(responder) + , _time(time) + , _executed(false) {} Engine& _engine; diff --git a/src/engine/GraphObjectImpl.cpp b/src/engine/GraphObjectImpl.cpp index 461ebf0b..929eed2a 100644 --- a/src/engine/GraphObjectImpl.cpp +++ b/src/engine/GraphObjectImpl.cpp @@ -23,14 +23,14 @@ namespace Ingen { void -GraphObjectImpl::set_variable(const std::string& key, const Atom& value) +GraphObjectImpl::set_variable(const Raul::URI& key, const Atom& value) { _variables[key] = value; } const Atom& -GraphObjectImpl::get_variable(const std::string& key) +GraphObjectImpl::get_variable(const Raul::URI& key) { static const Atom null_atom; Properties::iterator i = _variables.find(key); diff --git a/src/engine/GraphObjectImpl.hpp b/src/engine/GraphObjectImpl.hpp index 5830c618..ccb5c7f9 100644 --- a/src/engine/GraphObjectImpl.hpp +++ b/src/engine/GraphObjectImpl.hpp @@ -57,7 +57,7 @@ public: GraphObject* graph_parent() const { return _parent; } - const std::string uri() const { return std::string("patch") + path(); } + const Raul::URI uri() const { return path(); } inline GraphObjectImpl* parent() const { return _parent; } const Symbol symbol() const { return _name; } @@ -71,8 +71,8 @@ public: assert(_name.find("/") == std::string::npos); } - const Raul::Atom& get_variable(const std::string& key); - void set_variable(const std::string& key, const Raul::Atom& value); + const Raul::Atom& get_variable(const Raul::URI& key); + void set_variable(const Raul::URI& key, const Raul::Atom& value); const Properties& variables() const { return _variables; } Properties& variables() { return _variables; } @@ -84,24 +84,23 @@ public: const Path path() const { if (_parent == NULL) return Path(std::string("/").append(_name)); - else if (_parent->path() == "/") + else if (_parent->path().is_root()) return Path(std::string("/").append(_name)); else - return Path(_parent->path() +"/"+ _name); + return Path(_parent->path().child(_name)); } SharedPtr<GraphObject> find_child(const std::string& name) const; protected: GraphObjectImpl(GraphObjectImpl* parent, const std::string& name, bool polyphonic=false) - : ResourceImpl(std::string("patch/") + (parent ? parent->path().base() : "/") + name) + : ResourceImpl((parent ? parent->path().base() : Path::root_uri) + name) , _parent(parent) , _name(name) , _polyphonic(polyphonic) { assert(parent == NULL || _name.length() > 0); assert(_name.find("/") == std::string::npos); - assert(path().find("//") == std::string::npos); } GraphObjectImpl* _parent; @@ -109,7 +108,7 @@ protected: bool _polyphonic; private: - Properties _variables; + Properties _variables; }; diff --git a/src/engine/HTTPClientSender.cpp b/src/engine/HTTPClientSender.cpp index 4b7a2045..34357365 100644 --- a/src/engine/HTTPClientSender.cpp +++ b/src/engine/HTTPClientSender.cpp @@ -49,76 +49,76 @@ HTTPClientSender::error(const std::string& msg) } -void HTTPClientSender::new_node(const std::string& node_path, - const std::string& plugin_uri) +void HTTPClientSender::new_node(const Raul::Path& node_path, + const Raul::URI& plugin_uri) { //send("/ingen/new_node", "ss", node_path.c_str(), plugin_uri.c_str(), LO_ARGS_END); } void -HTTPClientSender::new_port(const std::string& path, - const std::string& type, - uint32_t index, - bool is_output) +HTTPClientSender::new_port(const Raul::Path& path, + const Raul::URI& type, + uint32_t index, + bool is_output) { //send("/ingen/new_port", "sisi", path.c_str(), index, type.c_str(), is_output, LO_ARGS_END); } void -HTTPClientSender::destroy(const std::string& path) +HTTPClientSender::destroy(const Raul::Path& path) { - assert(path != "/"); - send_chunk(string("<").append(path).append("> a <http://www.w3.org/2002/07/owl#Nothing> .")); + assert(!path.is_root()); + send_chunk(string("<").append(path.str()).append("> a <http://www.w3.org/2002/07/owl#Nothing> .")); } void -HTTPClientSender::clear_patch(const std::string& patch_path) +HTTPClientSender::clear_patch(const Raul::Path& patch_path) { - send_chunk(string("<").append(patch_path).append("> ingen:empty true .")); + send_chunk(string("<").append(patch_path.str()).append("> ingen:empty true .")); } void -HTTPClientSender::connect(const std::string& src_path, const std::string& dst_path) +HTTPClientSender::connect(const Raul::Path& src_path, const Raul::Path& dst_path) { string msg = string( "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n" "@prefix ingen: <http://drobilla.net/ns/ingen#> .\n" "@prefix lv2var: <http://lv2plug.in/ns/ext/instance-var#> .\n\n<").append( "<> ingen:connection [\n" - "\tingen:destination <").append(dst_path).append("> ;\n" - "\tingen:source <").append(src_path).append(">\n] .\n"); + "\tingen:destination <").append(dst_path.str()).append("> ;\n" + "\tingen:source <").append(src_path.str()).append(">\n] .\n"); send_chunk(msg); } void -HTTPClientSender::disconnect(const std::string& src_path, const std::string& dst_path) +HTTPClientSender::disconnect(const Raul::Path& src_path, const Raul::Path& dst_path) { //send("/ingen/disconnection", "ss", src_path.c_str(), dst_path.c_str(), LO_ARGS_END); } void -HTTPClientSender::set_variable(const std::string& path, const std::string& key, const Atom& value) +HTTPClientSender::set_variable(const Raul::Path& path, const Raul::URI& key, const Atom& value) { Redland::Node node = AtomRDF::atom_to_node(*_engine.world()->rdf_world, value); string msg = string( "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n" "@prefix ingenuity: <http://drobilla.net/ns/ingenuity#> .\n" "@prefix lv2var: <http://lv2plug.in/ns/ext/instance-var#> .\n\n<").append( - path).append("> lv2var:variable [\n" - "rdf:predicate ").append(key).append(" ;\n" + path.str()).append("> lv2var:variable [\n" + "rdf:predicate ").append(key.str()).append(" ;\n" "rdf:value ").append(node.to_string()).append("\n] .\n"); send_chunk(msg); } void -HTTPClientSender::set_property(const std::string& path, const std::string& key, const Atom& value) +HTTPClientSender::set_property(const Raul::Path& path, const Raul::URI& key, const Atom& value) { Redland::Node node = AtomRDF::atom_to_node(*_engine.world()->rdf_world, value); string msg = string( @@ -126,26 +126,26 @@ HTTPClientSender::set_property(const std::string& path, const std::string& key, "@prefix ingen: <http://drobilla.net/ns/ingen#> .\n" "@prefix ingenuity: <http://drobilla.net/ns/ingenuity#> .\n" "@prefix lv2var: <http://lv2plug.in/ns/ext/instance-var#> .\n\n<").append( - path).append("> ingen:property [\n" - "rdf:predicate ").append(key).append(" ;\n" + path.str()).append("> ingen:property [\n" + "rdf:predicate ").append(key.str()).append(" ;\n" "rdf:value ").append(node.to_string()).append("\n] .\n"); send_chunk(msg); } void -HTTPClientSender::set_port_value(const std::string& port_path, const Raul::Atom& value) +HTTPClientSender::set_port_value(const Raul::Path& port_path, const Raul::Atom& value) { Redland::Node node = AtomRDF::atom_to_node(*_engine.world()->rdf_world, value); string msg = string( "@prefix ingen: <http://drobilla.net/ns/ingen#> .\n\n<").append( - port_path).append("> ingen:value ").append(node.to_string()).append(" .\n"); + port_path.str()).append("> ingen:value ").append(node.to_string()).append(" .\n"); send_chunk(msg); } void -HTTPClientSender::set_voice_value(const std::string& port_path, uint32_t voice, const Raul::Atom& value) +HTTPClientSender::set_voice_value(const Raul::Path& port_path, uint32_t voice, const Raul::Atom& value) { /*lo_message m = lo_message_new(); lo_message_add_string(m, port_path.c_str()); @@ -155,11 +155,11 @@ HTTPClientSender::set_voice_value(const std::string& port_path, uint32_t voice, void -HTTPClientSender::activity(const std::string& path) +HTTPClientSender::activity(const Raul::Path& path) { string msg = string( "@prefix ingen: <http://drobilla.net/ns/ingen#> .\n\n<").append( - path).append("> ingen:activity true .\n"); + path.str()).append("> ingen:activity true .\n"); send_chunk(msg); } @@ -181,9 +181,9 @@ HTTPClientSender::new_object(const Shared::GraphObject* object) void -HTTPClientSender::new_plugin(const std::string& uri, - const std::string& type_uri, - const std::string& symbol) +HTTPClientSender::new_plugin(const Raul::URI& uri, + const Raul::URI& type_uri, + const Raul::Symbol& symbol) { /*lo_message m = lo_message_new(); lo_message_add_string(m, uri.c_str()); @@ -195,25 +195,25 @@ HTTPClientSender::new_plugin(const std::string& uri, void -HTTPClientSender::new_patch(const std::string& path, uint32_t poly) +HTTPClientSender::new_patch(const Raul::Path& path, uint32_t poly) { - //send_chunk(string("<").append(path).append("> a ingen:Patch")); + //send_chunk(string("<").append(path.str()).append("> a ingen:Patch")); } void -HTTPClientSender::rename(const std::string& old_path, const std::string& new_path) +HTTPClientSender::rename(const Raul::Path& old_path, const Raul::Path& new_path) { string msg = string( "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n" "@prefix ingen: <http://drobilla.net/ns/ingen#> .\n\n<").append( - old_path).append("> rdf:subject <").append(new_path).append("> .\n"); + old_path.str()).append("> rdf:subject <").append(new_path.str()).append("> .\n"); send_chunk(msg); } void -HTTPClientSender::program_add(const std::string& node_path, uint32_t bank, uint32_t program, const std::string& name) +HTTPClientSender::program_add(const Raul::Path& node_path, uint32_t bank, uint32_t program, const std::string& name) { /*send("/ingen/program_add", "siis", node_path.c_str(), bank, program, name.c_str(), LO_ARGS_END);*/ @@ -221,7 +221,7 @@ HTTPClientSender::program_add(const std::string& node_path, uint32_t bank, uint3 void -HTTPClientSender::program_remove(const std::string& node_path, uint32_t bank, uint32_t program) +HTTPClientSender::program_remove(const Raul::Path& node_path, uint32_t bank, uint32_t program) { /*send("/ingen/program_remove", "sii", node_path.c_str(), bank, program, LO_ARGS_END);*/ diff --git a/src/engine/HTTPClientSender.hpp b/src/engine/HTTPClientSender.hpp index 364549ee..1a06b7cf 100644 --- a/src/engine/HTTPClientSender.hpp +++ b/src/engine/HTTPClientSender.hpp @@ -59,7 +59,7 @@ public: void transfer_begin() { HTTPSender::transfer_begin(); } void transfer_end() { HTTPSender::transfer_end(); } - std::string uri() const { return "http://example.org/"; } + Raul::URI uri() const { return "http://example.org/"; } void subscribe(Shared::EngineInterface* engine) { } @@ -74,58 +74,59 @@ public: virtual bool new_object(const Shared::GraphObject* object); - virtual void new_plugin(const std::string& uri, - const std::string& type_uri, - const std::string& symbol); + virtual void new_plugin(const Raul::URI& uri, + const Raul::URI& type_uri, + const Raul::Symbol& symbol); - virtual void new_patch(const std::string& path, uint32_t poly); + virtual void new_patch(const Raul::Path& path, + uint32_t poly); - virtual void new_node(const std::string& path, - const std::string& plugin_uri); + virtual void new_node(const Raul::Path& path, + const Raul::URI& plugin_uri); - virtual void new_port(const std::string& path, - const std::string& type, - uint32_t index, - bool is_output); + virtual void new_port(const Raul::Path& path, + const Raul::URI& type, + uint32_t index, + bool is_output); - virtual void clear_patch(const std::string& path); + virtual void clear_patch(const Raul::Path& path); - virtual void destroy(const std::string& path); + virtual void destroy(const Raul::Path& path); - virtual void rename(const std::string& old_path, - const std::string& new_path); + virtual void rename(const Raul::Path& old_path, + const Raul::Path& new_path); - virtual void connect(const std::string& src_port_path, - const std::string& dst_port_path); + virtual void connect(const Raul::Path& src_port_path, + const Raul::Path& dst_port_path); - virtual void disconnect(const std::string& src_port_path, - const std::string& dst_port_path); + virtual void disconnect(const Raul::Path& src_port_path, + const Raul::Path& dst_port_path); - virtual void set_variable(const std::string& subject_path, - const std::string& predicate, - const Raul::Atom& value); + virtual void set_variable(const Raul::Path& subject_path, + const Raul::URI& predicate, + const Raul::Atom& value); - virtual void set_property(const std::string& subject_path, - const std::string& 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 std::string& port_path, - const Raul::Atom& value); + virtual void set_port_value(const Raul::Path& port_path, + const Raul::Atom& value); - virtual void set_voice_value(const std::string& port_path, - uint32_t voice, - const Raul::Atom& value); + virtual void set_voice_value(const Raul::Path& port_path, + uint32_t voice, + const Raul::Atom& value); - virtual void activity(const std::string& path); + virtual void activity(const Raul::Path& path); - virtual void program_add(const std::string& node_path, + virtual void program_add(const Raul::Path& node_path, uint32_t bank, uint32_t program, const std::string& program_name); - virtual void program_remove(const std::string& node_path, - uint32_t bank, - uint32_t program); + virtual void program_remove(const Raul::Path& node_path, + uint32_t bank, + uint32_t program); private: Engine& _engine; diff --git a/src/engine/HTTPEngineReceiver.cpp b/src/engine/HTTPEngineReceiver.cpp index 4e279455..1d8d63a6 100644 --- a/src/engine/HTTPEngineReceiver.cpp +++ b/src/engine/HTTPEngineReceiver.cpp @@ -129,7 +129,7 @@ HTTPEngineReceiver::message_callback(SoupServer* server, SoupMessage* msg, const cout << "PUT " << path << ":\n" << msg->request_body->data << endl; } - if (path == "/" || path == "") { + if (path == Path::root_uri || path == "") { const string r = string("@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n") .append("\n<> rdfs:seeAlso <plugins> ;") .append("\n rdfs:seeAlso <stream> ;") diff --git a/src/engine/InternalPlugin.cpp b/src/engine/InternalPlugin.cpp index 9f146068..465c6b3f 100644 --- a/src/engine/InternalPlugin.cpp +++ b/src/engine/InternalPlugin.cpp @@ -38,13 +38,14 @@ InternalPlugin::instantiate(const string& name, SampleCount srate = engine.audio_driver()->sample_rate(); SampleCount buffer_size = engine.audio_driver()->buffer_size(); - if (uri() == NS_INTERNALS "Note") { + const string uri_str = uri().str(); + if (uri_str == NS_INTERNALS "Note") { return new NoteNode(name, polyphonic, parent, srate, buffer_size); - } else if (uri() == NS_INTERNALS "Trigger") { + } else if (uri_str == NS_INTERNALS "Trigger") { return new TriggerNode(name, polyphonic, parent, srate, buffer_size); - } else if (uri() == NS_INTERNALS "Controller") { + } else if (uri_str == NS_INTERNALS "Controller") { return new ControllerNode(name, polyphonic, parent, srate, buffer_size); - } else if (uri() == NS_INTERNALS "Transport") { + } else if (uri_str == NS_INTERNALS "Transport") { return new TransportNode(name, polyphonic, parent, srate, buffer_size); } else { return NULL; diff --git a/src/engine/LADSPANode.cpp b/src/engine/LADSPANode.cpp index b695befa..c6d22896 100644 --- a/src/engine/LADSPANode.cpp +++ b/src/engine/LADSPANode.cpp @@ -187,7 +187,7 @@ LADSPANode::instantiate() port_name = name; names.insert(make_pair(port_name, j)); - string port_path = path() + "/" + port_name; + Path port_path(path().child(port_name)); DataType type = DataType::AUDIO; port_buffer_size = _buffer_size; diff --git a/src/engine/LV2Node.cpp b/src/engine/LV2Node.cpp index a9246b3a..27591499 100644 --- a/src/engine/LV2Node.cpp +++ b/src/engine/LV2Node.cpp @@ -173,7 +173,7 @@ LV2Node::instantiate() slv2_value_free(ctx_ext_uri); string port_name; - string port_path; + Path port_path; PortImpl* port = NULL; @@ -190,7 +190,7 @@ LV2Node::instantiate() port_name = slv2_value_as_string(slv2_port_get_symbol(plug, id)); assert(port_name.find("/") == string::npos); - port_path = path() + "/" + port_name; + port_path = path().child(port_name); DataType data_type = DataType::UNKNOWN; if (slv2_port_is_a(plug, id, info->control_class)) { diff --git a/src/engine/LV2Plugin.cpp b/src/engine/LV2Plugin.cpp index 8efd5da2..9006a1ab 100644 --- a/src/engine/LV2Plugin.cpp +++ b/src/engine/LV2Plugin.cpp @@ -30,7 +30,7 @@ namespace Ingen { const string LV2Plugin::symbol() const { - string working = uri(); + string working = uri().str(); if (working[working.length()-1] == '/') working = working.substr(0, working.length()-1); diff --git a/src/engine/NodeFactory.cpp b/src/engine/NodeFactory.cpp index 9ec58d80..43043ea7 100644 --- a/src/engine/NodeFactory.cpp +++ b/src/engine/NodeFactory.cpp @@ -68,7 +68,7 @@ NodeFactory::~NodeFactory() PluginImpl* -NodeFactory::plugin(const string& uri) +NodeFactory::plugin(const Raul::URI& uri) { const Plugins::const_iterator i = _plugins.find(uri); return ((i != _plugins.end()) ? i->second : NULL); diff --git a/src/engine/NodeFactory.hpp b/src/engine/NodeFactory.hpp index 08b212fa..05fdf37a 100644 --- a/src/engine/NodeFactory.hpp +++ b/src/engine/NodeFactory.hpp @@ -18,16 +18,14 @@ #ifndef NODEFACTORY_H #define NODEFACTORY_H -#include "ingen-config.h" -#include "module/global.hpp" - #include <list> #include <map> #include <string> #include <pthread.h> #include <glibmm/module.h> - -using std::string; +#include "ingen-config.h" +#include "module/global.hpp" +#include "raul/URI.hpp" namespace Ingen { @@ -57,13 +55,15 @@ public: void load_plugins(); - typedef std::map<std::string,PluginImpl*> Plugins; + typedef std::map<Raul::URI, PluginImpl*> Plugins; const Plugins& plugins() const { return _plugins; } - PluginImpl* plugin(const string& uri); + PluginImpl* plugin(const Raul::URI& uri); /** DEPRECATED */ - PluginImpl* plugin(const string& type, const string& lib, const string& label); + PluginImpl* plugin(const std::string& type, + const std::string& lib, + const std::string& label); private: #ifdef HAVE_LADSPA_H diff --git a/src/engine/OSCClientSender.cpp b/src/engine/OSCClientSender.cpp index 1357258e..47bf589e 100644 --- a/src/engine/OSCClientSender.cpp +++ b/src/engine/OSCClientSender.cpp @@ -128,8 +128,8 @@ OSCClientSender::error(const std::string& msg) * this one (/ingen/new_node), followed by a series of /ingen/new_port commands, * followed by /ingen/new_node_end. </p> \n \n */ -void OSCClientSender::new_node(const std::string& node_path, - const std::string& plugin_uri) +void OSCClientSender::new_node(const Raul::Path& node_path, + const Raul::URI& plugin_uri) { send("/ingen/new_node", "ss", node_path.c_str(), plugin_uri.c_str(), LO_ARGS_END); } @@ -152,10 +152,10 @@ void OSCClientSender::new_node(const std::string& node_path, * as variable.</p> \n \n */ void -OSCClientSender::new_port(const std::string& path, - const std::string& type, - uint32_t index, - bool is_output) +OSCClientSender::new_port(const Raul::Path& path, + const Raul::URI& type, + uint32_t index, + bool is_output) { send("/ingen/new_port", "sisi", path.c_str(), index, type.c_str(), is_output, LO_ARGS_END); } @@ -166,10 +166,8 @@ OSCClientSender::new_port(const std::string& path, * \arg \b path (string) - Path of object (which no longer exists) </p> \n \n */ void -OSCClientSender::destroy(const std::string& path) +OSCClientSender::destroy(const Raul::Path& path) { - assert(path != "/"); - send("/ingen/destroyed", "s", path.c_str(), LO_ARGS_END); } @@ -179,7 +177,7 @@ OSCClientSender::destroy(const std::string& path) * \arg \b path (string) - Path of patch (which is now empty)</p> \n \n */ void -OSCClientSender::clear_patch(const std::string& patch_path) +OSCClientSender::clear_patch(const Raul::Path& patch_path) { send("/ingen/clear_patch", "s", patch_path.c_str(), LO_ARGS_END); } @@ -191,7 +189,7 @@ OSCClientSender::clear_patch(const std::string& patch_path) * \arg \b dst-path (string) - Path of the destination port</p> \n \n */ void -OSCClientSender::connect(const std::string& src_port_path, const std::string& dst_port_path) +OSCClientSender::connect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path) { send("/ingen/new_connection", "ss", src_port_path.c_str(), dst_port_path.c_str(), LO_ARGS_END); } @@ -203,7 +201,7 @@ OSCClientSender::connect(const std::string& src_port_path, const std::string& ds * \arg \b dst-path (string) - Path of the destination port</p> \n \n */ void -OSCClientSender::disconnect(const std::string& src_port_path, const std::string& dst_port_path) +OSCClientSender::disconnect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path) { send("/ingen/disconnection", "ss", src_port_path.c_str(), dst_port_path.c_str(), LO_ARGS_END); } @@ -216,7 +214,7 @@ OSCClientSender::disconnect(const std::string& src_port_path, const std::string& * \arg \b value (string)</p> \n \n */ void -OSCClientSender::set_variable(const std::string& path, const std::string& key, const Atom& value) +OSCClientSender::set_variable(const Raul::Path& path, const Raul::URI& key, const Atom& value) { lo_message m = lo_message_new(); lo_message_add_string(m, path.c_str()); @@ -233,7 +231,7 @@ OSCClientSender::set_variable(const std::string& path, const std::string& key, c * \arg \b value (string)</p> \n \n */ void -OSCClientSender::set_property(const std::string& path, const std::string& key, const Atom& value) +OSCClientSender::set_property(const Raul::Path& path, const Raul::URI& key, const Atom& value) { lo_message m = lo_message_new(); lo_message_add_string(m, path.c_str()); @@ -249,7 +247,7 @@ OSCClientSender::set_property(const std::string& path, const std::string& key, c * \arg \b value (any) - New value of port </p> \n \n */ void -OSCClientSender::set_port_value(const std::string& port_path, const Raul::Atom& value) +OSCClientSender::set_port_value(const Raul::Path& port_path, const Raul::Atom& value) { lo_message m = lo_message_new(); lo_message_add_string(m, port_path.c_str()); @@ -265,7 +263,7 @@ OSCClientSender::set_port_value(const std::string& port_path, const Raul::Atom& * \arg \b value (any) - New value of port </p> \n \n */ void -OSCClientSender::set_voice_value(const std::string& port_path, uint32_t voice, const Raul::Atom& value) +OSCClientSender::set_voice_value(const Raul::Path& port_path, uint32_t voice, const Raul::Atom& value) { lo_message m = lo_message_new(); lo_message_add_string(m, port_path.c_str()); @@ -279,7 +277,7 @@ OSCClientSender::set_voice_value(const std::string& port_path, uint32_t voice, c * \arg \b path (string) - Path of object </p> \n \n */ void -OSCClientSender::activity(const std::string& path) +OSCClientSender::activity(const Raul::Path& path) { if (!_enabled) return; @@ -296,9 +294,9 @@ OSCClientSender::activity(const std::string& path) * \arg \b name (string) - Descriptive human-readable name of plugin (e.g. "ADSR Envelope") */ void -OSCClientSender::new_plugin(const std::string& uri, - const std::string& type_uri, - const std::string& symbol) +OSCClientSender::new_plugin(const Raul::URI& uri, + const Raul::URI& type_uri, + const Raul::Symbol& symbol) { lo_message m = lo_message_new(); lo_message_add_string(m, uri.c_str()); @@ -343,7 +341,7 @@ OSCClientSender::new_object(const Shared::GraphObject* object) * \arg \b poly (int) - Polyphony of new patch (\em not a boolean like new_node) </p> \n \n */ void -OSCClientSender::new_patch(const std::string& path, uint32_t poly) +OSCClientSender::new_patch(const Raul::Path& path, uint32_t poly) { send("/ingen/new_patch", "si", path.c_str(), poly, LO_ARGS_END); } @@ -355,7 +353,7 @@ OSCClientSender::new_patch(const std::string& path, uint32_t poly) * \arg \b new-path (string) - New path of object </p> \n \n */ void -OSCClientSender::rename(const std::string& old_path, const std::string& new_path) +OSCClientSender::rename(const Raul::Path& old_path, const Raul::Path& new_path) { send("/ingen/rename", "ss", old_path.c_str(), new_path.c_str(), LO_ARGS_END); } @@ -364,7 +362,7 @@ OSCClientSender::rename(const std::string& old_path, const std::string& new_path /** Sends information about a program associated with a node. */ void -OSCClientSender::program_add(const std::string& node_path, uint32_t bank, uint32_t program, const std::string& name) +OSCClientSender::program_add(const Raul::Path& node_path, uint32_t bank, uint32_t program, const std::string& name) { send("/ingen/program_add", "siis", node_path.c_str(), bank, program, name.c_str(), LO_ARGS_END); @@ -372,7 +370,7 @@ OSCClientSender::program_add(const std::string& node_path, uint32_t bank, uint32 void -OSCClientSender::program_remove(const std::string& node_path, uint32_t bank, uint32_t program) +OSCClientSender::program_remove(const Raul::Path& node_path, uint32_t bank, uint32_t program) { send("/ingen/program_remove", "sii", node_path.c_str(), bank, program, LO_ARGS_END); diff --git a/src/engine/OSCClientSender.hpp b/src/engine/OSCClientSender.hpp index 6d93b381..db8e2ba1 100644 --- a/src/engine/OSCClientSender.hpp +++ b/src/engine/OSCClientSender.hpp @@ -39,7 +39,7 @@ namespace Shared { class EngineInterface; } class OSCClientSender : public Shared::ClientInterface, public Shared::OSCSender { public: - OSCClientSender(const std::string& url) + OSCClientSender(const Raul::URI& url) : _url(url) { _address = lo_address_new_from_url(url.c_str()); @@ -58,7 +58,7 @@ public: void transfer_begin() { OSCSender::transfer_begin(); } void transfer_end() { OSCSender::transfer_end(); } - std::string uri() const { return lo_address_get_url(_address); } + Raul::URI uri() const { return lo_address_get_url(_address); } void subscribe(Shared::EngineInterface* engine) { } @@ -70,64 +70,65 @@ public: void response_error(int32_t id, const std::string& msg); void error(const std::string& msg); - - virtual void new_plugin(const std::string& uri, - const std::string& type_uri, - const std::string& symbol); virtual bool new_object(const Shared::GraphObject* object); + + virtual void new_plugin(const Raul::URI& uri, + const Raul::URI& type_uri, + const Raul::Symbol& symbol); - virtual void new_patch(const std::string& path, uint32_t poly); + virtual void new_patch(const Raul::Path& path, + uint32_t poly); - virtual void new_node(const std::string& path, - const std::string& plugin_uri); + virtual void new_node(const Raul::Path& path, + const Raul::URI& plugin_uri); - virtual void new_port(const std::string& path, - const std::string& type, - uint32_t index, - bool is_output); + virtual void new_port(const Raul::Path& path, + const Raul::URI& type, + uint32_t index, + bool is_output); - virtual void clear_patch(const std::string& path); + virtual void clear_patch(const Raul::Path& path); - virtual void destroy(const std::string& path); + virtual void destroy(const Raul::Path& path); - virtual void rename(const std::string& old_path, - const std::string& new_path); + virtual void rename(const Raul::Path& old_path, + const Raul::Path& new_path); - virtual void connect(const std::string& src_port_path, - const std::string& dst_port_path); + virtual void connect(const Raul::Path& src_port_path, + const Raul::Path& dst_port_path); - virtual void disconnect(const std::string& src_port_path, - const std::string& dst_port_path); + virtual void disconnect(const Raul::Path& src_port_path, + const Raul::Path& dst_port_path); - virtual void set_variable(const std::string& subject_path, - const std::string& predicate, - const Raul::Atom& value); + virtual void set_variable(const Raul::Path& subject_path, + const Raul::URI& predicate, + const Raul::Atom& value); - virtual void set_property(const std::string& subject_path, - const std::string& 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 std::string& port_path, - const Raul::Atom& value); + virtual void set_port_value(const Raul::Path& port_path, + const Raul::Atom& value); - virtual void set_voice_value(const std::string& port_path, - uint32_t voice, - const Raul::Atom& value); + virtual void set_voice_value(const Raul::Path& port_path, + uint32_t voice, + const Raul::Atom& value); - virtual void activity(const std::string& path); + virtual void activity(const Raul::Path& path); - virtual void program_add(const std::string& node_path, + virtual void program_add(const Raul::Path& node_path, uint32_t bank, uint32_t program, const std::string& program_name); - virtual void program_remove(const std::string& node_path, - uint32_t bank, - uint32_t program); + virtual void program_remove(const Raul::Path& node_path, + uint32_t bank, + uint32_t program); private: - std::string _url; + Raul::URI _url; }; diff --git a/src/engine/ObjectSender.cpp b/src/engine/ObjectSender.cpp index e261bc97..a0202db0 100644 --- a/src/engine/ObjectSender.cpp +++ b/src/engine/ObjectSender.cpp @@ -103,8 +103,6 @@ ObjectSender::send_node(ClientInterface* client, const NodeImpl* node, bool recu { PluginImpl* const plugin = node->plugin_impl(); - assert(node->path().length() > 0); - if (plugin->type() == Plugin::Patch) { send_patch(client, (PatchImpl*)node, recursive); return; diff --git a/src/engine/QueuedEngineInterface.cpp b/src/engine/QueuedEngineInterface.cpp index 4c24c405..3dcd2ddb 100644 --- a/src/engine/QueuedEngineInterface.cpp +++ b/src/engine/QueuedEngineInterface.cpp @@ -79,7 +79,7 @@ QueuedEngineInterface::register_client(ClientInterface* client) void -QueuedEngineInterface::unregister_client(const string& uri) +QueuedEngineInterface::unregister_client(const URI& uri) { push_queued(new UnregisterClientEvent(_engine, _responder, now(), uri)); if (_responder && _responder->client() && _responder->client()->uri() == uri) { @@ -153,56 +153,56 @@ QueuedEngineInterface::new_object(const GraphObject* object) void -QueuedEngineInterface::new_patch(const string& path, - uint32_t poly) +QueuedEngineInterface::new_patch(const Path& path, + uint32_t poly) { push_queued(new CreatePatchEvent(_engine, _responder, now(), path, poly)); } // FIXME: use index -void QueuedEngineInterface::new_port(const string& path, - const string& type, - uint32_t index, - bool direction) +void QueuedEngineInterface::new_port(const Path& path, + const URI& type, + uint32_t index, + bool direction) { push_queued(new CreatePortEvent(_engine, _responder, now(), path, type, direction, this)); } void -QueuedEngineInterface::new_node(const string& path, - const string& plugin_uri) +QueuedEngineInterface::new_node(const Path& path, + const URI& plugin_uri) { push_queued(new CreateNodeEvent(_engine, _responder, now(), path, plugin_uri, true)); } void -QueuedEngineInterface::rename(const string& old_path, - const string& new_path) +QueuedEngineInterface::rename(const Path& old_path, + const Path& new_path) { push_queued(new RenameEvent(_engine, _responder, now(), old_path, new_path)); } void -QueuedEngineInterface::destroy(const string& path) +QueuedEngineInterface::destroy(const Path& path) { push_queued(new DestroyEvent(_engine, _responder, now(), this, path)); } void -QueuedEngineInterface::clear_patch(const string& patch_path) +QueuedEngineInterface::clear_patch(const Path& patch_path) { push_queued(new ClearPatchEvent(_engine, _responder, now(), this, patch_path)); } void -QueuedEngineInterface::connect(const string& src_port_path, - const string& dst_port_path) +QueuedEngineInterface::connect(const Path& src_port_path, + const Path& dst_port_path) { push_queued(new ConnectionEvent(_engine, _responder, now(), src_port_path, dst_port_path)); @@ -210,23 +210,23 @@ QueuedEngineInterface::connect(const string& src_port_path, void -QueuedEngineInterface::disconnect(const string& src_port_path, - const string& dst_port_path) +QueuedEngineInterface::disconnect(const Path& src_port_path, + const Path& dst_port_path) { push_queued(new DisconnectionEvent(_engine, _responder, now(), src_port_path, dst_port_path)); } void -QueuedEngineInterface::disconnect_all(const string& patch_path, - const string& path) +QueuedEngineInterface::disconnect_all(const Path& patch_path, + const Path& path) { push_queued(new DisconnectAllEvent(_engine, _responder, now(), patch_path, path)); } void -QueuedEngineInterface::set_port_value(const string& port_path, +QueuedEngineInterface::set_port_value(const Path& port_path, const Raul::Atom& value) { push_queued(new SetPortValueEvent(_engine, _responder, true, now(), port_path, value)); @@ -234,7 +234,7 @@ QueuedEngineInterface::set_port_value(const string& port_path, void -QueuedEngineInterface::set_voice_value(const string& port_path, +QueuedEngineInterface::set_voice_value(const Path& port_path, uint32_t voice, const Raul::Atom& value) { @@ -243,34 +243,34 @@ QueuedEngineInterface::set_voice_value(const string& port_path, void -QueuedEngineInterface::set_program(const string& node_path, - uint32_t bank, - uint32_t program) +QueuedEngineInterface::set_program(const Path& node_path, + uint32_t bank, + uint32_t program) { std::cerr << "FIXME: set program" << std::endl; } void -QueuedEngineInterface::midi_learn(const string& node_path) +QueuedEngineInterface::midi_learn(const Path& node_path) { push_queued(new MidiLearnEvent(_engine, _responder, now(), node_path)); } void -QueuedEngineInterface::set_variable(const string& path, - const string& predicate, - const Atom& value) +QueuedEngineInterface::set_variable(const Path& path, + const URI& predicate, + const Atom& value) { push_queued(new SetMetadataEvent(_engine, _responder, now(), false, path, predicate, value)); } void -QueuedEngineInterface::set_property(const string& path, - const string& predicate, - const Atom& value) +QueuedEngineInterface::set_property(const Path& path, + const URI& predicate, + const Atom& value) { push_queued(new SetMetadataEvent(_engine, _responder, now(), true, path, predicate, value)); } @@ -289,35 +289,35 @@ QueuedEngineInterface::ping() void -QueuedEngineInterface::request_plugin(const string& uri) +QueuedEngineInterface::request_plugin(const URI& uri) { push_queued(new RequestPluginEvent(_engine, _responder, now(), uri)); } void -QueuedEngineInterface::request_object(const string& path) +QueuedEngineInterface::request_object(const Path& path) { push_queued(new RequestObjectEvent(_engine, _responder, now(), path)); } void -QueuedEngineInterface::request_port_value(const string& port_path) +QueuedEngineInterface::request_port_value(const Path& port_path) { push_queued(new RequestPortValueEvent(_engine, _responder, now(), port_path)); } void -QueuedEngineInterface::request_variable(const string& object_path, const string& key) +QueuedEngineInterface::request_variable(const Path& object_path, const URI& key) { push_queued(new RequestMetadataEvent(_engine, _responder, now(), false, object_path, key)); } void -QueuedEngineInterface::request_property(const string& object_path, const string& key) +QueuedEngineInterface::request_property(const Path& object_path, const URI& key) { push_queued(new RequestMetadataEvent(_engine, _responder, now(), true, object_path, key)); } diff --git a/src/engine/QueuedEngineInterface.hpp b/src/engine/QueuedEngineInterface.hpp index bd90e097..7e2dd4d0 100644 --- a/src/engine/QueuedEngineInterface.hpp +++ b/src/engine/QueuedEngineInterface.hpp @@ -53,13 +53,13 @@ public: QueuedEngineInterface(Engine& engine, size_t queue_size); virtual ~QueuedEngineInterface() {} - std::string uri() const { return "ingen:internal"; } + Raul::URI uri() const { return "ingen:internal"; } void set_next_response_id(int32_t id); // Client registration virtual void register_client(ClientInterface* client); - virtual void unregister_client(const string& uri); + virtual void unregister_client(const Raul::URI& uri); // Engine commands virtual void load_plugins(); @@ -71,66 +71,68 @@ public: virtual void bundle_begin(); virtual void bundle_end(); - // Object commands + // CommonInterface object commands virtual bool new_object(const Shared::GraphObject* object); - - virtual void new_patch(const string& path, - uint32_t poly); - - virtual void new_port(const string& path, - const string& type, - uint32_t index, - bool direction); - virtual void new_node(const string& path, - const string& plugin_uri); + virtual void new_patch(const Raul::Path& path, + uint32_t poly); - virtual void rename(const string& old_path, - const string& new_name); - - virtual void destroy(const string& path); - - virtual void clear_patch(const string& patch_path); + virtual void new_node(const Raul::Path& path, + const Raul::URI& plugin_uri); - virtual void connect(const string& src_port_path, - const string& dst_port_path); - - virtual void disconnect(const string& src_port_path, - const string& dst_port_path); - - virtual void disconnect_all(const string& patch_path, - const string& path); - - virtual void set_port_value(const string& port_path, - const Raul::Atom& value); + virtual void new_port(const Raul::Path& path, + const Raul::URI& type, + uint32_t index, + bool is_output); - virtual void set_voice_value(const string& port_path, - uint32_t voice, - const Raul::Atom& value); + virtual void rename(const Raul::Path& old_path, + const Raul::Path& new_path); - virtual void set_program(const string& node_path, - uint32_t bank, - uint32_t program); - - virtual void midi_learn(const string& node_path); - - virtual void set_variable(const string& path, - const string& predicate, + 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 set_variable(const Raul::Path& subject_path, + const Raul::URI& predicate, const Raul::Atom& value); - virtual void set_property(const string& path, - const string& predicate, + 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 destroy(const Raul::Path& path); + + virtual void clear_patch(const Raul::Path& patch_path); + + // EngineInterface object commands + + virtual void disconnect_all(const Raul::Path& parent_patch_path, + const Raul::Path& path); + + 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 // virtual void ping(); - virtual void request_plugin(const string& uri); - virtual void request_object(const string& path); - virtual void request_port_value(const string& port_path); - virtual void request_variable(const string& object_path, const string& key); - virtual void request_property(const string& object_path, const string& key); + virtual void request_plugin(const Raul::URI& uri); + virtual void request_object(const Raul::Path& path); + virtual void request_port_value(const Raul::Path& port_path); + virtual void request_variable(const Raul::Path& object_path, const Raul::URI& key); + virtual void request_property(const Raul::Path& object_path, const Raul::URI& key); virtual void request_plugins(); virtual void request_all_objects(); diff --git a/src/engine/events/AllNotesOffEvent.cpp b/src/engine/events/AllNotesOffEvent.cpp index fcb68b31..8e009760 100644 --- a/src/engine/events/AllNotesOffEvent.cpp +++ b/src/engine/events/AllNotesOffEvent.cpp @@ -36,7 +36,7 @@ AllNotesOffEvent::AllNotesOffEvent(Engine& engine, SharedPtr<Responder> responde /** Note off event with lookup - triggered by OSC. */ -AllNotesOffEvent::AllNotesOffEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& patch_path) +AllNotesOffEvent::AllNotesOffEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& patch_path) : Event(engine, responder, timestamp), _patch_path(patch_path), _patch(NULL) @@ -49,7 +49,7 @@ AllNotesOffEvent::execute(ProcessContext& context) { Event::execute(context); - if (_patch == NULL && _patch_path != "") + if (!_patch) _patch = _engine.engine_store()->find_patch(_patch_path); //if (_patch != NULL) diff --git a/src/engine/events/AllNotesOffEvent.hpp b/src/engine/events/AllNotesOffEvent.hpp index 3e4d56b3..41f7e25b 100644 --- a/src/engine/events/AllNotesOffEvent.hpp +++ b/src/engine/events/AllNotesOffEvent.hpp @@ -19,8 +19,6 @@ #define ALLNOTESOFFEVENT_H #include "Event.hpp" -#include <string> -using std::string; namespace Ingen { @@ -35,14 +33,14 @@ class AllNotesOffEvent : public Event { public: AllNotesOffEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, PatchImpl* patch); - AllNotesOffEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& patch_path); + AllNotesOffEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& patch_path); void execute(ProcessContext& context); void post_process(); private: - const string _patch_path; - PatchImpl* _patch; + const Raul::Path _patch_path; + PatchImpl* _patch; }; diff --git a/src/engine/events/ClearPatchEvent.cpp b/src/engine/events/ClearPatchEvent.cpp index 2be2e4a8..e3632e08 100644 --- a/src/engine/events/ClearPatchEvent.cpp +++ b/src/engine/events/ClearPatchEvent.cpp @@ -33,7 +33,7 @@ namespace Ingen { -ClearPatchEvent::ClearPatchEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime time, QueuedEventSource* source, const string& patch_path) +ClearPatchEvent::ClearPatchEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime time, QueuedEventSource* source, const Path& patch_path) : QueuedEvent(engine, responder, time, true, source) , _patch_path(patch_path) , _process(false) @@ -151,7 +151,7 @@ ClearPatchEvent::post_process() } } else { - _responder->respond_error(string("Patch ") + _patch_path + " not found"); + _responder->respond_error(string("Patch ") + _patch_path.str() + " not found"); } _source->unblock(); // FIXME: can be done earlier in execute? diff --git a/src/engine/events/ClearPatchEvent.hpp b/src/engine/events/ClearPatchEvent.hpp index 75226dd9..b5fcf716 100644 --- a/src/engine/events/ClearPatchEvent.hpp +++ b/src/engine/events/ClearPatchEvent.hpp @@ -18,7 +18,6 @@ #ifndef CLEARPATCHEVENT_H #define CLEARPATCHEVENT_H -#include <string> #include "raul/Array.hpp" #include "raul/Table.hpp" #include "raul/Path.hpp" @@ -26,8 +25,6 @@ #include "EngineStore.hpp" #include "PatchImpl.hpp" -using std::string; - namespace Ingen { class PatchImpl; @@ -41,18 +38,18 @@ class DriverPort; class ClearPatchEvent : public QueuedEvent { public: - ClearPatchEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime time, QueuedEventSource* source, const string& patch_path); + ClearPatchEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime time, QueuedEventSource* source, const Raul::Path& patch_path); void pre_process(); void execute(ProcessContext& context); void post_process(); private: - const string _patch_path; + const Raul::Path _patch_path; SharedPtr<PatchImpl> _patch; bool _process; - Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports for Patch - CompiledPatch* _compiled_patch; ///< Patch's new process order + Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports for Patch + CompiledPatch* _compiled_patch; ///< Patch's new process order typedef Raul::Array<Raul::List<DriverPort*>::Node*> DriverPorts; DriverPorts* _driver_ports; diff --git a/src/engine/events/ConnectionEvent.cpp b/src/engine/events/ConnectionEvent.cpp index e751c0b9..13e160c9 100644 --- a/src/engine/events/ConnectionEvent.cpp +++ b/src/engine/events/ConnectionEvent.cpp @@ -35,7 +35,7 @@ using std::string; namespace Ingen { -ConnectionEvent::ConnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path) +ConnectionEvent::ConnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& src_port_path, const Path& dst_port_path) : QueuedEvent(engine, responder, timestamp) , _src_port_path(src_port_path) , _dst_port_path(dst_port_path) diff --git a/src/engine/events/ConnectionEvent.hpp b/src/engine/events/ConnectionEvent.hpp index 2bc8369f..53254e77 100644 --- a/src/engine/events/ConnectionEvent.hpp +++ b/src/engine/events/ConnectionEvent.hpp @@ -18,13 +18,11 @@ #ifndef CONNECTIONEVENT_H #define CONNECTIONEVENT_H -#include <string> #include "raul/Path.hpp" #include "QueuedEvent.hpp" #include "PatchImpl.hpp" #include "InputPort.hpp" #include "types.hpp" -using std::string; namespace Raul { template <typename T> class ListNode; @@ -50,7 +48,7 @@ class CompiledPatch; class ConnectionEvent : public QueuedEvent { public: - ConnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path); + ConnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& src_port_path, const Raul::Path& dst_port_path); void pre_process(); void execute(ProcessContext& context); diff --git a/src/engine/events/CreateNodeEvent.cpp b/src/engine/events/CreateNodeEvent.cpp index 41470d45..f34f75c3 100644 --- a/src/engine/events/CreateNodeEvent.cpp +++ b/src/engine/events/CreateNodeEvent.cpp @@ -36,8 +36,7 @@ namespace Ingen { -CreateNodeEvent::CreateNodeEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path, - const string& plugin_uri, bool polyphonic) +CreateNodeEvent::CreateNodeEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& path, const URI& plugin_uri, bool polyphonic) : QueuedEvent(engine, responder, timestamp) , _path(path) , _plugin_uri(plugin_uri) @@ -47,14 +46,15 @@ CreateNodeEvent::CreateNodeEvent(Engine& engine, SharedPtr<Responder> responder, , _compiled_patch(NULL) , _node_already_exists(false) { - if (_plugin_uri.substr(0, 3) == "om:") { + string uri = _plugin_uri.str(); + if (uri.substr(0, 3) == "om:") { size_t colon = 2; - _plugin_uri = _plugin_uri.substr(colon + 1); - if ((colon = _plugin_uri.find(":")) == string::npos) + uri = uri.substr(colon + 1); + if ((colon = uri.find(":")) == string::npos) return; - _plugin_type = _plugin_uri.substr(0, colon + 1); - _plugin_label = _plugin_uri.substr(colon + 1); - _plugin_uri = ""; + _plugin_type = uri.substr(0, colon + 1); + _plugin_label = uri.substr(colon + 1); + uri = ""; } } @@ -70,8 +70,8 @@ CreateNodeEvent::pre_process() _patch = _engine.engine_store()->find_patch(_path.parent()); - PluginImpl* const plugin = (_plugin_uri != "") - ? _engine.node_factory()->plugin(_plugin_uri) + PluginImpl* const plugin = (_plugin_label == "") + ? _engine.node_factory()->plugin(_plugin_uri.str()) : _engine.node_factory()->plugin(_plugin_type, _plugin_lib, _plugin_label); if (_patch && plugin) { @@ -115,19 +115,14 @@ CreateNodeEvent::post_process() { string msg; if (_node_already_exists) { - msg = string("Could not create node - ").append(_path);// + " already exists."; + msg = string("Could not create node - ").append(_path.str());// + " already exists."; _responder->respond_error(msg); } else if (_patch == NULL) { - msg = "Could not find patch '" + _path.parent() +"' for add_node."; + msg = "Could not find patch '" + _path.parent().str() +"' to add node."; _responder->respond_error(msg); } else if (_node == NULL) { msg = "Unable to load node "; - msg += _path + " (you're missing the plugin "; - if (_plugin_uri != "") - msg += _plugin_uri; - else - msg += _plugin_lib + ":" + _plugin_label + " (" + _plugin_type + ")"; - msg += ")"; + msg += _path.str() + " (you're missing the plugin " + _plugin_uri.str() + ")"; _responder->respond_error(msg); } else { _responder->respond_ok(); diff --git a/src/engine/events/CreateNodeEvent.hpp b/src/engine/events/CreateNodeEvent.hpp index 61fd2c5c..cba84cd0 100644 --- a/src/engine/events/CreateNodeEvent.hpp +++ b/src/engine/events/CreateNodeEvent.hpp @@ -18,13 +18,8 @@ #ifndef CREATENODEEVENT_H #define CREATENODEEVENT_H -#include "QueuedEvent.hpp" -#include "raul/Path.hpp" #include <string> -using std::string; - -namespace Raul { template <typename T> class Array; } -template<typename T> class TreeNode; +#include "QueuedEvent.hpp" namespace Ingen { @@ -43,8 +38,8 @@ public: CreateNodeEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, - const string& node_path, - const string& plugin_uri, + const Raul::Path& node_path, + const Raul::URI& plugin_uri, bool poly); void pre_process(); @@ -52,12 +47,11 @@ public: void post_process(); private: - string _patch_name; Raul::Path _path; - string _plugin_uri; ///< If nonempty then type, library, label, are ignored - string _plugin_type; - string _plugin_lib; - string _plugin_label; + Raul::URI _plugin_uri; ///< If nonempty then type, library, label, are ignored + std::string _plugin_type; + std::string _plugin_lib; + std::string _plugin_label; bool _polyphonic; PatchImpl* _patch; NodeImpl* _node; diff --git a/src/engine/events/CreatePatchEvent.cpp b/src/engine/events/CreatePatchEvent.cpp index 56796557..392a1cc2 100644 --- a/src/engine/events/CreatePatchEvent.cpp +++ b/src/engine/events/CreatePatchEvent.cpp @@ -30,9 +30,9 @@ namespace Ingen { -CreatePatchEvent::CreatePatchEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path, int poly) +CreatePatchEvent::CreatePatchEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& path, int poly) : QueuedEvent(engine, responder, timestamp) - , _path(Raul::Path::pathify(path)) + , _path(path) , _patch(NULL) , _parent(NULL) , _compiled_patch(NULL) @@ -45,13 +45,7 @@ CreatePatchEvent::CreatePatchEvent(Engine& engine, SharedPtr<Responder> responde void CreatePatchEvent::pre_process() { - if (!Path::is_valid(_path)) { - _error = INVALID_PATH; - QueuedEvent::pre_process(); - return; - } - - if (_path == "/" || _engine.engine_store()->find_object(_path) != NULL) { + if (_path.is_root() || _engine.engine_store()->find_object(_path) != NULL) { _error = OBJECT_EXISTS; QueuedEvent::pre_process(); return; @@ -102,13 +96,12 @@ CreatePatchEvent::execute(ProcessContext& context) if (_patch != NULL) { if (_parent == NULL) { - assert(_path == "/"); + assert(_path.is_root()); assert(_patch->parent_patch() == NULL); _engine.audio_driver()->set_root_patch(_patch); } else { assert(_parent != NULL); - assert(_path != "/"); - + assert(!_path.is_root()); if (_parent->compiled_patch() != NULL) _engine.maid()->push(_parent->compiled_patch()); _parent->compiled_patch(_compiled_patch); @@ -120,34 +113,32 @@ CreatePatchEvent::execute(ProcessContext& context) void CreatePatchEvent::post_process() { - if (_responder.get()) { - if (_error == NO_ERROR) { - + string msg; + if (_responder) { + switch (_error) { + case NO_ERROR: _responder->respond_ok(); - // Don't send ports/nodes that have been added since prepare() // (otherwise they would be sent twice) - //_engine.broadcaster()->send_patch(_patch, false); _engine.broadcaster()->send_object(_patch, false); - - } else if (_error == INVALID_PATH) { - string msg = "Attempt to create patch with illegal path "; - msg.append(_path); - _responder->respond_error(msg); - } else if (_error == OBJECT_EXISTS) { + break; + case OBJECT_EXISTS: _responder->respond_ok(); /*string msg = "Unable to create patch: "; msg.append(_path).append(" already exists."); _responder->respond_error(msg);*/ - } else if (_error == PARENT_NOT_FOUND) { - string msg = "Unable to create patch: Parent "; - msg.append(Path(_path).parent()).append(" not found."); + break; + case PARENT_NOT_FOUND: + msg = "Unable to create patch: Parent "; + msg.append(Path(_path).parent().str()).append(" not found."); _responder->respond_error(msg); - } else if (_error == INVALID_POLY) { - string msg = "Unable to create patch "; - msg.append(_path).append(": ").append("Invalid polyphony respondered."); + break; + case INVALID_POLY: + msg = "Unable to create patch "; + msg.append(_path.str()).append(": ").append("Invalid polyphony respondered."); _responder->respond_error(msg); - } else { + break; + default: _responder->respond_error("Unable to load patch."); } } diff --git a/src/engine/events/CreatePatchEvent.hpp b/src/engine/events/CreatePatchEvent.hpp index 0dfb3e50..c2759341 100644 --- a/src/engine/events/CreatePatchEvent.hpp +++ b/src/engine/events/CreatePatchEvent.hpp @@ -18,12 +18,8 @@ #ifndef CREATEPATCHEVENT_H #define CREATEPATCHEVENT_H -#include <string> #include "QueuedEvent.hpp" -namespace Raul { template<typename T> class Array; } -template<typename T> class TreeNode; - namespace Ingen { class PatchImpl; @@ -37,21 +33,21 @@ class CompiledPatch; class CreatePatchEvent : public QueuedEvent { public: - CreatePatchEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const std::string& path, int poly); + CreatePatchEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& path, int poly); void pre_process(); void execute(ProcessContext& context); void post_process(); private: - enum ErrorType { NO_ERROR, OBJECT_EXISTS, PARENT_NOT_FOUND, INVALID_POLY, INVALID_PATH }; + enum ErrorType { NO_ERROR, OBJECT_EXISTS, PARENT_NOT_FOUND, INVALID_POLY }; - const std::string _path; - PatchImpl* _patch; - PatchImpl* _parent; - CompiledPatch* _compiled_patch; - int _poly; - ErrorType _error; + const Raul::Path _path; + PatchImpl* _patch; + PatchImpl* _parent; + CompiledPatch* _compiled_patch; + int _poly; + ErrorType _error; }; diff --git a/src/engine/events/CreatePortEvent.cpp b/src/engine/events/CreatePortEvent.cpp index 0e0dabd2..870a190c 100644 --- a/src/engine/events/CreatePortEvent.cpp +++ b/src/engine/events/CreatePortEvent.cpp @@ -40,8 +40,8 @@ namespace Ingen { CreatePortEvent::CreatePortEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, - const string& path, - const string& type, + const Raul::Path& path, + const Raul::URI& type, bool is_output, QueuedEventSource* source) : QueuedEvent(engine, responder, timestamp, true, source) @@ -83,7 +83,7 @@ CreatePortEvent::pre_process() assert(_patch->path() == _path.parent()); size_t buffer_size = 1; - if (_type != "ingen:Float") + if (_type.str() != "ingen:Float") buffer_size = _engine.audio_driver()->buffer_size(); const uint32_t old_num_ports = _patch->num_ports(); @@ -106,10 +106,10 @@ CreatePortEvent::pre_process() _engine.engine_store()->add(_patch_port); if (!_patch->parent()) { - if (_type == "lv2:AudioPort") { + if (_type.str() == "lv2:AudioPort") { _driver_port = _engine.audio_driver()->create_port( dynamic_cast<DuplexPort*>(_patch_port)); - } else if (_type == "lv2ev:EventPort") { + } else if (_type.str() == "lv2ev:EventPort") { _driver_port = _engine.midi_driver()->create_port( dynamic_cast<DuplexPort*>(_patch_port)); } @@ -136,9 +136,9 @@ CreatePortEvent::execute(ProcessContext& context) } if (_driver_port) { - if (_type == "lv2:AudioPort") { + if (_type.str() == "lv2:AudioPort") { _engine.audio_driver()->add_port(_driver_port); - } else if (_type == "lv2ev:EventPort") { + } else if (_type.str() == "lv2ev:EventPort") { _engine.midi_driver()->add_port(_driver_port); } } @@ -158,11 +158,11 @@ CreatePortEvent::post_process() _engine.broadcaster()->send_object(_patch_port, true); break; case UNKNOWN_TYPE: - msg = string("Could not create port ") + _path + " (Unknown type)"; + msg = string("Could not create port ") + _path.str() + " (Unknown type)"; _responder->respond_error(msg); break; case CREATION_FAILED: - msg = string("Could not create port ") + _path + " (Creation failed)"; + msg = string("Could not create port ") + _path.str() + " (Creation failed)"; _responder->respond_error(msg); break; } diff --git a/src/engine/events/CreatePortEvent.hpp b/src/engine/events/CreatePortEvent.hpp index 4a8233b7..2587f2f0 100644 --- a/src/engine/events/CreatePortEvent.hpp +++ b/src/engine/events/CreatePortEvent.hpp @@ -22,8 +22,6 @@ #include "raul/Path.hpp" #include "raul/Array.hpp" #include "interface/DataType.hpp" -#include <string> -using std::string; template <typename T> class Array; @@ -41,7 +39,7 @@ class DriverPort; class CreatePortEvent : public QueuedEvent { public: - CreatePortEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& type, bool is_output, QueuedEventSource* source); + CreatePortEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& path, const Raul::URI& type, bool is_output, QueuedEventSource* source); void pre_process(); void execute(ProcessContext& context); @@ -57,7 +55,7 @@ private: ErrorType _error; Raul::Path _path; - string _type; + Raul::URI _type; bool _is_output; DataType _data_type; PatchImpl* _patch; diff --git a/src/engine/events/DestroyEvent.cpp b/src/engine/events/DestroyEvent.cpp index a9597638..469d73f1 100644 --- a/src/engine/events/DestroyEvent.cpp +++ b/src/engine/events/DestroyEvent.cpp @@ -34,7 +34,7 @@ namespace Ingen { -DestroyEvent::DestroyEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime time, QueuedEventSource* source, const string& path) +DestroyEvent::DestroyEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime time, QueuedEventSource* source, const Raul::Path& path) : QueuedEvent(engine, responder, time, true, source) , _path(path) , _store_iterator(engine.engine_store()->end()) @@ -71,7 +71,7 @@ DestroyEvent::pre_process() _removed_table = _engine.engine_store()->remove(_store_iterator); } - if (_node != NULL && _path != "/") { + if (_node != NULL && !_path.is_root()) { assert(_node->parent_patch()); _patch_node_listnode = _node->parent_patch()->remove_node(_path.name()); if (_patch_node_listnode) { @@ -168,10 +168,10 @@ void DestroyEvent::post_process() { if (!_node && !_port) { - if (_path == "/") { + if (_path.is_root()) { _responder->respond_error("You can not destroy the root patch (/)"); } else { - string msg = string("Could not find object ") + _path + " to destroy"; + string msg = string("Could not find object ") + _path.str() + " to destroy"; _responder->respond_error(msg); } } diff --git a/src/engine/events/DestroyEvent.hpp b/src/engine/events/DestroyEvent.hpp index 59ff80ee..a3ed4bee 100644 --- a/src/engine/events/DestroyEvent.hpp +++ b/src/engine/events/DestroyEvent.hpp @@ -18,19 +18,14 @@ #ifndef DESTROYEVENT_H #define DESTROYEVENT_H -#include <string> -#include "raul/Path.hpp" #include "QueuedEvent.hpp" #include "EngineStore.hpp" #include "PatchImpl.hpp" -using std::string; - namespace Raul { template<typename T> class Array; template<typename T> class ListNode; } -template<typename T> class TreeNode; namespace Ingen { @@ -49,7 +44,7 @@ class CompiledPatch; class DestroyEvent : public QueuedEvent { public: - DestroyEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime timestamp, QueuedEventSource* source, const string& path); + DestroyEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime timestamp, QueuedEventSource* source, const Raul::Path& path); ~DestroyEvent(); void pre_process(); @@ -57,16 +52,16 @@ public: void post_process(); private: - Path _path; - EngineStore::iterator _store_iterator; - SharedPtr<NodeImpl> _node; ///< Non-NULL iff a node - SharedPtr<PortImpl> _port; ///< Non-NULL iff a port - Raul::List<DriverPort*>::Node* _driver_port; - PatchImpl::Nodes::Node* _patch_node_listnode; - Raul::List<PortImpl*>::Node* _patch_port_listnode; - Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports for Patch - CompiledPatch* _compiled_patch; ///< Patch's new process order - DisconnectAllEvent* _disconnect_event; + Raul::Path _path; + EngineStore::iterator _store_iterator; + SharedPtr<NodeImpl> _node; ///< Non-NULL iff a node + SharedPtr<PortImpl> _port; ///< Non-NULL iff a port + Raul::List<DriverPort*>::Node* _driver_port; + PatchImpl::Nodes::Node* _patch_node_listnode; + Raul::List<PortImpl*>::Node* _patch_port_listnode; + Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports for Patch + CompiledPatch* _compiled_patch; ///< Patch's new process order + DisconnectAllEvent* _disconnect_event; SharedPtr< Table<Path, SharedPtr<Shared::GraphObject> > > _removed_table; }; diff --git a/src/engine/events/DisablePortMonitoringEvent.cpp b/src/engine/events/DisablePortMonitoringEvent.cpp index cecc8dfd..1c75f06c 100644 --- a/src/engine/events/DisablePortMonitoringEvent.cpp +++ b/src/engine/events/DisablePortMonitoringEvent.cpp @@ -15,7 +15,6 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <string> #include "interface/ClientInterface.hpp" #include "events/DisablePortMonitoringEvent.hpp" #include "Responder.hpp" @@ -25,18 +24,16 @@ #include "ClientBroadcaster.hpp" #include "AudioBuffer.hpp" -using std::string; - namespace Ingen { -DisablePortMonitoringEvent::DisablePortMonitoringEvent(Engine& engine, +DisablePortMonitoringEvent::DisablePortMonitoringEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, - const std::string& port_path) -: QueuedEvent(engine, responder, timestamp), - _port_path(port_path), - _port(NULL) + const Raul::Path& port_path) + : QueuedEvent(engine, responder, timestamp) + , _port_path(port_path) + , _port(NULL) { } diff --git a/src/engine/events/DisablePortMonitoringEvent.hpp b/src/engine/events/DisablePortMonitoringEvent.hpp index 7a8e23f7..2ac802f6 100644 --- a/src/engine/events/DisablePortMonitoringEvent.hpp +++ b/src/engine/events/DisablePortMonitoringEvent.hpp @@ -15,21 +15,14 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef DISABLEPORTNOTIFICATIONEVENT_H -#define DISABLEPORTNOTIFICATIONEVENT_H +#ifndef DISABLEPORTMONITORINGEVENT_H +#define DISABLEPORTMONITORINGEVENT_H -#include <string> #include "QueuedEvent.hpp" #include "types.hpp" -using std::string; - namespace Ingen { -class PortImpl; -namespace Shared { class ClientInterface; } -using Shared::ClientInterface; - /** Disable sending of dynamic value change notifications for a port. * @@ -41,18 +34,18 @@ public: DisablePortMonitoringEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, - const std::string& port_path); + const Raul::Path& port_path); void pre_process(); void execute(ProcessContext& context); void post_process(); private: - const std::string _port_path; - Port* _port; + const Raul::Path _port_path; + Port* _port; }; } // namespace Ingen -#endif // DISABLEPORTNOTIFICATIONEVENT_H +#endif // DISABLEPORTMONITORINGEVENT_H diff --git a/src/engine/events/DisconnectAllEvent.cpp b/src/engine/events/DisconnectAllEvent.cpp index 8057a17e..2a8a2b4f 100644 --- a/src/engine/events/DisconnectAllEvent.cpp +++ b/src/engine/events/DisconnectAllEvent.cpp @@ -37,7 +37,7 @@ namespace Ingen { -DisconnectAllEvent::DisconnectAllEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& parent_path, const string& node_path) +DisconnectAllEvent::DisconnectAllEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& parent_path, const Path& node_path) : QueuedEvent(engine, responder, timestamp) , _parent_path(parent_path) , _path(node_path) @@ -163,10 +163,10 @@ DisconnectAllEvent::post_process() fmt % _path; switch (_error) { case INVALID_PARENT_PATH: - fmt % string("Invalid parent path: ").append(_parent_path); + fmt % string("Invalid parent path: ").append(_parent_path.str()); break; case PARENT_NOT_FOUND: - fmt % string("Unable to find parent: ").append(_parent_path); + fmt % string("Unable to find parent: ").append(_parent_path.str()); break; case OBJECT_NOT_FOUND: fmt % string("Unable to find object"); diff --git a/src/engine/events/DisconnectAllEvent.hpp b/src/engine/events/DisconnectAllEvent.hpp index d6e96e38..5fff30d6 100644 --- a/src/engine/events/DisconnectAllEvent.hpp +++ b/src/engine/events/DisconnectAllEvent.hpp @@ -18,13 +18,10 @@ #ifndef DISCONNECTNODEEVENT_H #define DISCONNECTNODEEVENT_H -#include <string> #include "raul/List.hpp" #include "raul/Path.hpp" #include "QueuedEvent.hpp" -using std::string; - namespace Ingen { class DisconnectionEvent; @@ -43,7 +40,7 @@ class OutputPort; class DisconnectAllEvent : public QueuedEvent { public: - DisconnectAllEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& parent_path, const string& node_path); + DisconnectAllEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& parent_path, const Raul::Path& node_path); DisconnectAllEvent(Engine& engine, PatchImpl* parent, GraphObjectImpl* object); ~DisconnectAllEvent(); diff --git a/src/engine/events/DisconnectionEvent.cpp b/src/engine/events/DisconnectionEvent.cpp index 47263755..3e7d41a0 100644 --- a/src/engine/events/DisconnectionEvent.cpp +++ b/src/engine/events/DisconnectionEvent.cpp @@ -15,7 +15,6 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <string> #include "raul/Maid.hpp" #include "raul/Path.hpp" #include "DisconnectionEvent.hpp" @@ -29,15 +28,13 @@ #include "PortImpl.hpp" #include "EngineStore.hpp" -using std::string; - namespace Ingen { //// DisconnectionEvent //// -DisconnectionEvent::DisconnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path) +DisconnectionEvent::DisconnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& src_port_path, const Raul::Path& dst_port_path) : QueuedEvent(engine, responder, timestamp) , _src_port_path(src_port_path) , _dst_port_path(dst_port_path) @@ -202,7 +199,7 @@ DisconnectionEvent::post_process() } else { // FIXME: better error messages string msg = "Unable to disconnect "; - msg.append(_src_port_path + " -> " + _dst_port_path); + msg.append(_src_port_path.str() + " -> " + _dst_port_path.str()); cerr << "DISCONNECTION ERROR " << (unsigned)_error << endl; _responder->respond_error(msg); } diff --git a/src/engine/events/DisconnectionEvent.hpp b/src/engine/events/DisconnectionEvent.hpp index 1ecf40a0..afca463a 100644 --- a/src/engine/events/DisconnectionEvent.hpp +++ b/src/engine/events/DisconnectionEvent.hpp @@ -18,12 +18,10 @@ #ifndef DISCONNECTIONEVENT_H #define DISCONNECTIONEVENT_H -#include <string> #include "raul/Path.hpp" #include "QueuedEvent.hpp" #include "types.hpp" #include "PatchImpl.hpp" -using std::string; namespace Raul { template <typename T> class ListNode; @@ -48,7 +46,7 @@ class CompiledPatch; class DisconnectionEvent : public QueuedEvent { public: - DisconnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path); + DisconnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& src_port_path, const Raul::Path& dst_port_path); DisconnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, PortImpl* const src_port, PortImpl* const dst_port); void pre_process(); diff --git a/src/engine/events/LoadPluginsEvent.hpp b/src/engine/events/LoadPluginsEvent.hpp index cd9a2884..476cf3ad 100644 --- a/src/engine/events/LoadPluginsEvent.hpp +++ b/src/engine/events/LoadPluginsEvent.hpp @@ -18,7 +18,6 @@ #ifndef LOADPLUGINSEVENT_H #define LOADPLUGINSEVENT_H -#include <list> #include "QueuedEvent.hpp" namespace Ingen { @@ -31,10 +30,10 @@ namespace Ingen { class LoadPluginsEvent : public QueuedEvent { public: - LoadPluginsEvent(Engine& engine, + LoadPluginsEvent(Engine& engine, SharedPtr<Responder> responder, - SampleCount timestamp, - QueuedEventSource* source); + SampleCount timestamp, + QueuedEventSource* source); void pre_process(); void post_process(); diff --git a/src/engine/events/MidiLearnEvent.cpp b/src/engine/events/MidiLearnEvent.cpp index 5bcbe1d2..d098c59c 100644 --- a/src/engine/events/MidiLearnEvent.cpp +++ b/src/engine/events/MidiLearnEvent.cpp @@ -27,7 +27,7 @@ namespace Ingen { -MidiLearnEvent::MidiLearnEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& node_path) +MidiLearnEvent::MidiLearnEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& node_path) : QueuedEvent(engine, responder, timestamp) , _error(NO_ERROR) , _node_path(node_path) @@ -67,10 +67,10 @@ MidiLearnEvent::post_process() _responder->respond_ok(); } else if (_node == NULL) { string msg = "Did not find node '"; - msg.append(_node_path).append("' for MIDI learn."); + msg.append(_node_path.str()).append("' for MIDI learn."); _responder->respond_error(msg); } else { - const string msg = string("Node '") + _node_path + "' is not capable of MIDI learn."; + const string msg = string("Node '") + _node_path.str() + "' is not capable of MIDI learn."; _responder->respond_error(msg); } } diff --git a/src/engine/events/MidiLearnEvent.hpp b/src/engine/events/MidiLearnEvent.hpp index 667ff06c..149b81b7 100644 --- a/src/engine/events/MidiLearnEvent.hpp +++ b/src/engine/events/MidiLearnEvent.hpp @@ -21,7 +21,6 @@ #include "QueuedEvent.hpp" #include "InternalController.hpp" #include "types.hpp" -#include <string> namespace Ingen { @@ -36,7 +35,7 @@ class ControlChangeEvent; class MidiLearnEvent : public QueuedEvent { public: - MidiLearnEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const std::string& node_path); + MidiLearnEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& node_path); void pre_process(); void execute(ProcessContext& context); @@ -48,9 +47,9 @@ private: INVALID_NODE_TYPE }; - ErrorType _error; - const std::string _node_path; - NodeImpl* _node; + ErrorType _error; + const Raul::Path _node_path; + NodeImpl* _node; }; diff --git a/src/engine/events/NoteEvent.cpp b/src/engine/events/NoteEvent.cpp index 43f59e3c..589e8462 100644 --- a/src/engine/events/NoteEvent.cpp +++ b/src/engine/events/NoteEvent.cpp @@ -47,7 +47,7 @@ NoteEvent::NoteEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount * * Triggered by OSC. */ -NoteEvent::NoteEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& node_path, bool on, uint8_t note_num, uint8_t velocity) +NoteEvent::NoteEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& node_path, bool on, uint8_t note_num, uint8_t velocity) : Event(engine, responder, timestamp), _node(NULL), _node_path(node_path), @@ -72,14 +72,14 @@ NoteEvent::execute(ProcessContext& context) if (_node != NULL && _node->plugin()->type() == Plugin::Internal) { if (_on) { - if (_node->plugin_impl()->uri() == NS_INTERNALS "Note") + if (_node->plugin_impl()->uri().str() == NS_INTERNALS "Note") ((NoteNode*)_node)->note_on(context, _note_num, _velocity, _time); - else if (_node->plugin_impl()->uri() == NS_INTERNALS "Trigger") + else if (_node->plugin_impl()->uri().str() == NS_INTERNALS "Trigger") ((TriggerNode*)_node)->note_on(context, _note_num, _velocity, _time); } else { - if (_node->plugin_impl()->uri() == NS_INTERNALS "Note") + if (_node->plugin_impl()->uri().str() == NS_INTERNALS "Note") ((NoteNode*)_node)->note_off(context, _note_num, _time); - else if (_node->plugin_impl()->uri() == NS_INTERNALS "Trigger") + else if (_node->plugin_impl()->uri().str() == NS_INTERNALS "Trigger") ((TriggerNode*)_node)->note_off(context, _note_num, _time); } } diff --git a/src/engine/events/NoteEvent.hpp b/src/engine/events/NoteEvent.hpp index 443b8d14..eac5b1f5 100644 --- a/src/engine/events/NoteEvent.hpp +++ b/src/engine/events/NoteEvent.hpp @@ -20,8 +20,6 @@ #include "Event.hpp" #include "types.hpp" -#include <string> -using std::string; namespace Ingen { @@ -46,7 +44,7 @@ public: NoteEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, - const string& node_path, + const Raul::Path& node_path, bool on, uint8_t note_num, uint8_t velocity); @@ -55,11 +53,11 @@ public: void post_process(); private: - NodeImpl* _node; - const string _node_path; - bool _on; - uint8_t _note_num; - uint8_t _velocity; + NodeImpl* _node; + const Raul::Path _node_path; + bool _on; + uint8_t _note_num; + uint8_t _velocity; }; diff --git a/src/engine/events/RegisterClientEvent.cpp b/src/engine/events/RegisterClientEvent.cpp index a8f68e21..80281dc3 100644 --- a/src/engine/events/RegisterClientEvent.cpp +++ b/src/engine/events/RegisterClientEvent.cpp @@ -23,11 +23,11 @@ namespace Ingen { -RegisterClientEvent::RegisterClientEvent(Engine& engine, +RegisterClientEvent::RegisterClientEvent(Engine& engine, SharedPtr<Responder> responder, - SampleCount timestamp, - const string& uri, - ClientInterface* client) + SampleCount timestamp, + const URI& uri, + ClientInterface* client) : QueuedEvent(engine, responder, timestamp) , _uri(uri) , _client(client) diff --git a/src/engine/events/RegisterClientEvent.hpp b/src/engine/events/RegisterClientEvent.hpp index 9e12b5ba..d75c92e6 100644 --- a/src/engine/events/RegisterClientEvent.hpp +++ b/src/engine/events/RegisterClientEvent.hpp @@ -18,12 +18,9 @@ #ifndef REGISTERCLIENTEVENT_H #define REGISTERCLIENTEVENT_H -#include "QueuedEvent.hpp" +#include "raul/URI.hpp" #include "interface/ClientInterface.hpp" -#include <string> -using std::string; -using Ingen::Shared::ClientInterface; -using Ingen::Responder; +#include "QueuedEvent.hpp" namespace Ingen { @@ -35,18 +32,18 @@ namespace Ingen { class RegisterClientEvent : public QueuedEvent { public: - RegisterClientEvent(Engine& engine, - SharedPtr<Responder> responder, - SampleCount timestamp, - const string& uri, - ClientInterface* client); + RegisterClientEvent(Engine& engine, + SharedPtr<Responder> responder, + SampleCount timestamp, + const Raul::URI& uri, + Shared::ClientInterface* client); void pre_process(); void post_process(); private: - string _uri; - ClientInterface* _client; + Raul::URI _uri; + Shared::ClientInterface* _client; }; diff --git a/src/engine/events/RenameEvent.cpp b/src/engine/events/RenameEvent.cpp index 8ce1bf9c..b2116cc4 100644 --- a/src/engine/events/RenameEvent.cpp +++ b/src/engine/events/RenameEvent.cpp @@ -31,7 +31,7 @@ using namespace std; namespace Ingen { -RenameEvent::RenameEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& new_path) +RenameEvent::RenameEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& path, const Path& new_path) : QueuedEvent(engine, responder, timestamp) , _old_path(path) , _new_path(new_path) @@ -50,12 +50,11 @@ RenameEvent::~RenameEvent() void RenameEvent::pre_process() { - if ((!Raul::Path::is_valid(_new_path) || !_old_path.parent().is_parent_of(_new_path))) { - _error = BAD_PATH; + if (!_old_path.parent().is_parent_of(_new_path)) { + _error = PARENT_DIFFERS; QueuedEvent::pre_process(); return; } - _store_iterator = _engine.engine_store()->find(_old_path); if (_store_iterator == _engine.engine_store()->end()) { _error = OBJECT_NOT_FOUND; @@ -109,7 +108,7 @@ RenameEvent::execute(ProcessContext& context) driver_port = _engine.midi_driver()->driver_port(_new_path); if (driver_port) - driver_port->set_name(_new_path); + driver_port->set_name(_new_path.str()); } } @@ -124,13 +123,13 @@ RenameEvent::post_process() _engine.broadcaster()->send_rename(_old_path, _new_path); } else { if (_error == OBJECT_EXISTS) - msg.append("Object already exists at ").append(_new_path); + msg.append("Object already exists at ").append(_new_path.str()); else if (_error == OBJECT_NOT_FOUND) - msg.append("Could not find object ").append(_old_path); + msg.append("Could not find object ").append(_old_path.str()); else if (_error == OBJECT_NOT_RENAMABLE) - msg.append(_old_path).append(" is not renamable"); - else if (_error == BAD_PATH) - msg.append(_new_path).append(" is not a valid target path"); + msg.append(_old_path.str()).append(" is not renamable"); + else if (_error == PARENT_DIFFERS) + msg.append(_new_path.str()).append(" is a child of a different patch"); _responder->respond_error(msg); } diff --git a/src/engine/events/RenameEvent.hpp b/src/engine/events/RenameEvent.hpp index 2cbf6902..23dd47b3 100644 --- a/src/engine/events/RenameEvent.hpp +++ b/src/engine/events/RenameEvent.hpp @@ -18,16 +18,10 @@ #ifndef RENAMEEVENT_H #define RENAMEEVENT_H -#include <string> #include "raul/Path.hpp" #include "QueuedEvent.hpp" #include "EngineStore.hpp" -using std::string; - -template<typename T> class TreeNode; -template<typename T> class ListNode; - namespace Ingen { class PatchImpl; @@ -40,7 +34,7 @@ class PatchImpl; class RenameEvent : public QueuedEvent { public: - RenameEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& old_path, const string& new_path); + RenameEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& old_path, const Raul::Path& new_path); ~RenameEvent(); void pre_process(); @@ -53,14 +47,14 @@ private: OBJECT_NOT_FOUND, OBJECT_EXISTS, OBJECT_NOT_RENAMABLE, - BAD_PATH + PARENT_DIFFERS }; - Path _old_path; - string _new_path; - PatchImpl* _parent_patch; - EngineStore::iterator _store_iterator; - ErrorType _error; + Raul::Path _old_path; + Raul::Path _new_path; + PatchImpl* _parent_patch; + EngineStore::iterator _store_iterator; + ErrorType _error; }; diff --git a/src/engine/events/RequestAllObjectsEvent.hpp b/src/engine/events/RequestAllObjectsEvent.hpp index 0537575a..9e4701a0 100644 --- a/src/engine/events/RequestAllObjectsEvent.hpp +++ b/src/engine/events/RequestAllObjectsEvent.hpp @@ -18,17 +18,11 @@ #ifndef REQUESTALLOBJECTSEVENT_H #define REQUESTALLOBJECTSEVENT_H -#include <string> #include "QueuedEvent.hpp" -using std::string; namespace Ingen { -namespace Shared { - class ClientInterface; -} using Shared::ClientInterface; - /** A request from a client to send notification of all objects (ie refresh). * * \ingroup engine diff --git a/src/engine/events/RequestMetadataEvent.cpp b/src/engine/events/RequestMetadataEvent.cpp index 628b11c4..75ff2a65 100644 --- a/src/engine/events/RequestMetadataEvent.cpp +++ b/src/engine/events/RequestMetadataEvent.cpp @@ -15,7 +15,6 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <string> #include "interface/ClientInterface.hpp" #include "RequestMetadataEvent.hpp" #include "Responder.hpp" @@ -24,8 +23,6 @@ #include "EngineStore.hpp" #include "ClientBroadcaster.hpp" -using std::string; - namespace Ingen { @@ -33,8 +30,8 @@ RequestMetadataEvent::RequestMetadataEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, bool property, - const string& node_path, - const string& key) + const Path& node_path, + const URI& key) : QueuedEvent(engine, responder, timestamp) , _path(node_path) , _property(property) @@ -69,8 +66,7 @@ RequestMetadataEvent::post_process() { if (_responder->client()) { if (!_object) { - string msg = "Unable to find variable subject "; - msg += _path; + const string msg = "Unable to find variable subject " + _path.str(); _responder->respond_error(msg); } else { _responder->respond_ok(); diff --git a/src/engine/events/RequestMetadataEvent.hpp b/src/engine/events/RequestMetadataEvent.hpp index 3a1d8827..d3480b7c 100644 --- a/src/engine/events/RequestMetadataEvent.hpp +++ b/src/engine/events/RequestMetadataEvent.hpp @@ -18,17 +18,13 @@ #ifndef REQUESTMETADATAEVENT_H #define REQUESTMETADATAEVENT_H -#include <string> #include "QueuedEvent.hpp" #include "raul/Atom.hpp" -using std::string; +#include "raul/URI.hpp" namespace Ingen { class GraphObjectImpl; -namespace Shared { - class ClientInterface; -} using Shared::ClientInterface; /** A request from a client for a piece of variable. @@ -42,16 +38,16 @@ public: SharedPtr<Responder> responder, SampleCount timestamp, bool property, - const string& path, - const string& key); + const Raul::Path& path, + const Raul::URI& key); void pre_process(); void post_process(); private: - string _path; + Raul::Path _path; bool _property; - string _key; + Raul::URI _key; Raul::Atom _value; GraphObjectImpl* _object; }; diff --git a/src/engine/events/RequestObjectEvent.cpp b/src/engine/events/RequestObjectEvent.cpp index c7fdd2d8..6ee97388 100644 --- a/src/engine/events/RequestObjectEvent.cpp +++ b/src/engine/events/RequestObjectEvent.cpp @@ -15,7 +15,6 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <string> #include "RequestObjectEvent.hpp" #include "interface/ClientInterface.hpp" #include "Responder.hpp" @@ -28,15 +27,13 @@ #include "ObjectSender.hpp" #include "ProcessContext.hpp" -using std::string; - namespace Ingen { -RequestObjectEvent::RequestObjectEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path) -: QueuedEvent(engine, responder, timestamp), - _path(path), - _object(NULL) +RequestObjectEvent::RequestObjectEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& path) + : QueuedEvent(engine, responder, timestamp) + , _path(path) + , _object(NULL) { } diff --git a/src/engine/events/RequestObjectEvent.hpp b/src/engine/events/RequestObjectEvent.hpp index 52459ada..79db5b19 100644 --- a/src/engine/events/RequestObjectEvent.hpp +++ b/src/engine/events/RequestObjectEvent.hpp @@ -18,17 +18,12 @@ #ifndef REQUESTOBJECTEVENT_H #define REQUESTOBJECTEVENT_H -#include <string> #include "QueuedEvent.hpp" #include "types.hpp" -using std::string; - namespace Ingen { class GraphObjectImpl; -namespace Shared { class ClientInterface; } -using Shared::ClientInterface; /** A request from a client to send the value of a port. @@ -38,14 +33,14 @@ using Shared::ClientInterface; class RequestObjectEvent : public QueuedEvent { public: - RequestObjectEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& port_path); + RequestObjectEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& port_path); void pre_process(); void execute(ProcessContext& context); void post_process(); private: - const string _path; + const Raul::Path _path; GraphObjectImpl* _object; }; diff --git a/src/engine/events/RequestPluginEvent.cpp b/src/engine/events/RequestPluginEvent.cpp index 3acdceed..98e70f2f 100644 --- a/src/engine/events/RequestPluginEvent.cpp +++ b/src/engine/events/RequestPluginEvent.cpp @@ -15,7 +15,6 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <string> #include "interface/ClientInterface.hpp" #include "RequestPluginEvent.hpp" #include "Responder.hpp" @@ -27,15 +26,13 @@ #include "PluginImpl.hpp" #include "ProcessContext.hpp" -using std::string; - namespace Ingen { -RequestPluginEvent::RequestPluginEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& uri) -: QueuedEvent(engine, responder, timestamp), - _uri(uri), - _plugin(NULL) +RequestPluginEvent::RequestPluginEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const URI& uri) + : QueuedEvent(engine, responder, timestamp) + , _uri(uri) + , _plugin(NULL) { } diff --git a/src/engine/events/RequestPluginEvent.hpp b/src/engine/events/RequestPluginEvent.hpp index 8f936098..eece8610 100644 --- a/src/engine/events/RequestPluginEvent.hpp +++ b/src/engine/events/RequestPluginEvent.hpp @@ -18,12 +18,10 @@ #ifndef REQUESTPLUGINEVENT_H #define REQUESTPLUGINEVENT_H -#include <string> +#include "raul/URI.hpp" #include "QueuedEvent.hpp" #include "types.hpp" -using std::string; - namespace Ingen { class PluginImpl; @@ -36,14 +34,14 @@ class PluginImpl; class RequestPluginEvent : public QueuedEvent { public: - RequestPluginEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& uri); + RequestPluginEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::URI& uri); void pre_process(); void execute(ProcessContext& context); void post_process(); private: - const string _uri; + const Raul::URI _uri; const PluginImpl* _plugin; }; diff --git a/src/engine/events/RequestPortValueEvent.cpp b/src/engine/events/RequestPortValueEvent.cpp index 0bb9867a..b4502ae2 100644 --- a/src/engine/events/RequestPortValueEvent.cpp +++ b/src/engine/events/RequestPortValueEvent.cpp @@ -15,7 +15,6 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <string> #include "RequestPortValueEvent.hpp" #include "interface/ClientInterface.hpp" #include "Responder.hpp" @@ -26,16 +25,14 @@ #include "AudioBuffer.hpp" #include "ProcessContext.hpp" -using std::string; - namespace Ingen { -RequestPortValueEvent::RequestPortValueEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& port_path) -: QueuedEvent(engine, responder, timestamp), - _port_path(port_path), - _port(NULL), - _value(0.0) +RequestPortValueEvent::RequestPortValueEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Path& port_path) + : QueuedEvent(engine, responder, timestamp) + , _port_path(port_path) + , _port(NULL) + , _value(0.0) { } diff --git a/src/engine/events/RequestPortValueEvent.hpp b/src/engine/events/RequestPortValueEvent.hpp index dd52c535..79ca4bfe 100644 --- a/src/engine/events/RequestPortValueEvent.hpp +++ b/src/engine/events/RequestPortValueEvent.hpp @@ -18,17 +18,12 @@ #ifndef REQUESTPORTVALUEEVENT_H #define REQUESTPORTVALUEEVENT_H -#include <string> #include "QueuedEvent.hpp" #include "types.hpp" -using std::string; - namespace Ingen { class PortImpl; -namespace Shared { class ClientInterface; } -using Shared::ClientInterface; /** A request from a client to send the value of a port. @@ -38,16 +33,16 @@ using Shared::ClientInterface; class RequestPortValueEvent : public QueuedEvent { public: - RequestPortValueEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& port_path); + RequestPortValueEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& port_path); void pre_process(); void execute(ProcessContext& context); void post_process(); private: - const string _port_path; - PortImpl* _port; - Sample _value; + const Raul::Path _port_path; + PortImpl* _port; + Sample _value; }; diff --git a/src/engine/events/SendPortActivityEvent.hpp b/src/engine/events/SendPortActivityEvent.hpp index dfbb8a10..29c7f1a8 100644 --- a/src/engine/events/SendPortActivityEvent.hpp +++ b/src/engine/events/SendPortActivityEvent.hpp @@ -18,10 +18,8 @@ #ifndef SENDPORTACTIVITYEVENT_H #define SENDPORTACTIVITYEVENT_H -#include <string> #include "Event.hpp" #include "types.hpp" -using std::string; namespace Ingen { diff --git a/src/engine/events/SendPortValueEvent.hpp b/src/engine/events/SendPortValueEvent.hpp index ad9ae5a1..8eaaee1a 100644 --- a/src/engine/events/SendPortValueEvent.hpp +++ b/src/engine/events/SendPortValueEvent.hpp @@ -18,10 +18,8 @@ #ifndef SENDPORTVALUEEVENT_H #define SENDPORTVALUEEVENT_H -#include <string> #include "engine/Event.hpp" #include "engine/types.hpp" -using std::string; namespace Ingen { diff --git a/src/engine/events/SetMetadataEvent.cpp b/src/engine/events/SetMetadataEvent.cpp index e0b51f2b..679433a9 100644 --- a/src/engine/events/SetMetadataEvent.cpp +++ b/src/engine/events/SetMetadataEvent.cpp @@ -36,8 +36,8 @@ SetMetadataEvent::SetMetadataEvent( SharedPtr<Responder> responder, SampleCount timestamp, bool property, - const string& path, - const string& key, + const Path& path, + const URI& key, const Atom& value) : QueuedEvent(engine, responder, timestamp) , _error(NO_ERROR) @@ -56,12 +56,6 @@ SetMetadataEvent::SetMetadataEvent( void SetMetadataEvent::pre_process() { - if (!Path::is_valid(_path)) { - _error = INVALID_PATH; - QueuedEvent::pre_process(); - return; - } - _object = _engine.engine_store()->find_object(_path); if (_object == NULL) { _error = NOT_FOUND; @@ -79,10 +73,10 @@ SetMetadataEvent::pre_process() _patch = dynamic_cast<PatchImpl*>(_object); - if (_key == "ingen:broadcast") { + if (_key.str() == "ingen:broadcast") { _special_type = ENABLE_BROADCAST; } else if (_patch) { - if (!_property && _key == "ingen:enabled") { + if (!_property && _key.str() == "ingen:enabled") { if (_value.type() == Atom::BOOL) { _special_type = ENABLE; if (_value.get_bool() && !_patch->compiled_patch()) @@ -90,13 +84,13 @@ SetMetadataEvent::pre_process() } else { _error = BAD_TYPE; } - } else if (!_property && _key == "ingen:polyphonic") { + } else if (!_property && _key.str() == "ingen:polyphonic") { if (_value.type() == Atom::BOOL) { _special_type = POLYPHONIC; } else { _error = BAD_TYPE; } - } else if (_property && _key == "ingen:polyphony") { + } else if (_property && _key.str() == "ingen:polyphony") { if (_value.type() == Atom::INT) { _special_type = POLYPHONY; _patch->prepare_internal_poly(_value.get_int32()); @@ -165,11 +159,6 @@ SetMetadataEvent::post_process() case INTERNAL: _responder->respond_error("Internal error"); break; - case INVALID_PATH: - _responder->respond_error((boost::format( - "Invalid path '%1%' setting '%2%'") - % _path % _key).str()); - break; case BAD_TYPE: _responder->respond_error((boost::format("Bad type for '%1%'") % _key).str()); break; diff --git a/src/engine/events/SetMetadataEvent.hpp b/src/engine/events/SetMetadataEvent.hpp index 09774fe9..e4f64a11 100644 --- a/src/engine/events/SetMetadataEvent.hpp +++ b/src/engine/events/SetMetadataEvent.hpp @@ -18,11 +18,9 @@ #ifndef SETMETADATAEVENT_H #define SETMETADATAEVENT_H -#include <string> -#include "QueuedEvent.hpp" +#include "raul/URI.hpp" #include "raul/Atom.hpp" - -using std::string; +#include "QueuedEvent.hpp" namespace Ingen { @@ -42,8 +40,8 @@ public: SharedPtr<Responder> responder, SampleCount timestamp, bool property, - const string& path, - const string& key, + const Raul::Path& path, + const Raul::URI& key, const Raul::Atom& value); void pre_process(); @@ -51,7 +49,7 @@ public: void post_process(); private: - enum { NO_ERROR, NOT_FOUND, INTERNAL, INVALID_PATH, BAD_TYPE } _error; + enum { NO_ERROR, NOT_FOUND, INTERNAL, BAD_TYPE } _error; enum { NONE, ENABLE, @@ -62,8 +60,8 @@ private: bool _property; bool _success; - string _path; - string _key; + Raul::Path _path; + Raul::URI _key; Raul::Atom _value; GraphObjectImpl* _object; PatchImpl* _patch; diff --git a/src/engine/events/SetPortValueEvent.cpp b/src/engine/events/SetPortValueEvent.cpp index 48813c72..b6318d48 100644 --- a/src/engine/events/SetPortValueEvent.cpp +++ b/src/engine/events/SetPortValueEvent.cpp @@ -42,7 +42,7 @@ SetPortValueEvent::SetPortValueEvent(Engine& engine, SharedPtr<Responder> responder, bool queued, SampleCount timestamp, - const string& port_path, + const Raul::Path& port_path, const Raul::Atom& value) : QueuedEvent(engine, responder, timestamp) , _queued(queued) @@ -62,7 +62,7 @@ SetPortValueEvent::SetPortValueEvent(Engine& engine, bool queued, SampleCount timestamp, uint32_t voice_num, - const string& port_path, + const Raul::Path& port_path, const Raul::Atom& value) : QueuedEvent(engine, responder, timestamp) , _queued(queued) @@ -85,14 +85,9 @@ void SetPortValueEvent::pre_process() { if (_queued) { - if (_port == NULL) { - if (Path::is_valid(_port_path)) - _port = _engine.engine_store()->find_port(_port_path); - else - _error = ILLEGAL_PATH; - } - - if (_port == NULL && _error == NO_ERROR) + if (_port == NULL) + _port = _engine.engine_store()->find_port(_port_path); + if (_port == NULL) _error = PORT_NOT_FOUND; } @@ -123,14 +118,10 @@ SetPortValueEvent::execute(ProcessContext& context) void SetPortValueEvent::apply(uint32_t start, uint32_t nframes) { - if (_error == NO_ERROR && _port == NULL) { - if (Path::is_valid(_port_path)) - _port = _engine.engine_store()->find_port(_port_path); - else - _error = ILLEGAL_PATH; - } + if (_error == NO_ERROR && !_port) + _port = _engine.engine_store()->find_port(_port_path); - if (_port == NULL) { + if (!_port) { if (_error == NO_ERROR) _error = PORT_NOT_FOUND; /*} else if (_port->buffer(0)->capacity() < _data_size) { @@ -202,31 +193,32 @@ SetPortValueEvent::apply(uint32_t start, uint32_t nframes) void SetPortValueEvent::post_process() { - if (_error == NO_ERROR) { + string msg; + std::ostringstream ss; + switch (_error) { + case NO_ERROR: assert(_port != NULL); _responder->respond_ok(); _engine.broadcaster()->send_port_value(_port_path, _value); - - } else if (_error == ILLEGAL_PATH) { - string msg = "Illegal port path \""; - msg.append(_port_path).append("\""); - _responder->respond_error(msg); - - } else if (_error == ILLEGAL_VOICE) { - std::ostringstream ss; + break; + case TYPE_MISMATCH: + _responder->respond_error("type mismatch"); + break; + case ILLEGAL_VOICE: ss << "Illegal voice number " << _voice_num; _responder->respond_error(ss.str()); - - } else if (_error == PORT_NOT_FOUND) { - string msg = "Unable to find port "; - msg.append(_port_path).append(" for set_port_value"); + break; + case PORT_NOT_FOUND: + msg = "Unable to find port "; + msg.append(_port_path.str()).append(" for set_port_value"); _responder->respond_error(msg); - - } else if (_error == NO_SPACE) { - std::ostringstream msg("Attempt to write "); - msg << _value.data_size() << " bytes to " << _port_path << ", with capacity " + break; + case NO_SPACE: + ss << "Attempt to write " << _value.data_size() << " bytes to " + << _port_path.str() << ", with capacity " << _port->buffer_size() << endl; - _responder->respond_error(msg.str()); + _responder->respond_error(ss.str()); + break; } } diff --git a/src/engine/events/SetPortValueEvent.hpp b/src/engine/events/SetPortValueEvent.hpp index 64af26c9..f1385e26 100644 --- a/src/engine/events/SetPortValueEvent.hpp +++ b/src/engine/events/SetPortValueEvent.hpp @@ -18,11 +18,9 @@ #ifndef SETPORTVALUEEVENT_H #define SETPORTVALUEEVENT_H -#include <string> #include "raul/Atom.hpp" #include "QueuedEvent.hpp" #include "types.hpp" -using std::string; namespace Ingen { @@ -45,7 +43,7 @@ public: SharedPtr<Responder> responder, bool queued, SampleCount timestamp, - const string& port_path, + const Raul::Path& port_path, const Raul::Atom& value); SetPortValueEvent(Engine& engine, @@ -53,7 +51,7 @@ public: bool queued, SampleCount timestamp, uint32_t voice_num, - const string& port_path, + const Raul::Path& port_path, const Raul::Atom& value); ~SetPortValueEvent(); @@ -63,15 +61,20 @@ public: void post_process(); private: - enum ErrorType { NO_ERROR, PORT_NOT_FOUND, NO_SPACE, - ILLEGAL_PATH, ILLEGAL_VOICE, TYPE_MISMATCH }; + enum ErrorType { + NO_ERROR, + PORT_NOT_FOUND, + NO_SPACE, + ILLEGAL_VOICE, + TYPE_MISMATCH + }; void apply(uint32_t start, uint32_t nframes); bool _queued; bool _omni; uint32_t _voice_num; - const string _port_path; + const Raul::Path _port_path; const Raul::Atom _value; PortImpl* _port; ErrorType _error; diff --git a/src/engine/events/UnregisterClientEvent.cpp b/src/engine/events/UnregisterClientEvent.cpp index 72ab8048..02296ec9 100644 --- a/src/engine/events/UnregisterClientEvent.cpp +++ b/src/engine/events/UnregisterClientEvent.cpp @@ -24,9 +24,9 @@ namespace Ingen { -UnregisterClientEvent::UnregisterClientEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& uri) -: QueuedEvent(engine, responder, timestamp) -, _uri(uri) +UnregisterClientEvent::UnregisterClientEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const URI& uri) + : QueuedEvent(engine, responder, timestamp) + , _uri(uri) { } diff --git a/src/engine/events/UnregisterClientEvent.hpp b/src/engine/events/UnregisterClientEvent.hpp index c21bc5da..f62940fa 100644 --- a/src/engine/events/UnregisterClientEvent.hpp +++ b/src/engine/events/UnregisterClientEvent.hpp @@ -19,16 +19,10 @@ #define UNREGISTERCLIENTEVENT_H #include "QueuedEvent.hpp" -#include <string> -using std::string; +#include "raul/URI.hpp" namespace Ingen { -namespace Shared { - class ClientInterface; -} -using Shared::ClientInterface; - /** Unregisters an OSC client so it no longer receives notifications. * @@ -37,15 +31,15 @@ using Shared::ClientInterface; class UnregisterClientEvent : public QueuedEvent { public: - UnregisterClientEvent(Engine& engine, + UnregisterClientEvent(Engine& engine, SharedPtr<Responder> responder, - SampleCount timestamp, - const string& uri); + SampleCount timestamp, + const Raul::URI& uri); void post_process(); private: - string _uri; + Raul::URI _uri; }; |