summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/interface/ClientInterface.h84
-rw-r--r--src/common/interface/ClientKey.h9
-rw-r--r--src/common/interface/EngineInterface.h4
-rw-r--r--src/common/util/CountedPtr.h6
-rw-r--r--src/common/util/Queue.h2
5 files changed, 60 insertions, 45 deletions
diff --git a/src/common/interface/ClientInterface.h b/src/common/interface/ClientInterface.h
index dcc709d6..071b854e 100644
--- a/src/common/interface/ClientInterface.h
+++ b/src/common/interface/ClientInterface.h
@@ -35,63 +35,75 @@ public:
virtual ~ClientInterface() {}
- virtual void response(int32_t id, bool success, const string& msg) = 0;
+ virtual void response(int32_t id, bool success, string msg) = 0;
+ /** Bundles are a group of messages that are guaranteed to be in an
+ * atomic unit with guaranteed order (eg a packet). For datagram
+ * protocols (like UDP) there is likely an upper limit on bundle size.
+ */
virtual void bundle_begin() = 0;
virtual void bundle_end() = 0;
- virtual void error(const string& msg) = 0;
+ /** Transfers are 'weak' bundles. These are used to break a large group
+ * of similar/related messages into larger chunks (solely for communication
+ * efficiency). A bunch of messages in a transfer will arrive as 1 or more
+ * bundles (so a transfer can exceep the maximum bundle (packet) size).
+ */
+ virtual void transfer_begin() = 0;
+ virtual void transfer_end() = 0;
+
+ virtual void error(string msg) = 0;
virtual void num_plugins(uint32_t num_plugins) = 0;
- virtual void new_plugin(const string& type,
- const string& uri,
- const string& name) = 0;
+ virtual void new_plugin(string type,
+ string uri,
+ string name) = 0;
- virtual void new_patch(const string& path, uint32_t poly) = 0;
+ virtual void new_patch(string path, uint32_t poly) = 0;
- virtual void new_node(const string& plugin_type,
- const string& plugin_uri,
- const string& node_path,
- bool is_polyphonic,
- uint32_t num_ports) = 0;
+ virtual void new_node(string plugin_type,
+ string plugin_uri,
+ string node_path,
+ bool is_polyphonic,
+ uint32_t num_ports) = 0;
- virtual void new_port(const string& path,
- const string& data_type,
- bool is_output) = 0;
+ virtual void new_port(string path,
+ string data_type,
+ bool is_output) = 0;
- virtual void patch_enabled(const string& path) = 0;
+ virtual void patch_enabled(string path) = 0;
- virtual void patch_disabled(const string& path) = 0;
+ virtual void patch_disabled(string path) = 0;
- virtual void patch_cleared(const string& path) = 0;
+ virtual void patch_cleared(string path) = 0;
- virtual void object_renamed(const string& old_path,
- const string& new_path) = 0;
+ virtual void object_renamed(string old_path,
+ string new_path) = 0;
- virtual void object_destroyed(const string& path) = 0;
+ virtual void object_destroyed(string path) = 0;
- virtual void connection(const string& src_port_path,
- const string& dst_port_path) = 0;
+ virtual void connection(string src_port_path,
+ string dst_port_path) = 0;
- virtual void disconnection(const string& src_port_path,
- const string& dst_port_path) = 0;
+ virtual void disconnection(string src_port_path,
+ string dst_port_path) = 0;
- virtual void metadata_update(const string& subject_path,
- const string& predicate,
- const string& value) = 0;
+ virtual void metadata_update(string subject_path,
+ string predicate,
+ string value) = 0;
- virtual void control_change(const string& port_path,
- float value) = 0;
+ virtual void control_change(string port_path,
+ float value) = 0;
- virtual void program_add(const string& node_path,
- uint32_t bank,
- uint32_t program,
- const string& program_name) = 0;
+ virtual void program_add(string node_path,
+ uint32_t bank,
+ uint32_t program,
+ string program_name) = 0;
- virtual void program_remove(const string& node_path,
- uint32_t bank,
- uint32_t program) = 0;
+ virtual void program_remove(string node_path,
+ uint32_t bank,
+ uint32_t program) = 0;
protected:
ClientInterface() {}
diff --git a/src/common/interface/ClientKey.h b/src/common/interface/ClientKey.h
index d53a4870..ba37ba59 100644
--- a/src/common/interface/ClientKey.h
+++ b/src/common/interface/ClientKey.h
@@ -42,9 +42,10 @@ public:
* full incoming URL.
*/
enum Type {
- NIL, ///< A NULL key (represents no client)
- OSC_URL, ///< An OSC URL (remote host/client)
- OSC_PORT ///< A local OSC port
+ NIL, ///< A NULL key (represents no client)
+ OSC_URL, ///< An OSC URL (remote host/client)
+ OSC_PORT, ///< A local OSC port
+ DIRECT ///< A direct in-process function call client
};
ClientKey()
@@ -53,7 +54,7 @@ public:
{}
ClientKey(Type type, const std::string& uri)
- : _type(OSC_URL)
+ : _type(type)
, _uri(uri)
{}
diff --git a/src/common/interface/EngineInterface.h b/src/common/interface/EngineInterface.h
index 7dc996dc..04d143b1 100644
--- a/src/common/interface/EngineInterface.h
+++ b/src/common/interface/EngineInterface.h
@@ -39,6 +39,10 @@ class EngineInterface
public:
virtual ~EngineInterface() {}
+ // Responses
+ virtual void set_next_response_id(int32_t id) = 0;
+ virtual void disable_responses() = 0;
+
// Client registration
virtual void register_client(ClientKey key, CountedPtr<ClientInterface> client) = 0;
virtual void unregister_client(ClientKey key) = 0;
diff --git a/src/common/util/CountedPtr.h b/src/common/util/CountedPtr.h
index 16eb0eee..c5eb2e50 100644
--- a/src/common/util/CountedPtr.h
+++ b/src/common/util/CountedPtr.h
@@ -87,13 +87,9 @@ public:
// Fail if this is not a valid cast
if (y) {
-#ifdef WITH_RTTI
T* const casted_y = dynamic_cast<T* const>(y._counter->ptr);
-#else
- T* const casted_y = static_cast<T* const>(y._counter->ptr);
-#endif
+
if (casted_y) {
- assert(casted_y == y._counter->ptr);
//release(); // FIXME: leak?
retain((Counter*)y._counter);
assert(_counter == (Counter*)y._counter);
diff --git a/src/common/util/Queue.h b/src/common/util/Queue.h
index 10c7f0f5..a4c34222 100644
--- a/src/common/util/Queue.h
+++ b/src/common/util/Queue.h
@@ -66,6 +66,7 @@ Queue<T>::Queue(size_t size)
m_size(size+1),
m_objects((T*)calloc(m_size, sizeof(T)))
{
+ assert(size > 1);
}
@@ -147,6 +148,7 @@ inline T&
Queue<T>::pop()
{
assert(!is_empty());
+ assert(m_size > 0);
T& r = m_objects[m_front];
m_front = (m_front + 1) % (m_size);