summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-02-13 22:07:26 +0000
committerDavid Robillard <d@drobilla.net>2010-02-13 22:07:26 +0000
commitad07c414d557629251b2f4ea4078c22f241cc865 (patch)
treedafecc5dd8758e0273105bb2a2a8d481509d19fb /src/client
parentb8cf49d04a2600f83767ddda46929d4d47adc3fd (diff)
downloadingen-ad07c414d557629251b2f4ea4078c22f241cc865.tar.gz
ingen-ad07c414d557629251b2f4ea4078c22f241cc865.tar.bz2
ingen-ad07c414d557629251b2f4ea4078c22f241cc865.zip
Learn and remove bindings exclusively through property interface.
Note this commit breaks some aspects of OSC and HTTP control for now. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2442 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client')
-rw-r--r--src/client/ClientStore.cpp23
-rw-r--r--src/client/ClientStore.hpp2
-rw-r--r--src/client/HTTPEngineSender.cpp15
-rw-r--r--src/client/HTTPEngineSender.hpp7
-rw-r--r--src/client/OSCClientReceiver.cpp23
-rw-r--r--src/client/OSCClientReceiver.hpp1
-rw-r--r--src/client/OSCEngineSender.cpp57
-rw-r--r--src/client/OSCEngineSender.hpp7
-rw-r--r--src/client/SigClientInterface.hpp10
-rw-r--r--src/client/ThreadedSigClientInterface.hpp6
10 files changed, 95 insertions, 56 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index e5fbab6a..cf05e599 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -48,6 +48,7 @@ ClientStore::ClientStore(SharedPtr<EngineInterface> engine, SharedPtr<SigClientI
emitter->signal_object_deleted.connect(sigc::mem_fun(this, &ClientStore::del));
emitter->signal_object_moved.connect(sigc::mem_fun(this, &ClientStore::move));
emitter->signal_put.connect(sigc::mem_fun(this, &ClientStore::put));
+ emitter->signal_delta.connect(sigc::mem_fun(this, &ClientStore::delta));
emitter->signal_connection.connect(sigc::mem_fun(this, &ClientStore::connect));
emitter->signal_disconnection.connect(sigc::mem_fun(this, &ClientStore::disconnect));
emitter->signal_property_change.connect(sigc::mem_fun(this, &ClientStore::set_property));
@@ -338,6 +339,28 @@ ClientStore::put(const URI& uri, const Resource::Properties& properties)
void
+ClientStore::delta(const URI& uri, const Resource::Properties& remove, const Resource::Properties& add)
+{
+ bool is_meta = ResourceImpl::is_meta_uri(uri);
+ string path_str = is_meta ? (string("/") + uri.chop_start("#")) : uri.str();
+ if (!Path::is_valid(path_str)) {
+ LOG(error) << "Bad path: " << uri.str() << " - " << path_str << endl;
+ return;
+ }
+
+ Path path(is_meta ? (string("/") + uri.chop_start("#")) : uri.str());
+
+ SharedPtr<ObjectModel> obj = object(path);
+ if (obj) {
+ obj->remove_properties(remove);
+ obj->add_properties(add);
+ } else {
+ LOG(warn) << "Failed to find object `" << path << "'" << endl;
+ }
+}
+
+
+void
ClientStore::set_property(const URI& subject_uri, const URI& predicate, const Atom& value)
{
SharedPtr<Resource> subject = resource(subject_uri);
diff --git a/src/client/ClientStore.hpp b/src/client/ClientStore.hpp
index 38df414e..978bc7d5 100644
--- a/src/client/ClientStore.hpp
+++ b/src/client/ClientStore.hpp
@@ -69,6 +69,8 @@ public:
// CommonInterface
bool new_object(const Shared::GraphObject* object);
void put(const Raul::URI& path, const Shared::Resource::Properties& properties);
+ void delta(const Raul::URI& path, const Shared::Resource::Properties& remove,
+ const Shared::Resource::Properties& add);
void move(const Raul::Path& old_path, const Raul::Path& new_path);
void set_property(const Raul::URI& subject_path, const Raul::URI& predicate, const Raul::Atom& value);
void set_voice_value(const Raul::Path& port_path, uint32_t voice, const Raul::Atom& value);
diff --git a/src/client/HTTPEngineSender.cpp b/src/client/HTTPEngineSender.cpp
index 0b544600..d515926b 100644
--- a/src/client/HTTPEngineSender.cpp
+++ b/src/client/HTTPEngineSender.cpp
@@ -135,6 +135,15 @@ HTTPEngineSender::put(const URI& uri,
void
+HTTPEngineSender::delta(const Raul::URI& path,
+ const Shared::Resource::Properties& remove,
+ const Shared::Resource::Properties& add)
+{
+ warn << "FIXME: HTTP DELTA" << endl;
+}
+
+
+void
HTTPEngineSender::move(const Path& old_path,
const Path& new_path)
{
@@ -186,12 +195,6 @@ HTTPEngineSender::set_voice_value(const Path& port_path,
void
-HTTPEngineSender::learn(const Path& path)
-{
-}
-
-
-void
HTTPEngineSender::set_property(const URI& subject,
const URI& predicate,
const Atom& value)
diff --git a/src/client/HTTPEngineSender.hpp b/src/client/HTTPEngineSender.hpp
index dc0a24c7..570ab3e9 100644
--- a/src/client/HTTPEngineSender.hpp
+++ b/src/client/HTTPEngineSender.hpp
@@ -83,6 +83,10 @@ public:
virtual void put(const Raul::URI& path,
const Shared::Resource::Properties& properties);
+ virtual void delta(const Raul::URI& path,
+ const Shared::Resource::Properties& remove,
+ const Shared::Resource::Properties& add);
+
virtual void del(const Raul::Path& path);
virtual void move(const Raul::Path& old_path,
@@ -105,9 +109,6 @@ public:
uint32_t voice,
const Raul::Atom& value);
- virtual void learn(const Raul::Path& path);
-
-
// Requests //
void ping();
void get(const Raul::URI& uri);
diff --git a/src/client/OSCClientReceiver.cpp b/src/client/OSCClientReceiver.cpp
index faccef15..4cf28156 100644
--- a/src/client/OSCClientReceiver.cpp
+++ b/src/client/OSCClientReceiver.cpp
@@ -140,18 +140,17 @@ OSCClientReceiver::unknown_cb(const char* path, const char* types, lo_arg** argv
void
OSCClientReceiver::setup_callbacks()
{
- lo_server_thread_add_method(_st, "/ingen/ok", "i", response_ok_cb, this);
- lo_server_thread_add_method(_st, "/ingen/error", "is", response_error_cb, this);
- lo_server_thread_add_method(_st, "/ingen/plugin", "sss", plugin_cb, this);
- lo_server_thread_add_method(_st, "/ingen/put", NULL, put_cb, this);
- lo_server_thread_add_method(_st, "/ingen/move", "ss", move_cb, this);
- lo_server_thread_add_method(_st, "/ingen/delete", "s", del_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_port", "sisi", new_port_cb, this);
- lo_server_thread_add_method(_st, "/ingen/set_property", NULL, set_property_cb, this);
- lo_server_thread_add_method(_st, "/ingen/set_voice_value", "sif", set_voice_value_cb, this);
- lo_server_thread_add_method(_st, "/ingen/activity", "s", activity_cb, this);
+ lo_server_thread_add_method(_st, "/ok", "i", response_ok_cb, this);
+ lo_server_thread_add_method(_st, "/error", "is", response_error_cb, this);
+ lo_server_thread_add_method(_st, "/plugin", "sss", plugin_cb, this);
+ lo_server_thread_add_method(_st, "/put", NULL, put_cb, this);
+ lo_server_thread_add_method(_st, "/move", "ss", move_cb, this);
+ lo_server_thread_add_method(_st, "/delete", "s", del_cb, this);
+ lo_server_thread_add_method(_st, "/connect", "ss", connection_cb, this);
+ lo_server_thread_add_method(_st, "/disconnect", "ss", disconnection_cb, this);
+ lo_server_thread_add_method(_st, "/set_property", NULL, set_property_cb, this);
+ lo_server_thread_add_method(_st, "/set_voice_value", "sif", set_voice_value_cb, this);
+ lo_server_thread_add_method(_st, "/activity", "s", activity_cb, this);
}
diff --git a/src/client/OSCClientReceiver.hpp b/src/client/OSCClientReceiver.hpp
index 8f191f9c..31082858 100644
--- a/src/client/OSCClientReceiver.hpp
+++ b/src/client/OSCClientReceiver.hpp
@@ -89,7 +89,6 @@ private:
LO_HANDLER(move);
LO_HANDLER(connection);
LO_HANDLER(disconnection);
- LO_HANDLER(new_port);
LO_HANDLER(put);
LO_HANDLER(set_property);
LO_HANDLER(set_voice_value);
diff --git a/src/client/OSCEngineSender.cpp b/src/client/OSCEngineSender.cpp
index 150f8020..30f5cb76 100644
--- a/src/client/OSCEngineSender.cpp
+++ b/src/client/OSCEngineSender.cpp
@@ -89,14 +89,14 @@ OSCEngineSender::attach(int32_t ping_id, bool block)
void
OSCEngineSender::register_client(Shared::ClientInterface* client)
{
- send("/ingen/register_client", "i", next_id(), LO_ARGS_END, LO_ARGS_END);
+ send("/register_client", "i", next_id(), LO_ARGS_END, LO_ARGS_END);
}
void
OSCEngineSender::unregister_client(const URI& uri)
{
- send("/ingen/unregister_client", "i", next_id(), LO_ARGS_END);
+ send("/unregister_client", "i", next_id(), LO_ARGS_END);
}
@@ -104,28 +104,28 @@ OSCEngineSender::unregister_client(const URI& uri)
void
OSCEngineSender::load_plugins()
{
- send("/ingen/load_plugins", "i", next_id(), LO_ARGS_END);
+ send("/load_plugins", "i", next_id(), LO_ARGS_END);
}
void
OSCEngineSender::activate()
{
- send("/ingen/activate", "i", next_id(), LO_ARGS_END);
+ send("/activate", "i", next_id(), LO_ARGS_END);
}
void
OSCEngineSender::deactivate()
{
- send("/ingen/deactivate", "i", next_id(), LO_ARGS_END);
+ send("/deactivate", "i", next_id(), LO_ARGS_END);
}
void
OSCEngineSender::quit()
{
- send("/ingen/quit", "i", next_id(), LO_ARGS_END);
+ send("/quit", "i", next_id(), LO_ARGS_END);
}
@@ -145,7 +145,16 @@ OSCEngineSender::put(const Raul::URI& path,
lo_message_add_string(m, i->first.c_str());
Raul::AtomLiblo::lo_message_add_atom(m, i->second);
}
- send_message("/ingen/put", m);
+ send_message("/put", m);
+}
+
+
+void
+OSCEngineSender::delta(const Raul::URI& path,
+ const Shared::Resource::Properties& remove,
+ const Shared::Resource::Properties& add)
+{
+ warn << "FIXME: OSC DELTA" << endl;
}
@@ -153,7 +162,7 @@ void
OSCEngineSender::move(const Path& old_path,
const Path& new_path)
{
- send("/ingen/move", "iss",
+ send("/move", "iss",
next_id(),
old_path.c_str(),
new_path.c_str(),
@@ -164,7 +173,7 @@ OSCEngineSender::move(const Path& old_path,
void
OSCEngineSender::del(const Path& path)
{
- send("/ingen/delete", "is",
+ send("/delete", "is",
next_id(),
path.c_str(),
LO_ARGS_END);
@@ -175,7 +184,7 @@ void
OSCEngineSender::connect(const Path& src_port_path,
const Path& dst_port_path)
{
- send("/ingen/connect", "iss",
+ send("/connect", "iss",
next_id(),
src_port_path.c_str(),
dst_port_path.c_str(),
@@ -187,7 +196,7 @@ void
OSCEngineSender::disconnect(const Path& src_port_path,
const Path& dst_port_path)
{
- send("/ingen/disconnect", "iss",
+ send("/disconnect", "iss",
next_id(),
src_port_path.c_str(),
dst_port_path.c_str(),
@@ -199,7 +208,7 @@ void
OSCEngineSender::disconnect_all(const Path& parent_patch_path,
const Path& path)
{
- send("/ingen/disconnect_all", "iss",
+ send("/disconnect_all", "iss",
next_id(),
parent_patch_path.c_str(),
path.c_str(),
@@ -219,17 +228,7 @@ OSCEngineSender::set_voice_value(const Path& port_path,
if (value.type() == Atom::BLOB)
lo_message_add_string(m, value.get_blob_type());
Raul::AtomLiblo::lo_message_add_atom(m, value);
- send_message("/ingen/set_port_value", m);
-}
-
-
-void
-OSCEngineSender::learn(const Path& path)
-{
- send("/ingen/learn", "is",
- next_id(),
- path.c_str(),
- LO_ARGS_END);
+ send_message("/set_port_value", m);
}
@@ -243,7 +242,7 @@ OSCEngineSender::set_property(const URI& subject,
lo_message_add_string(m, subject.c_str());
lo_message_add_string(m, predicate.c_str());
Raul::AtomLiblo::lo_message_add_atom(m, value);
- send_message("/ingen/set_property", m);
+ send_message("/set_property", m);
}
@@ -253,14 +252,14 @@ OSCEngineSender::set_property(const URI& subject,
void
OSCEngineSender::ping()
{
- send("/ingen/ping", "i", next_id(), LO_ARGS_END);
+ send("/ping", "i", next_id(), LO_ARGS_END);
}
void
OSCEngineSender::get(const URI& uri)
{
- send("/ingen/get", "is",
+ send("/get", "is",
next_id(),
uri.c_str(),
LO_ARGS_END);
@@ -270,7 +269,7 @@ OSCEngineSender::get(const URI& uri)
void
OSCEngineSender::request_property(const URI& object_path, const URI& key)
{
- send("/ingen/request_property", "iss",
+ send("/request_property", "iss",
next_id(),
object_path.c_str(),
key.c_str(),
@@ -281,14 +280,14 @@ OSCEngineSender::request_property(const URI& object_path, const URI& key)
void
OSCEngineSender::request_plugins()
{
- send("/ingen/request_plugins", "i", next_id(), LO_ARGS_END);
+ send("/request_plugins", "i", next_id(), LO_ARGS_END);
}
void
OSCEngineSender::request_all_objects()
{
- send("/ingen/request_all_objects", "i", next_id(), LO_ARGS_END);
+ send("/request_all_objects", "i", next_id(), LO_ARGS_END);
}
diff --git a/src/client/OSCEngineSender.hpp b/src/client/OSCEngineSender.hpp
index e3d76b01..916d1466 100644
--- a/src/client/OSCEngineSender.hpp
+++ b/src/client/OSCEngineSender.hpp
@@ -80,6 +80,10 @@ public:
virtual void put(const Raul::URI& path,
const Shared::Resource::Properties& properties);
+ virtual void delta(const Raul::URI& path,
+ const Shared::Resource::Properties& remove,
+ const Shared::Resource::Properties& add);
+
virtual void del(const Raul::Path& path);
virtual void move(const Raul::Path& old_path,
@@ -102,9 +106,6 @@ public:
uint32_t voice,
const Raul::Atom& value);
- virtual void learn(const Raul::Path& path);
-
-
// Requests //
void ping();
void get(const Raul::URI& uri);
diff --git a/src/client/SigClientInterface.hpp b/src/client/SigClientInterface.hpp
index bc2ee3f9..3334c5c7 100644
--- a/src/client/SigClientInterface.hpp
+++ b/src/client/SigClientInterface.hpp
@@ -51,6 +51,8 @@ public:
sigc::signal<void, Raul::Path, uint32_t> signal_new_patch;
sigc::signal<void, Raul::Path, Raul::URI, uint32_t, bool> signal_new_port;
sigc::signal<void, Raul::URI, Shared::Resource::Properties> signal_put;
+ sigc::signal<void, Raul::URI, Shared::Resource::Properties,
+ Shared::Resource::Properties> signal_delta;
sigc::signal<void, Raul::Path, Raul::Path> signal_object_moved;
sigc::signal<void, Raul::Path> signal_object_deleted;
sigc::signal<void, Raul::Path, Raul::Path> signal_connection;
@@ -88,8 +90,12 @@ protected:
void error(const std::string& msg)
{ EMIT(error, msg); }
- void put(const Raul::URI& path, const Shared::Resource::Properties& properties)
- { EMIT(put, path, properties); }
+ void put(const Raul::URI& uri, const Shared::Resource::Properties& properties)
+ { EMIT(put, uri, properties); }
+
+ void delta(const Raul::URI& uri,
+ const Shared::Resource::Properties& remove, const Shared::Resource::Properties& add)
+ { EMIT(delta, uri, remove, add); }
void connect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path)
{ EMIT(connection, src_port_path, dst_port_path); }
diff --git a/src/client/ThreadedSigClientInterface.hpp b/src/client/ThreadedSigClientInterface.hpp
index 128f6d86..bb86d65a 100644
--- a/src/client/ThreadedSigClientInterface.hpp
+++ b/src/client/ThreadedSigClientInterface.hpp
@@ -86,6 +86,10 @@ public:
void put(const Raul::URI& path, const Shared::Resource::Properties& properties)
{ push_sig(sigc::bind(put_slot, path, properties)); }
+ void delta(const Raul::URI& path,
+ const Shared::Resource::Properties& remove, const Shared::Resource::Properties& add)
+ { push_sig(sigc::bind(delta_slot, path, remove, add)); }
+
void connect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path)
{ push_sig(sigc::bind(connection_slot, src_port_path, dst_port_path)); }
@@ -127,6 +131,8 @@ private:
sigc::slot<void, Raul::URI, Raul::URI, Raul::Symbol> new_plugin_slot;
sigc::slot<void, Raul::Path, Raul::URI, uint32_t, bool> new_port_slot;
sigc::slot<void, Raul::URI, Shared::Resource::Properties> put_slot;
+ sigc::slot<void, Raul::URI, Shared::Resource::Properties,
+ Shared::Resource::Properties> delta_slot;
sigc::slot<void, Raul::Path, Raul::Path> connection_slot;
sigc::slot<void, Raul::Path> object_deleted_slot;
sigc::slot<void, Raul::Path, Raul::Path> object_moved_slot;