summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/ClientStore.cpp37
-rw-r--r--src/client/ClientStore.hpp9
-rw-r--r--src/client/HTTPEngineSender.cpp4
-rw-r--r--src/client/HTTPEngineSender.hpp4
-rw-r--r--src/client/OSCEngineSender.cpp4
-rw-r--r--src/client/OSCEngineSender.hpp4
-rw-r--r--src/client/SigClientInterface.hpp8
-rw-r--r--src/client/ThreadedSigClientInterface.hpp8
8 files changed, 46 insertions, 32 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index f120e7ed..21ace7de 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -185,6 +185,15 @@ ClientStore::object(const Path& path)
}
}
+SharedPtr<Resource>
+ClientStore::resource(const URI& uri)
+{
+ if (uri.scheme() == Path::scheme && Path::is_valid(uri.str()))
+ return object(uri.str());
+ else
+ return plugin(uri);
+}
+
void
ClientStore::add_plugin(SharedPtr<PluginModel> pm)
{
@@ -353,14 +362,18 @@ ClientStore::clear_patch(const Path& path)
void
-ClientStore::set_variable(const Path& subject_path, const URI& predicate, const Atom& value)
+ClientStore::set_variable(const URI& subject_path, const URI& predicate, const Atom& value)
{
- SharedPtr<ObjectModel> subject = object(subject_path);
+ SharedPtr<Resource> subject = resource(subject_path);
if (!value.is_valid()) {
- cerr << "ERROR: variable '" << predicate << "' has no type" << endl;
+ cerr << "ERROR: variable '" << predicate << "' is invalid" << endl;
} else if (subject) {
- subject->set_variable(predicate, value);
+ SharedPtr<ObjectModel> om = PtrCast<ObjectModel>(subject);
+ if (om)
+ om->set_variable(predicate, value);
+ else
+ subject->set_property(predicate, value);
} else {
//add_variable_orphan(subject_path, predicate, value);
cerr << "WARNING: variable '" << predicate << "' for unknown object " << subject_path << endl;
@@ -369,16 +382,16 @@ ClientStore::set_variable(const Path& subject_path, const URI& predicate, const
void
-ClientStore::set_property(const Path& subject_path, const URI& predicate, const Atom& value)
+ClientStore::set_property(const URI& subject_path, const URI& predicate, const Atom& value)
{
- if (!value.is_valid())
- cerr << "WARNING: property '" << predicate << "' is NULL" << endl;
-
- SharedPtr<ObjectModel> obj = object(subject_path);
- if (obj)
- obj->set_property(predicate, value);
- else
+ SharedPtr<Resource> subject = resource(subject_path);
+ if (!value.is_valid()) {
+ cerr << "ERROR: property '" << predicate << "' is invalid" << endl;
+ } else if (subject) {
+ subject->set_property(predicate, value);
+ } else {
cerr << "WARNING: property '" << predicate << "' for unknown object " << subject_path << endl;
+ }
}
diff --git a/src/client/ClientStore.hpp b/src/client/ClientStore.hpp
index 9fb95b0b..b8451fd2 100644
--- a/src/client/ClientStore.hpp
+++ b/src/client/ClientStore.hpp
@@ -55,8 +55,9 @@ public:
ClientStore(SharedPtr<Shared::EngineInterface> engine=SharedPtr<Shared::EngineInterface>(),
SharedPtr<SigClientInterface> emitter=SharedPtr<SigClientInterface>());
- SharedPtr<PluginModel> plugin(const Raul::URI& uri);
- SharedPtr<ObjectModel> object(const Raul::Path& path);
+ SharedPtr<PluginModel> plugin(const Raul::URI& uri);
+ SharedPtr<ObjectModel> object(const Raul::Path& path);
+ SharedPtr<Shared::Resource> resource(const Raul::URI& uri);
void clear();
@@ -72,8 +73,8 @@ public:
void new_node(const Raul::Path& path, const Raul::URI& plugin_uri);
void new_port(const Raul::Path& path, const Raul::URI& type, uint32_t index, bool is_output);
void rename(const Raul::Path& old_path, const Raul::Path& new_path);
- void set_variable(const Raul::Path& subject_path, const Raul::URI& predicate, const Raul::Atom& value);
- void set_property(const Raul::Path& subject_path, const Raul::URI& predicate, const Raul::Atom& value);
+ void set_variable(const Raul::URI& subject_path, const Raul::URI& predicate, const Raul::Atom& value);
+ void set_property(const Raul::URI& subject_path, const Raul::URI& predicate, const Raul::Atom& value);
void set_port_value(const Raul::Path& port_path, const Raul::Atom& value);
void set_voice_value(const Raul::Path& port_path, uint32_t voice, const Raul::Atom& value);
void connect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path);
diff --git a/src/client/HTTPEngineSender.cpp b/src/client/HTTPEngineSender.cpp
index 2afa32f1..a03bc26a 100644
--- a/src/client/HTTPEngineSender.cpp
+++ b/src/client/HTTPEngineSender.cpp
@@ -209,7 +209,7 @@ HTTPEngineSender::midi_learn(const Path& node_path)
void
-HTTPEngineSender::set_variable(const Path& path,
+HTTPEngineSender::set_variable(const URI& path,
const URI& predicate,
const Atom& value)
{
@@ -217,7 +217,7 @@ HTTPEngineSender::set_variable(const Path& path,
void
-HTTPEngineSender::set_property(const Path& path,
+HTTPEngineSender::set_property(const URI& path,
const URI& predicate,
const Atom& value)
{
diff --git a/src/client/HTTPEngineSender.hpp b/src/client/HTTPEngineSender.hpp
index ffe60577..7436040b 100644
--- a/src/client/HTTPEngineSender.hpp
+++ b/src/client/HTTPEngineSender.hpp
@@ -103,11 +103,11 @@ public:
virtual void disconnect_all(const Raul::Path& parent_patch_path,
const Raul::Path& path);
- virtual void set_variable(const Raul::Path& subject_path,
+ virtual void set_variable(const Raul::URI& subject_path,
const Raul::URI& predicate,
const Raul::Atom& value);
- virtual void set_property(const Raul::Path& subject_path,
+ virtual void set_property(const Raul::URI& subject_path,
const Raul::URI& predicate,
const Raul::Atom& value);
diff --git a/src/client/OSCEngineSender.cpp b/src/client/OSCEngineSender.cpp
index 45e7f82e..153f8dee 100644
--- a/src/client/OSCEngineSender.cpp
+++ b/src/client/OSCEngineSender.cpp
@@ -322,7 +322,7 @@ OSCEngineSender::midi_learn(const Path& node_path)
void
-OSCEngineSender::set_variable(const Path& obj_path,
+OSCEngineSender::set_variable(const URI& obj_path,
const URI& predicate,
const Atom& value)
{
@@ -336,7 +336,7 @@ OSCEngineSender::set_variable(const Path& obj_path,
void
-OSCEngineSender::set_property(const Path& obj_path,
+OSCEngineSender::set_property(const URI& obj_path,
const URI& predicate,
const Atom& value)
{
diff --git a/src/client/OSCEngineSender.hpp b/src/client/OSCEngineSender.hpp
index 0010a488..ffd8d678 100644
--- a/src/client/OSCEngineSender.hpp
+++ b/src/client/OSCEngineSender.hpp
@@ -106,11 +106,11 @@ public:
virtual void disconnect_all(const Raul::Path& parent_patch_path,
const Raul::Path& path);
- virtual void set_variable(const Raul::Path& subject_path,
+ virtual void set_variable(const Raul::URI& subject_path,
const Raul::URI& predicate,
const Raul::Atom& value);
- virtual void set_property(const Raul::Path& subject_path,
+ virtual void set_property(const Raul::URI& subject_path,
const Raul::URI& predicate,
const Raul::Atom& value);
diff --git a/src/client/SigClientInterface.hpp b/src/client/SigClientInterface.hpp
index 40b30e47..ee20797a 100644
--- a/src/client/SigClientInterface.hpp
+++ b/src/client/SigClientInterface.hpp
@@ -62,8 +62,8 @@ public:
sigc::signal<void, Raul::Path> signal_object_destroyed;
sigc::signal<void, Raul::Path, Raul::Path> signal_connection;
sigc::signal<void, Raul::Path, Raul::Path> signal_disconnection;
- sigc::signal<void, Raul::Path, Raul::URI, Raul::Atom> signal_variable_change;
- sigc::signal<void, Raul::Path, Raul::URI, Raul::Atom> signal_property_change;
+ sigc::signal<void, Raul::URI, Raul::URI, Raul::Atom> signal_variable_change;
+ sigc::signal<void, Raul::URI, Raul::URI, Raul::Atom> signal_property_change;
sigc::signal<void, Raul::Path, Raul::Atom> signal_port_value;
sigc::signal<void, Raul::Path, uint32_t, Raul::Atom> signal_voice_value;
sigc::signal<void, Raul::Path> signal_activity;
@@ -130,10 +130,10 @@ protected:
void disconnect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path)
{ if (_enabled) signal_disconnection.emit(src_port_path, dst_port_path); }
- void set_variable(const Raul::Path& path, const Raul::URI& key, const Raul::Atom& value)
+ void set_variable(const Raul::URI& path, const Raul::URI& key, const Raul::Atom& value)
{ if (_enabled) signal_variable_change.emit(path, key, value); }
- void set_property(const Raul::Path& path, const Raul::URI& key, const Raul::Atom& value)
+ void set_property(const Raul::URI& path, const Raul::URI& key, const Raul::Atom& value)
{ if (_enabled) signal_property_change.emit(path, key, value); }
void set_port_value(const Raul::Path& port_path, const Raul::Atom& value)
diff --git a/src/client/ThreadedSigClientInterface.hpp b/src/client/ThreadedSigClientInterface.hpp
index 714465c8..0862bdee 100644
--- a/src/client/ThreadedSigClientInterface.hpp
+++ b/src/client/ThreadedSigClientInterface.hpp
@@ -121,10 +121,10 @@ public:
void disconnect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path)
{ push_sig(sigc::bind(disconnection_slot, src_port_path, dst_port_path)); }
- void set_variable(const Raul::Path& path, const Raul::URI& key, const Raul::Atom& value)
+ void set_variable(const Raul::URI& path, const Raul::URI& key, const Raul::Atom& value)
{ push_sig(sigc::bind(variable_change_slot, path, key, value)); }
- void set_property(const Raul::Path& path, const Raul::URI& key, const Raul::Atom& value)
+ void set_property(const Raul::URI& path, const Raul::URI& key, const Raul::Atom& value)
{ push_sig(sigc::bind(property_change_slot, path, key, value)); }
void set_port_value(const Raul::Path& port_path, const Raul::Atom& value)
@@ -168,8 +168,8 @@ private:
sigc::slot<void, Raul::Path> object_destroyed_slot;
sigc::slot<void, Raul::Path, Raul::Path> object_renamed_slot;
sigc::slot<void, Raul::Path, Raul::Path> disconnection_slot;
- sigc::slot<void, Raul::Path, Raul::URI, Raul::Atom> variable_change_slot;
- sigc::slot<void, Raul::Path, Raul::URI, Raul::Atom> property_change_slot;
+ sigc::slot<void, Raul::URI, Raul::URI, Raul::Atom> variable_change_slot;
+ sigc::slot<void, Raul::URI, Raul::URI, Raul::Atom> property_change_slot;
sigc::slot<void, Raul::Path, Raul::Atom> port_value_slot;
sigc::slot<void, Raul::Path, uint32_t, Raul::Atom> voice_value_slot;
sigc::slot<void, Raul::Path> activity_slot;