summaryrefslogtreecommitdiffstats
path: root/src/common/interface
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-06-09 15:07:31 +0000
committerDavid Robillard <d@drobilla.net>2006-06-09 15:07:31 +0000
commitacbda29f838280ba98cf9e9e539e9d8a6e8fc6ad (patch)
treee31b37a2456e6d1e564c9a7146c88be259d338b0 /src/common/interface
downloadingen-acbda29f838280ba98cf9e9e539e9d8a6e8fc6ad.tar.gz
ingen-acbda29f838280ba98cf9e9e539e9d8a6e8fc6ad.tar.bz2
ingen-acbda29f838280ba98cf9e9e539e9d8a6e8fc6ad.zip
Added Om aka Graph aka god knows what
git-svn-id: http://svn.drobilla.net/lad/grauph@9 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/common/interface')
-rw-r--r--src/common/interface/.ClientInterface.h.swpbin0 -> 12288 bytes
-rw-r--r--src/common/interface/ClientInterface.h102
-rw-r--r--src/common/interface/ClientKey.h84
-rw-r--r--src/common/interface/EngineInterface.h121
-rw-r--r--src/common/interface/Makefile.am5
-rw-r--r--src/common/interface/README13
6 files changed, 325 insertions, 0 deletions
diff --git a/src/common/interface/.ClientInterface.h.swp b/src/common/interface/.ClientInterface.h.swp
new file mode 100644
index 00000000..f0127868
--- /dev/null
+++ b/src/common/interface/.ClientInterface.h.swp
Binary files differ
diff --git a/src/common/interface/ClientInterface.h b/src/common/interface/ClientInterface.h
new file mode 100644
index 00000000..d03f1668
--- /dev/null
+++ b/src/common/interface/ClientInterface.h
@@ -0,0 +1,102 @@
+/* This file is part of Om. Copyright (C) 2006 Dave Robillard.
+ *
+ * Om is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Om is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef CLIENTINTERFACE_H
+#define CLIENTINTERFACE_H
+
+#include <inttypes.h>
+#include <string>
+using std::string;
+
+namespace Om {
+namespace Shared {
+
+
+/** The (only) interface the engine uses to communicate with clients.
+ *
+ * Purely virtual (except for the destructor).
+ */
+class ClientInterface
+{
+public:
+
+ virtual ~ClientInterface() {}
+
+ virtual void bundle_begin() = 0;
+ virtual void bundle_end() = 0;
+
+ virtual void error(const 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_patch(const 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_port(const string& path,
+ const string& data_type,
+ bool is_output) = 0;
+
+ virtual void patch_enabled(const string& path) = 0;
+
+ virtual void patch_disabled(const string& path) = 0;
+
+ virtual void patch_cleared(const string& path) = 0;
+
+ virtual void object_renamed(const string& old_path,
+ const string& new_path) = 0;
+
+ virtual void object_destroyed(const string& path) = 0;
+
+ virtual void connection(const string& src_port_path,
+ const string& dst_port_path) = 0;
+
+ virtual void disconnection(const string& src_port_path,
+ const string& dst_port_path) = 0;
+
+ virtual void metadata_update(const string& subject_path,
+ const string& predicate,
+ const string& value) = 0;
+
+ virtual void control_change(const 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_remove(const string& node_path,
+ uint32_t bank,
+ uint32_t program) = 0;
+
+protected:
+ ClientInterface() {}
+};
+
+
+} // namespace Shared
+} // namespace Om
+
+#endif
diff --git a/src/common/interface/ClientKey.h b/src/common/interface/ClientKey.h
new file mode 100644
index 00000000..eb580a2d
--- /dev/null
+++ b/src/common/interface/ClientKey.h
@@ -0,0 +1,84 @@
+/* This file is part of Om. Copyright (C) 2006 Dave Robillard.
+ *
+ * Om is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Om is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef CLIENTKEY_H
+#define CLIENTKEY_H
+
+#include <string>
+
+namespace Om {
+namespace Shared {
+
+
+/** Key for looking up clients.
+ *
+ * This might actually be a lookup key (as in OSC clients) or a direct handle
+ * of some kind (eg pointer) (for in-process or shared memory clients).
+ *
+ * This is shared code, nothing client or server code specific should be here.
+ */
+class ClientKey
+{
+public:
+ /** A key to identify a particular ClientInterface.
+ *
+ * There are two different OSC key types because one is for server side,
+ * and one is for client side. A client can not identify it's own URL to
+ * the host (for NAT traversal, etc) so it can only know the outgoing UDP
+ * port it's sending on. The server however identifies that client by the
+ * 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
+ };
+
+ ClientKey()
+ : _type(NIL),
+ _uri("")
+ {}
+
+ ClientKey(Type type, const std::string& uri)
+ : _type(OSC_URL)
+ , _uri(uri)
+ {}
+
+ /*ClientKey(Type type, int port)
+ : _type(OSC_PORT)
+ , _port(port)
+ {}*/
+
+ inline bool
+ operator==(const ClientKey& key) const
+ {
+ return (_type == key._type && _uri == key._uri);
+ }
+
+ inline Type type() const { return _type; }
+ inline const std::string& uri() const { return _uri; }
+
+protected:
+ Type _type;
+ const std::string _uri; ///< URL for OSC_URL, (string) port number for OSC_PORT
+};
+
+
+} // namespace Shared
+} // namespace Om
+
+#endif // CLIENTKEY_H
+
diff --git a/src/common/interface/EngineInterface.h b/src/common/interface/EngineInterface.h
new file mode 100644
index 00000000..c290a921
--- /dev/null
+++ b/src/common/interface/EngineInterface.h
@@ -0,0 +1,121 @@
+/* This file is part of Om. Copyright (C) 2006 Dave Robillard.
+ *
+ * Om is free software = 0; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation = 0; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Om is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY = 0; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program = 0; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef ENGINEINTERFACE_H
+#define ENGINEINTERFACE_H
+
+#include <inttypes.h>
+#include <string>
+#include "util/CountedPtr.h"
+#include "interface/ClientInterface.h"
+using std::string;
+
+namespace Om {
+/** Shared code used on both client side and engine side (abstract interfaces). */
+namespace Shared {
+
+class ClientKey;
+
+
+/** The (only) interface clients use to communicate with the engine.
+ *
+ * Purely virtual (except for the destructor).
+ */
+class EngineInterface
+{
+public:
+ virtual ~EngineInterface() {}
+
+ // Client registration
+ virtual void register_client(ClientKey key, CountedPtr<ClientInterface> client) = 0;
+ virtual void unregister_client(ClientKey key) = 0;
+
+
+ // Engine commands
+ virtual void load_plugins() = 0;
+ virtual void activate() = 0;
+ virtual void deactivate() = 0;
+ virtual void quit() = 0;
+
+ // Object commands
+
+ virtual void create_patch(const string& path,
+ uint32_t poly) = 0;
+
+ virtual void create_node(const string& path,
+ const string& plugin_type,
+ const string& plugin_uri,
+ bool polyphonic) = 0;
+
+ virtual void rename(const string& old_path,
+ const string& new_name) = 0;
+
+ virtual void destroy(const string& path) = 0;
+
+ virtual void clear_patch(const string& patch_path) = 0;
+
+ virtual void enable_patch(const string& patch_path) = 0;
+
+ virtual void disable_patch(const string& patch_path) = 0;
+
+ virtual void connect(const string& src_port_path,
+ const string& dst_port_path) = 0;
+
+ virtual void disconnect(const string& src_port_path,
+ const string& dst_port_path) = 0;
+
+ virtual void disconnect_all(const string& node_path) = 0;
+
+ virtual void set_port_value(const string& port_path,
+ float val) = 0;
+
+ virtual void set_port_value(const string& port_path,
+ uint32_t voice,
+ float val) = 0;
+
+ virtual void set_port_value_queued(const string& port_path,
+ float val) = 0;
+
+ virtual void set_program(const string& node_path,
+ uint32_t bank,
+ uint32_t program) = 0;
+
+ virtual void midi_learn(const string& node_path) = 0;
+
+ virtual void set_metadata(const string& path,
+ const string& predicate,
+ const string& value) = 0;
+
+ // Requests //
+
+ virtual void ping() = 0;
+
+ virtual void request_port_value(const string& port_path) = 0;
+
+ virtual void request_plugins() = 0;
+
+ virtual void request_all_objects() = 0;
+
+protected:
+ EngineInterface() {}
+};
+
+
+} // namespace Shared
+} // namespace Om
+
+#endif // ENGINEINTERFACE_H
+
diff --git a/src/common/interface/Makefile.am b/src/common/interface/Makefile.am
new file mode 100644
index 00000000..8719cccd
--- /dev/null
+++ b/src/common/interface/Makefile.am
@@ -0,0 +1,5 @@
+EXTRA_DIST = \
+ README \
+ ClientInterface.h \
+ ClientKey.h \
+ EngineInterface.h
diff --git a/src/common/interface/README b/src/common/interface/README
new file mode 100644
index 00000000..efa19700
--- /dev/null
+++ b/src/common/interface/README
@@ -0,0 +1,13 @@
+This directory is code that could POSSIBLY be used by both the engine and
+clients.
+
+It's very, very important that nothing here gets messed up that violates
+client/engine separation. All interfaces use simple messages composed of
+serializable types, and no binary data that could break is shared. It's
+basically a functional version of a human-readable OSC interface, in both
+directions.
+
+The interface here maps directly on to the OSC interface - except it can
+happen in the same process as well, with only (virtual) function call
+overhead.
+