diff options
author | David Robillard <d@drobilla.net> | 2009-05-12 21:58:35 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-05-12 21:58:35 +0000 |
commit | ed1032ca54a55c48d2f7c9709b77a4f4da935e99 (patch) | |
tree | ebc821e22bcdd9424383174fe9ec2a6a32dbb362 /src/client | |
parent | c32745b044d88e74526599c5994255a2ea6d2c21 (diff) | |
download | ingen-ed1032ca54a55c48d2f7c9709b77a4f4da935e99.tar.gz ingen-ed1032ca54a55c48d2f7c9709b77a4f4da935e99.tar.bz2 ingen-ed1032ca54a55c48d2f7c9709b77a4f4da935e99.zip |
Bring EngineInterface and ClientInterface closer together.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1990 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/ClientStore.cpp | 21 | ||||
-rw-r--r-- | src/client/ClientStore.hpp | 5 | ||||
-rw-r--r-- | src/client/HTTPEngineSender.cpp | 2 | ||||
-rw-r--r-- | src/client/HTTPEngineSender.hpp | 2 | ||||
-rw-r--r-- | src/client/OSCClientReceiver.cpp | 12 | ||||
-rw-r--r-- | src/client/OSCClientReceiver.hpp | 4 | ||||
-rw-r--r-- | src/client/OSCEngineSender.cpp | 4 | ||||
-rw-r--r-- | src/client/OSCEngineSender.hpp | 2 | ||||
-rw-r--r-- | src/client/SigClientInterface.hpp | 8 | ||||
-rw-r--r-- | src/client/ThreadedSigClientInterface.hpp | 10 |
10 files changed, 43 insertions, 27 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 2acb2124..c73150d0 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -49,7 +49,7 @@ ClientStore::ClientStore(SharedPtr<EngineInterface> engine, SharedPtr<SigClientI emitter->signal_new_patch.connect(sigc::mem_fun(this, &ClientStore::new_patch)); emitter->signal_new_node.connect(sigc::mem_fun(this, &ClientStore::new_node)); emitter->signal_new_port.connect(sigc::mem_fun(this, &ClientStore::new_port)); - emitter->signal_patch_cleared.connect(sigc::mem_fun(this, &ClientStore::patch_cleared)); + emitter->signal_clear_patch.connect(sigc::mem_fun(this, &ClientStore::clear_patch)); emitter->signal_connection.connect(sigc::mem_fun(this, &ClientStore::connect)); emitter->signal_disconnection.connect(sigc::mem_fun(this, &ClientStore::disconnect)); emitter->signal_variable_change.connect(sigc::mem_fun(this, &ClientStore::set_variable)); @@ -377,8 +377,16 @@ ClientStore::destroy(const std::string& path) } void -ClientStore::rename(const Path& old_path, const Path& new_path) +ClientStore::rename(const std::string& old_path_str, const std::string& new_path_str) { + if (!Path::is_valid(old_path_str) || !Path::is_valid(new_path_str)) { + cerr << "[Store] Bad path renaming " << old_path_str << " to " << new_path_str << endl; + return; + } + + Path old_path(old_path_str); + Path new_path(new_path_str); + iterator parent = find(old_path); if (parent == end()) { cerr << "[Store] Failed to find object " << old_path << " to rename." << endl; @@ -491,8 +499,15 @@ ClientStore::new_port(const string& path, const string& type, uint32_t index, bo void -ClientStore::patch_cleared(const Path& path) +ClientStore::clear_patch(const std::string& path_str) { + if (!Path::is_valid(path_str)) { + cerr << "[Store] Illegal path in clear: " << path_str << endl; + return; + } + + Path path(path_str); + iterator i = find(path); if (i != end()) { assert((*i).second->path() == path); diff --git a/src/client/ClientStore.hpp b/src/client/ClientStore.hpp index 9fb677ea..d3ab2978 100644 --- a/src/client/ClientStore.hpp +++ b/src/client/ClientStore.hpp @@ -76,6 +76,7 @@ public: void new_patch(const string& path, uint32_t poly); void new_node(const string& path, const string& plugin_uri); void new_port(const string& path, const string& type, uint32_t index, bool is_output); + void rename(const string& old_path, const string& new_path); void set_variable(const string& subject_path, const string& predicate, const Atom& value); void set_property(const string& subject_path, const string& predicate, const Atom& value); void set_port_value(const string& port_path, const Raul::Atom& value); @@ -119,8 +120,8 @@ private: void bundle_end() {} // Slots for SigClientInterface signals - void rename(const Path& old_path, const Path& new_path); - void patch_cleared(const Path& path); + void object_renamed(const Path& old_path, const Path& new_path); + void clear_patch(const std::string& path); void activity(const Path& path); bool attempt_connection(const Path& src_port_path, const Path& dst_port_path, bool add_orphan=false); diff --git a/src/client/HTTPEngineSender.cpp b/src/client/HTTPEngineSender.cpp index cd616042..4a54183d 100644 --- a/src/client/HTTPEngineSender.cpp +++ b/src/client/HTTPEngineSender.cpp @@ -185,7 +185,7 @@ HTTPEngineSender::disconnect(const string& src_port_path, void HTTPEngineSender::disconnect_all(const string& parent_patch_path, - const string& node_path) + const string& path) { } diff --git a/src/client/HTTPEngineSender.hpp b/src/client/HTTPEngineSender.hpp index 4ad5fb4f..88f3a132 100644 --- a/src/client/HTTPEngineSender.hpp +++ b/src/client/HTTPEngineSender.hpp @@ -108,7 +108,7 @@ public: const string& dst_port_path); void disconnect_all(const string& parent_patch_path, - const string& node_path); + const string& path); void set_port_value(const string& port_path, const Raul::Atom& value); diff --git a/src/client/OSCClientReceiver.cpp b/src/client/OSCClientReceiver.cpp index e76f0081..445c92cc 100644 --- a/src/client/OSCClientReceiver.cpp +++ b/src/client/OSCClientReceiver.cpp @@ -145,8 +145,8 @@ OSCClientReceiver::setup_callbacks() lo_server_thread_add_method(_st, "/ingen/plugin", "sss", plugin_cb, this); lo_server_thread_add_method(_st, "/ingen/new_patch", "si", new_patch_cb, this); lo_server_thread_add_method(_st, "/ingen/destroyed", "s", destroyed_cb, this); - lo_server_thread_add_method(_st, "/ingen/patch_cleared", "s", patch_cleared_cb, this); - lo_server_thread_add_method(_st, "/ingen/object_renamed", "ss", object_renamed_cb, this); + lo_server_thread_add_method(_st, "/ingen/clear_patch", "s", clear_patch_cb, this); + lo_server_thread_add_method(_st, "/ingen/rename", "ss", rename_cb, this); lo_server_thread_add_method(_st, "/ingen/new_connection", "ss", connection_cb, this); lo_server_thread_add_method(_st, "/ingen/disconnection", "ss", disconnection_cb, this); lo_server_thread_add_method(_st, "/ingen/new_node", "ss", new_node_cb, this); @@ -188,17 +188,17 @@ OSCClientReceiver::_destroyed_cb(const char* path, const char* types, lo_arg** a int -OSCClientReceiver::_patch_cleared_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) +OSCClientReceiver::_clear_patch_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) { - _target->patch_cleared((const char*)&argv[0]->s); + _target->clear_patch((const char*)&argv[0]->s); return 0; } int -OSCClientReceiver::_object_renamed_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) +OSCClientReceiver::_rename_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) { - _target->object_renamed((const char*)&argv[0]->s, (const char*)&argv[1]->s); + _target->rename((const char*)&argv[0]->s, (const char*)&argv[1]->s); return 0; } diff --git a/src/client/OSCClientReceiver.hpp b/src/client/OSCClientReceiver.hpp index 9203f096..c0ea2f43 100644 --- a/src/client/OSCClientReceiver.hpp +++ b/src/client/OSCClientReceiver.hpp @@ -85,8 +85,8 @@ private: LO_HANDLER(plugin_list_end); LO_HANDLER(new_patch); LO_HANDLER(destroyed); - LO_HANDLER(patch_cleared); - LO_HANDLER(object_renamed); + LO_HANDLER(clear_patch); + LO_HANDLER(rename); LO_HANDLER(connection); LO_HANDLER(disconnection); LO_HANDLER(new_node); diff --git a/src/client/OSCEngineSender.cpp b/src/client/OSCEngineSender.cpp index 592702a3..0dfa9d5b 100644 --- a/src/client/OSCEngineSender.cpp +++ b/src/client/OSCEngineSender.cpp @@ -277,12 +277,12 @@ OSCEngineSender::disconnect(const string& src_port_path, void OSCEngineSender::disconnect_all(const string& parent_patch_path, - const string& node_path) + const string& path) { send("/ingen/disconnect_all", "iss", next_id(), parent_patch_path.c_str(), - node_path.c_str(), + path.c_str(), LO_ARGS_END); } diff --git a/src/client/OSCEngineSender.hpp b/src/client/OSCEngineSender.hpp index 22de8e70..620a73da 100644 --- a/src/client/OSCEngineSender.hpp +++ b/src/client/OSCEngineSender.hpp @@ -112,7 +112,7 @@ public: const string& dst_port_path); void disconnect_all(const string& parent_patch_path, - const string& node_path); + const string& path); void set_port_value(const string& port_path, const Raul::Atom& value); diff --git a/src/client/SigClientInterface.hpp b/src/client/SigClientInterface.hpp index 580de7b2..ff54bab5 100644 --- a/src/client/SigClientInterface.hpp +++ b/src/client/SigClientInterface.hpp @@ -58,7 +58,7 @@ public: sigc::signal<void, string, uint32_t> signal_new_patch; sigc::signal<void, string, string> signal_new_node; sigc::signal<void, string, string, uint32_t, bool> signal_new_port; - sigc::signal<void, string> signal_patch_cleared; + sigc::signal<void, string> signal_clear_patch; sigc::signal<void, string, string> signal_object_renamed; sigc::signal<void, string> signal_object_destroyed; sigc::signal<void, string, string> signal_connection; @@ -122,10 +122,10 @@ protected: void destroy(const string& path) { if (_enabled) signal_object_destroyed.emit(path); } - void patch_cleared(const string& path) - { if (_enabled) signal_patch_cleared.emit(path); } + void clear_patch(const string& path) + { if (_enabled) signal_clear_patch.emit(path); } - void object_renamed(const string& old_path, const string& new_path) + void rename(const string& old_path, const string& new_path) { if (_enabled) signal_object_renamed.emit(old_path, new_path); } void disconnect(const string& src_port_path, const string& dst_port_path) diff --git a/src/client/ThreadedSigClientInterface.hpp b/src/client/ThreadedSigClientInterface.hpp index ff4b202c..1e4a2beb 100644 --- a/src/client/ThreadedSigClientInterface.hpp +++ b/src/client/ThreadedSigClientInterface.hpp @@ -57,7 +57,7 @@ public: , new_node_slot(signal_new_node.make_slot()) , new_port_slot(signal_new_port.make_slot()) , connection_slot(signal_connection.make_slot()) - , patch_cleared_slot(signal_patch_cleared.make_slot()) + , clear_patch_slot(signal_clear_patch.make_slot()) , object_destroyed_slot(signal_object_destroyed.make_slot()) , object_renamed_slot(signal_object_renamed.make_slot()) , disconnection_slot(signal_disconnection.make_slot()) @@ -114,10 +114,10 @@ public: void destroy(const string& path) { push_sig(sigc::bind(object_destroyed_slot, path)); } - void patch_cleared(const string& path) - { push_sig(sigc::bind(patch_cleared_slot, path)); } + void clear_patch(const string& path) + { push_sig(sigc::bind(clear_patch_slot, path)); } - void object_renamed(const string& old_path, const string& new_path) + void rename(const string& old_path, const string& new_path) { push_sig(sigc::bind(object_renamed_slot, old_path, new_path)); } void disconnect(const string& src_port_path, const string& dst_port_path) @@ -166,7 +166,7 @@ private: sigc::slot<void, string, string> new_node_slot; sigc::slot<void, string, string, uint32_t, bool> new_port_slot; sigc::slot<void, string, string> connection_slot; - sigc::slot<void, string> patch_cleared_slot; + sigc::slot<void, string> clear_patch_slot; sigc::slot<void, string> object_destroyed_slot; sigc::slot<void, string, string> object_renamed_slot; sigc::slot<void, string, string> disconnection_slot; |