summaryrefslogtreecommitdiffstats
path: root/ingen/client
diff options
context:
space:
mode:
Diffstat (limited to 'ingen/client')
-rw-r--r--ingen/client/ClientStore.hpp56
-rw-r--r--ingen/client/SigClientInterface.hpp73
-rw-r--r--ingen/client/ThreadedSigClientInterface.hpp81
3 files changed, 29 insertions, 181 deletions
diff --git a/ingen/client/ClientStore.hpp b/ingen/client/ClientStore.hpp
index 1887bed3..899273dc 100644
--- a/ingen/client/ClientStore.hpp
+++ b/ingen/client/ClientStore.hpp
@@ -73,43 +73,26 @@ public:
URIs& uris() { return _uris; }
- void put(const Raul::URI& uri,
- const Properties& properties,
- Resource::Graph ctx = Resource::Graph::DEFAULT);
+ void message(const Message& msg) override;
+
+ void operator()(const BundleBegin&) {}
+ void operator()(const BundleEnd&) {}
+ void operator()(const Connect&);
+ void operator()(const Copy&);
+ void operator()(const Del&);
+ void operator()(const Delta&);
+ void operator()(const Disconnect&);
+ void operator()(const DisconnectAll&);
+ void operator()(const Error&) {}
+ void operator()(const Get&) {}
+ void operator()(const Move&);
+ void operator()(const Put&);
+ void operator()(const Redo&) {}
+ void operator()(const Response&) {}
+ void operator()(const SetProperty&);
+ void operator()(const Undo&) {}
- void delta(const Raul::URI& uri,
- const Properties& remove,
- const Properties& add,
- Resource::Graph ctx = Resource::Graph::DEFAULT);
-
- void copy(const Raul::URI& old_uri,
- const Raul::URI& new_uri);
-
- 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 Atom& value,
- Resource::Graph ctx = Resource::Graph::DEFAULT);
-
- void connect(const Raul::Path& tail,
- const Raul::Path& head);
-
- void disconnect(const Raul::Path& tail,
- const Raul::Path& head);
-
- void disconnect_all(const Raul::Path& graph,
- const Raul::Path& path);
-
- void del(const Raul::URI& uri);
-
- void undo() {}
- void redo() {}
void set_response_id(int32_t id) {}
- void get(const Raul::URI& uri) {}
- void response(int32_t id, Status status, const std::string& subject) {}
- void error(const std::string& msg) {}
INGEN_SIGNAL(new_object, void, SPtr<ObjectModel>);
INGEN_SIGNAL(new_plugin, void, SPtr<PluginModel>);
@@ -129,9 +112,6 @@ private:
SPtr<GraphModel> connection_graph(const Raul::Path& tail_path,
const Raul::Path& head_path);
- void bundle_begin() {}
- void bundle_end() {}
-
// Slots for SigClientInterface signals
bool attempt_connection(const Raul::Path& tail_path,
const Raul::Path& head_path);
diff --git a/ingen/client/SigClientInterface.hpp b/ingen/client/SigClientInterface.hpp
index 7e903fab..2934e8b1 100644
--- a/ingen/client/SigClientInterface.hpp
+++ b/ingen/client/SigClientInterface.hpp
@@ -48,80 +48,17 @@ public:
Raul::URI uri() const { return Raul::URI("ingen:/clients/sig"); }
- INGEN_SIGNAL(response, void, int32_t, Status, std::string)
- INGEN_SIGNAL(bundle_begin, void)
- INGEN_SIGNAL(bundle_end, void)
- INGEN_SIGNAL(error, void, std::string)
- INGEN_SIGNAL(put, void, Raul::URI, Properties, Resource::Graph)
- INGEN_SIGNAL(delta, void, Raul::URI, Properties, Properties, Resource::Graph)
- INGEN_SIGNAL(object_copied, void, Raul::URI, Raul::URI)
- INGEN_SIGNAL(object_moved, void, Raul::Path, Raul::Path)
- INGEN_SIGNAL(object_deleted, void, Raul::URI)
- INGEN_SIGNAL(connection, void, Raul::Path, Raul::Path)
- INGEN_SIGNAL(disconnection, void, Raul::Path, Raul::Path)
- INGEN_SIGNAL(disconnect_all, void, Raul::Path, Raul::Path)
- INGEN_SIGNAL(property_change, void, Raul::URI, Raul::URI, Atom, Resource::Graph)
+ INGEN_SIGNAL(message, void, Message)
/** Fire pending signals. Only does anything on derived classes (that may queue) */
virtual bool emit_signals() { return false; }
protected:
-
- // ClientInterface hooks that fire the above signals
-
-#define EMIT(name, ...) { _signal_ ## name (__VA_ARGS__); }
-
- void bundle_begin()
- { EMIT(bundle_begin); }
-
- void bundle_end()
- { EMIT(bundle_end); }
-
- void response(int32_t id, Status status, const std::string& subject)
- { EMIT(response, id, status, subject); }
-
- void error(const std::string& msg)
- { EMIT(error, msg); }
-
- void put(const Raul::URI& uri,
- const Properties& properties,
- Resource::Graph ctx = Resource::Graph::DEFAULT)
- { EMIT(put, uri, properties, ctx); }
-
- void delta(const Raul::URI& uri,
- const Properties& remove,
- const Properties& add,
- Resource::Graph ctx = Resource::Graph::DEFAULT)
- { EMIT(delta, uri, remove, add, ctx); }
-
- void connect(const Raul::Path& tail, const Raul::Path& head)
- { EMIT(connection, tail, head); }
-
- void del(const Raul::URI& uri)
- { EMIT(object_deleted, uri); }
-
- void copy(const Raul::URI& old_uri, const Raul::URI& new_uri)
- { EMIT(object_copied, old_uri, new_uri); }
-
- void move(const Raul::Path& old_path, const Raul::Path& new_path)
- { EMIT(object_moved, old_path, new_path); }
-
- void disconnect(const Raul::Path& tail, const Raul::Path& head)
- { EMIT(disconnection, tail, head); }
-
- void disconnect_all(const Raul::Path& graph, const Raul::Path& path)
- { EMIT(disconnect_all, graph, path); }
-
- void set_property(const Raul::URI& subject,
- const Raul::URI& key,
- const Atom& value,
- Resource::Graph ctx = Resource::Graph::DEFAULT)
- { EMIT(property_change, subject, key, value, ctx); }
-
- void undo() {}
- void redo() {}
void set_response_id(int32_t id) {}
- void get(const Raul::URI& uri) {}
+
+ void message(const Message& msg) override {
+ _signal_message(msg);
+ }
};
} // namespace Client
diff --git a/ingen/client/ThreadedSigClientInterface.hpp b/ingen/client/ThreadedSigClientInterface.hpp
index 96c47374..8fa36c90 100644
--- a/ingen/client/ThreadedSigClientInterface.hpp
+++ b/ingen/client/ThreadedSigClientInterface.hpp
@@ -52,66 +52,15 @@ class INGEN_API ThreadedSigClientInterface : public SigClientInterface
{
public:
ThreadedSigClientInterface()
- : response_slot(_signal_response.make_slot())
- , error_slot(_signal_error.make_slot())
- , put_slot(_signal_put.make_slot())
- , connection_slot(_signal_connection.make_slot())
- , object_deleted_slot(_signal_object_deleted.make_slot())
- , object_moved_slot(_signal_object_moved.make_slot())
- , object_copied_slot(_signal_object_copied.make_slot())
- , disconnection_slot(_signal_disconnection.make_slot())
- , disconnect_all_slot(_signal_disconnect_all.make_slot())
- , property_change_slot(_signal_property_change.make_slot())
+ : message_slot(_signal_message.make_slot())
{}
virtual Raul::URI uri() const { return Raul::URI("ingen:/clients/sig_queue"); }
- void bundle_begin()
- { push_sig(bundle_begin_slot); }
-
- void bundle_end()
- { push_sig(bundle_end_slot); }
-
- void response(int32_t id, Status status, const std::string& subject)
- { push_sig(sigc::bind(response_slot, id, status, subject)); }
-
- void error(const std::string& msg)
- { push_sig(sigc::bind(error_slot, msg)); }
-
- void put(const Raul::URI& path,
- const Properties& properties,
- Resource::Graph ctx = Resource::Graph::DEFAULT)
- { push_sig(sigc::bind(put_slot, path, properties, ctx)); }
-
- void delta(const Raul::URI& path,
- const Properties& remove,
- const Properties& add,
- Resource::Graph ctx = Resource::Graph::DEFAULT)
- { push_sig(sigc::bind(delta_slot, path, remove, add, ctx)); }
-
- void connect(const Raul::Path& tail, const Raul::Path& head)
- { push_sig(sigc::bind(connection_slot, tail, head)); }
-
- void del(const Raul::URI& uri)
- { push_sig(sigc::bind(object_deleted_slot, uri)); }
-
- void move(const Raul::Path& old_path, const Raul::Path& new_path)
- { push_sig(sigc::bind(object_moved_slot, old_path, new_path)); }
-
- void copy(const Raul::URI& old_uri, const Raul::URI& new_uri)
- { push_sig(sigc::bind(object_copied_slot, old_uri, new_uri)); }
-
- void disconnect(const Raul::Path& tail, const Raul::Path& head)
- { push_sig(sigc::bind(disconnection_slot, tail, head)); }
-
- void disconnect_all(const Raul::Path& graph, const Raul::Path& path)
- { push_sig(sigc::bind(disconnect_all_slot, graph, path)); }
-
- void set_property(const Raul::URI& subject,
- const Raul::URI& key,
- const Atom& value,
- Resource::Graph ctx = Resource::Graph::DEFAULT)
- { push_sig(sigc::bind(property_change_slot, subject, key, value, ctx)); }
+ void message(const Message& msg) override {
+ std::lock_guard<std::mutex> lock(_mutex);
+ _sigs.push_back(sigc::bind(message_slot, msg));
+ }
/** Process all queued events - Called from GTK thread to emit signals. */
bool emit_signals() {
@@ -131,11 +80,6 @@ public:
}
private:
- void push_sig(Closure ev) {
- std::lock_guard<std::mutex> lock(_mutex);
- _sigs.push_back(ev);
- }
-
std::mutex _mutex;
std::vector<Closure> _sigs;
@@ -143,20 +87,7 @@ private:
using Path = Raul::Path;
using URI = Raul::URI;
- sigc::slot<void> bundle_begin_slot;
- sigc::slot<void> bundle_end_slot;
- sigc::slot<void, int32_t, Status, std::string> response_slot;
- sigc::slot<void, std::string> error_slot;
- sigc::slot<void, URI, URI, Raul::Symbol> new_plugin_slot;
- sigc::slot<void, URI, Properties, Graph> put_slot;
- sigc::slot<void, URI, Properties, Properties, Graph> delta_slot;
- sigc::slot<void, Path, Path> connection_slot;
- sigc::slot<void, URI> object_deleted_slot;
- sigc::slot<void, Path, Path> object_moved_slot;
- sigc::slot<void, URI, URI> object_copied_slot;
- sigc::slot<void, Path, Path> disconnection_slot;
- sigc::slot<void, Path, Path> disconnect_all_slot;
- sigc::slot<void, URI, URI, Atom, Graph> property_change_slot;
+ sigc::slot<void, Message> message_slot;
};
} // namespace Client