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/events | |
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/events')
46 files changed, 244 insertions, 377 deletions
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; }; |