summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-04-13 04:59:03 +0000
committerDavid Robillard <d@drobilla.net>2011-04-13 04:59:03 +0000
commit8b2f670248c92776e375bd30c0815a4ff259bb0e (patch)
tree0f130bf4f118209788d2792b06de9f8b0aefebc6 /include
parent793bef06e2a98561e266a32ee767410ea44d4c67 (diff)
downloadingen-8b2f670248c92776e375bd30c0815a4ff259bb0e.tar.gz
ingen-8b2f670248c92776e375bd30c0815a4ff259bb0e.tar.bz2
ingen-8b2f670248c92776e375bd30c0815a4ff259bb0e.zip
Consistent local or installed includes for interface headers.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3143 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'include')
-rw-r--r--include/ingen/ClientInterface.hpp64
-rw-r--r--include/ingen/CommonInterface.hpp78
-rw-r--r--include/ingen/Connection.hpp43
-rw-r--r--include/ingen/EngineInterface.hpp77
-rw-r--r--include/ingen/EventType.hpp80
-rw-r--r--include/ingen/GraphObject.hpp52
-rw-r--r--include/ingen/Node.hpp53
-rw-r--r--include/ingen/Patch.hpp54
-rw-r--r--include/ingen/Plugin.hpp65
-rw-r--r--include/ingen/Port.hpp60
-rw-r--r--include/ingen/PortType.hpp100
-rw-r--r--include/ingen/Resource.hpp101
12 files changed, 827 insertions, 0 deletions
diff --git a/include/ingen/ClientInterface.hpp b/include/ingen/ClientInterface.hpp
new file mode 100644
index 00000000..3fb81f0e
--- /dev/null
+++ b/include/ingen/ClientInterface.hpp
@@ -0,0 +1,64 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2007-2009 David Robillard <http://drobilla.net>
+ *
+ * Ingen 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.
+ *
+ * Ingen 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.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef INGEN_INTERFACE_CLIENTINTERFACE_HPP
+#define INGEN_INTERFACE_CLIENTINTERFACE_HPP
+
+#include <stdint.h>
+
+#include <string>
+
+#include "ingen/CommonInterface.hpp"
+
+namespace Raul { class Path; class URI; }
+
+namespace Ingen {
+namespace Shared {
+
+/** The (only) interface the engine uses to communicate with clients.
+ * Purely virtual (except for the destructor).
+ *
+ * \ingroup interface
+ */
+class ClientInterface : public CommonInterface
+{
+public:
+ virtual ~ClientInterface() {}
+
+ virtual Raul::URI uri() const = 0;
+
+ virtual void response_ok(int32_t id) = 0;
+ virtual void response_error(int32_t id, const std::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 exceed the maximum bundle (packet) size).
+ */
+ virtual void transfer_begin() = 0;
+ virtual void transfer_end() = 0;
+
+ virtual void error(const std::string& msg) = 0;
+
+ virtual void activity(const Raul::Path& path) = 0;
+};
+
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif
diff --git a/include/ingen/CommonInterface.hpp b/include/ingen/CommonInterface.hpp
new file mode 100644
index 00000000..18ee87db
--- /dev/null
+++ b/include/ingen/CommonInterface.hpp
@@ -0,0 +1,78 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2008-2009 David Robillard <http://drobilla.net>
+ *
+ * Ingen 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.
+ *
+ * Ingen 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.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef INGEN_INTERFACE_COMMONINTERFACE_HPP
+#define INGEN_INTERFACE_COMMONINTERFACE_HPP
+
+#include "raul/Path.hpp"
+#include "raul/URI.hpp"
+
+#include "ingen/CommonInterface.hpp"
+#include "ingen/GraphObject.hpp"
+
+namespace Raul { class Atom; class Path; class URI; }
+
+namespace Ingen {
+namespace Shared {
+
+
+/** Abstract interface common to both engine and clients.
+ * Purely virtual (except for the destructor).
+ *
+ * \ingroup interface
+ */
+class CommonInterface
+{
+public:
+ virtual ~CommonInterface() {}
+
+ /** Begin an atomic bundle */
+ virtual void bundle_begin() = 0;
+
+ /** End (and send) an atomic bundle */
+ virtual void bundle_end() = 0;
+
+ virtual void put(const Raul::URI& uri,
+ const Resource::Properties& properties,
+ Resource::Graph ctx=Resource::DEFAULT) = 0;
+
+ virtual void delta(const Raul::URI& uri,
+ const Resource::Properties& remove,
+ const Resource::Properties& add) = 0;
+
+ virtual void move(const Raul::Path& old_path,
+ const Raul::Path& new_path) = 0;
+
+ virtual void del(const Raul::Path& path) = 0;
+
+ virtual void connect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path) = 0;
+
+ virtual void disconnect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path) = 0;
+
+ virtual void set_property(const Raul::URI& subject,
+ const Raul::URI& predicate,
+ const Raul::Atom& value) = 0;
+};
+
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_INTERFACE_COMMONINTERFACE_HPP
+
diff --git a/include/ingen/Connection.hpp b/include/ingen/Connection.hpp
new file mode 100644
index 00000000..8e429631
--- /dev/null
+++ b/include/ingen/Connection.hpp
@@ -0,0 +1,43 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2007-2009 David Robillard <http://drobilla.net>
+ *
+ * Ingen 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.
+ *
+ * Ingen 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.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef INGEN_INTERFACE_CONNECTION_HPP
+#define INGEN_INTERFACE_CONNECTION_HPP
+
+#include "raul/Path.hpp"
+
+namespace Ingen {
+namespace Shared {
+
+
+/** A connection between two ports.
+ *
+ * \ingroup interface
+ */
+class Connection
+{
+public:
+ virtual ~Connection() {}
+ virtual const Raul::Path src_port_path() const = 0;
+ virtual const Raul::Path dst_port_path() const = 0;
+};
+
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_INTERFACE_CONNECTION_HPP
diff --git a/include/ingen/EngineInterface.hpp b/include/ingen/EngineInterface.hpp
new file mode 100644
index 00000000..685d5488
--- /dev/null
+++ b/include/ingen/EngineInterface.hpp
@@ -0,0 +1,77 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2007-2009 David Robillard <http://drobilla.net>
+ *
+ * Ingen 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.
+ *
+ * Ingen 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.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef INGEN_INTERFACE_ENGINEINTERFACE_HPP
+#define INGEN_INTERFACE_ENGINEINTERFACE_HPP
+
+#include <stdint.h>
+
+#include "ingen/CommonInterface.hpp"
+
+namespace Ingen {
+namespace Shared {
+
+class ClientInterface;
+
+
+/** The (only) interface clients use to communicate with the engine.
+ * Purely virtual (except for the destructor).
+ *
+ * \ingroup interface
+ */
+class EngineInterface : public CommonInterface
+{
+public:
+ virtual ~EngineInterface() {}
+
+ virtual Raul::URI uri() const = 0;
+
+ // Responses
+ virtual void set_next_response_id(int32_t id) = 0;
+ virtual void disable_responses() = 0;
+
+ // Client registration
+ virtual void register_client(ClientInterface* client) = 0;
+ virtual void unregister_client(const Raul::URI& uri) = 0;
+
+ // Engine commands
+ virtual void load_plugins() = 0;
+ virtual void activate() = 0;
+ virtual void deactivate() = 0;
+ virtual void quit() = 0;
+
+ // Object commands
+
+ virtual void disconnect_all(const Raul::Path& parent_patch_path,
+ const Raul::Path& path) = 0;
+
+ // Requests
+
+ virtual void ping() = 0;
+
+ virtual void get(const Raul::URI& uri) = 0;
+
+ virtual void request_property(const Raul::URI& uri,
+ const Raul::URI& key) = 0;
+};
+
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_INTERFACE_ENGINEINTERFACE_HPP
+
diff --git a/include/ingen/EventType.hpp b/include/ingen/EventType.hpp
new file mode 100644
index 00000000..8a19ba42
--- /dev/null
+++ b/include/ingen/EventType.hpp
@@ -0,0 +1,80 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2008-2009 David Robillard <http://drobilla.net>
+ *
+ * Ingen 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.
+ *
+ * Ingen 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.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef INGEN_INTERFACE_EVENTTYPE_HPP
+#define INGEN_INTERFACE_EVENTTYPE_HPP
+
+#include "raul/URI.hpp"
+
+namespace Ingen {
+namespace Shared {
+
+
+/** A type of event (that can live in an EventBuffer).
+ */
+class EventType {
+public:
+
+ enum Symbol {
+ UNKNOWN = 0,
+ MIDI = 1,
+ OSC = 2
+ };
+
+ EventType(const Raul::URI& uri)
+ : _symbol(UNKNOWN)
+ {
+ if (uri == type_uri(MIDI)) {
+ _symbol = MIDI;
+ } else if (uri == type_uri(OSC)) {
+ _symbol = OSC;
+ }
+ }
+
+ EventType(Symbol symbol)
+ : _symbol(symbol)
+ {}
+
+ inline const Raul::URI& uri() const { return type_uri(_symbol); }
+
+ inline bool operator==(const Symbol& symbol) const { return (_symbol == symbol); }
+ inline bool operator!=(const Symbol& symbol) const { return (_symbol != symbol); }
+ inline bool operator==(const EventType& type) const { return (_symbol == type._symbol); }
+ inline bool operator!=(const EventType& type) const { return (_symbol != type._symbol); }
+
+ inline bool is_midi() { return _symbol == MIDI; }
+ inline bool is_osc() { return _symbol == OSC; }
+
+private:
+ static inline const Raul::URI& type_uri(unsigned symbol_num) {
+ assert(symbol_num <= OSC);
+ static const Raul::URI uris[] = {
+ "http://drobilla.net/ns/ingen#nil",
+ "http://drobilla.net/ns/ingen#MidiEvent",
+ "http://drobilla.net/ns/ingen#OSCEvent"
+ };
+ return uris[symbol_num];
+ }
+
+ Symbol _symbol;
+};
+
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_INTERFACE_EVENTTYPE_HPP
diff --git a/include/ingen/GraphObject.hpp b/include/ingen/GraphObject.hpp
new file mode 100644
index 00000000..6a8513fc
--- /dev/null
+++ b/include/ingen/GraphObject.hpp
@@ -0,0 +1,52 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2007-2009 David Robillard <http://drobilla.net>
+ *
+ * Ingen 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.
+ *
+ * Ingen 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.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef INGEN_INTERFACE_GRAPHOBJECT_HPP
+#define INGEN_INTERFACE_GRAPHOBJECT_HPP
+
+#include "raul/Deletable.hpp"
+
+#include "ingen/Resource.hpp"
+
+namespace Raul { class Atom; class Path; class Symbol; }
+
+namespace Ingen {
+namespace Shared {
+
+
+/** An object on the audio graph - Patch, Node, Port, etc.
+ *
+ * Purely virtual (except for the destructor).
+ *
+ * \ingroup interface
+ */
+class GraphObject : public Raul::Deletable
+ , public virtual Resource
+{
+public:
+ virtual void set_path(const Raul::Path& path) = 0;
+
+ virtual const Raul::Path& path() const = 0;
+ virtual const Raul::Symbol& symbol() const = 0;
+ virtual GraphObject* graph_parent() const = 0;
+};
+
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_INTERFACE_GRAPHOBJECT_HPP
diff --git a/include/ingen/Node.hpp b/include/ingen/Node.hpp
new file mode 100644
index 00000000..c97d1643
--- /dev/null
+++ b/include/ingen/Node.hpp
@@ -0,0 +1,53 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2007-2009 David Robillard <http://drobilla.net>
+ *
+ * Ingen 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.
+ *
+ * Ingen 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.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef INGEN_INTERFACE_NODE_HPP
+#define INGEN_INTERFACE_NODE_HPP
+
+#include <stdint.h>
+
+#include "ingen/GraphObject.hpp"
+
+namespace Ingen {
+namespace Shared {
+
+class Port;
+class Plugin;
+
+
+/** A Node (or "module") in a Patch (which is also a Node).
+ *
+ * A Node is a unit with input/output ports, a process() method, and some other
+ * things.
+ *
+ * Purely virtual (except for the destructor).
+ *
+ * \ingroup interface
+ */
+class Node : public virtual GraphObject
+{
+public:
+ virtual uint32_t num_ports() const = 0;
+ virtual Port* port(uint32_t index) const = 0;
+ virtual const Plugin* plugin() const = 0;
+};
+
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_INTERFACE_NODE_HPP
diff --git a/include/ingen/Patch.hpp b/include/ingen/Patch.hpp
new file mode 100644
index 00000000..f948c102
--- /dev/null
+++ b/include/ingen/Patch.hpp
@@ -0,0 +1,54 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2007-2009 David Robillard <http://drobilla.net>
+ *
+ * Ingen 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.
+ *
+ * Ingen 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.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef INGEN_INTERFACE_PATCH_HPP
+#define INGEN_INTERFACE_PATCH_HPP
+
+#include <map>
+#include <utility>
+
+#include "raul/SharedPtr.hpp"
+
+#include "ingen/Node.hpp"
+
+namespace Ingen {
+namespace Shared {
+
+class Connection;
+
+
+/** A Path (graph of Nodes/Connections)
+ *
+ * \ingroup interface
+ */
+class Patch : virtual public Node
+{
+public:
+ typedef std::pair<const Port*, const Port*> ConnectionsKey;
+ typedef std::map< ConnectionsKey, SharedPtr<Connection> > Connections;
+
+ virtual const Connections& connections() const = 0;
+
+ virtual bool enabled() const = 0;
+ virtual uint32_t internal_poly() const = 0;
+};
+
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_INTERFACE_PATCH_HPP
diff --git a/include/ingen/Plugin.hpp b/include/ingen/Plugin.hpp
new file mode 100644
index 00000000..358e6adb
--- /dev/null
+++ b/include/ingen/Plugin.hpp
@@ -0,0 +1,65 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2007-2009 David Robillard <http://drobilla.net>
+ *
+ * Ingen 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.
+ *
+ * Ingen 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.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef INGEN_INTERFACE_PLUGIN_HPP
+#define INGEN_INTERFACE_PLUGIN_HPP
+
+#include "raul/URI.hpp"
+
+#include "ingen/Resource.hpp"
+
+namespace Ingen {
+namespace Shared {
+
+
+class Plugin : virtual public Resource
+{
+public:
+ enum Type { NIL, LV2, Internal, Patch };
+
+ virtual Type type() const = 0;
+
+ static inline const Raul::URI& type_uri(Type type) {
+ static const Raul::URI uris[] = {
+ "http://drobilla.net/ns/ingen#nil",
+ "http://lv2plug.in/ns/lv2core#Plugin",
+ "http://drobilla.net/ns/ingen#Internal",
+ "http://drobilla.net/ns/ingen#Patch"
+ };
+
+ return uris[type];
+ }
+
+ inline const Raul::URI& type_uri() const { return type_uri(type()); }
+
+ static inline Type type_from_uri(const Raul::URI& uri) {
+ if (uri == type_uri(LV2))
+ return LV2;
+ else if (uri == type_uri(Internal))
+ return Internal;
+ else if (uri == type_uri(Patch))
+ return Patch;
+ else
+ return NIL;
+ }
+};
+
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_INTERFACE_PLUGIN_HPP
diff --git a/include/ingen/Port.hpp b/include/ingen/Port.hpp
new file mode 100644
index 00000000..9bd0437f
--- /dev/null
+++ b/include/ingen/Port.hpp
@@ -0,0 +1,60 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2007-2009 David Robillard <http://drobilla.net>
+ *
+ * Ingen 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.
+ *
+ * Ingen 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.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef INGEN_INTERFACE_PORT_HPP
+#define INGEN_INTERFACE_PORT_HPP
+
+#include <stdint.h>
+
+#include <set>
+
+#include "ingen/GraphObject.hpp"
+#include "ingen/PortType.hpp"
+
+namespace Raul { class Atom; }
+
+namespace Ingen {
+namespace Shared {
+
+
+/** A Port on a Node.
+ *
+ * Purely virtual (except for the destructor).
+ *
+ * \ingroup interface
+ */
+class Port : public virtual GraphObject
+{
+public:
+ typedef std::set<Shared::PortType> PortTypes;
+
+ virtual const PortTypes& types() const = 0;
+
+ inline bool is_a(PortType type) const { return types().find(type) != types().end(); }
+
+ virtual bool supports(const Raul::URI& value_type) const = 0;
+
+ virtual uint32_t index() const = 0;
+ virtual bool is_input() const = 0;
+ virtual const Raul::Atom& value() const = 0;
+};
+
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_INTERFACE_PORT_HPP
diff --git a/include/ingen/PortType.hpp b/include/ingen/PortType.hpp
new file mode 100644
index 00000000..92b86332
--- /dev/null
+++ b/include/ingen/PortType.hpp
@@ -0,0 +1,100 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2007-2009 David Robillard <http://drobilla.net>
+ *
+ * Ingen 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.
+ *
+ * Ingen 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.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef INGEN_INTERFACE_PORTTYPE_HPP
+#define INGEN_INTERFACE_PORTTYPE_HPP
+
+#include "raul/URI.hpp"
+
+namespace Ingen {
+namespace Shared {
+
+
+/** The type of a port.
+ *
+ * This type refers to the type of the port itself (not necessarily the type
+ * of its contents). Ports with different types can contain the same type of
+ * data, but may e.g. have different access semantics.
+ */
+class PortType {
+public:
+ enum Symbol {
+ UNKNOWN = 0,
+ AUDIO = 1,
+ CONTROL = 2,
+ EVENTS = 3,
+ VALUE = 4,
+ MESSAGE = 5,
+ };
+
+ PortType(const Raul::URI& uri)
+ : _symbol(UNKNOWN)
+ {
+ if (uri == type_uri(AUDIO)) {
+ _symbol = AUDIO;
+ } else if (uri == type_uri(CONTROL)) {
+ _symbol = CONTROL;
+ } else if (uri == type_uri(EVENTS)) {
+ _symbol = EVENTS;
+ } else if (uri == type_uri(VALUE)) {
+ _symbol = VALUE;
+ } else if (uri == type_uri(MESSAGE)) {
+ _symbol = MESSAGE;
+ }
+ }
+
+ PortType(Symbol symbol)
+ : _symbol(symbol)
+ {}
+
+ inline const Raul::URI& uri() const { return type_uri(_symbol); }
+ inline Symbol symbol() const { return _symbol; }
+
+ inline bool operator==(const Symbol& symbol) const { return (_symbol == symbol); }
+ inline bool operator!=(const Symbol& symbol) const { return (_symbol != symbol); }
+ inline bool operator==(const PortType& type) const { return (_symbol == type._symbol); }
+ inline bool operator!=(const PortType& type) const { return (_symbol != type._symbol); }
+ inline bool operator<(const PortType& type) const { return (_symbol < type._symbol); }
+
+ inline bool is_audio() { return _symbol == AUDIO; }
+ inline bool is_control() { return _symbol == CONTROL; }
+ inline bool is_events() { return _symbol == EVENTS; }
+ inline bool is_value() { return _symbol == VALUE; }
+ inline bool is_message() { return _symbol == MESSAGE; }
+
+private:
+ static inline const Raul::URI& type_uri(unsigned symbol_num) {
+ assert(symbol_num <= MESSAGE);
+ static const Raul::URI uris[] = {
+ "http://drobilla.net/ns/ingen#nil",
+ "http://lv2plug.in/ns/lv2core#AudioPort",
+ "http://lv2plug.in/ns/lv2core#ControlPort",
+ "http://lv2plug.in/ns/ext/event#EventPort",
+ "http://lv2plug.in/ns/ext/atom#ValuePort",
+ "http://lv2plug.in/ns/ext/atom#MessagePort"
+ };
+ return uris[symbol_num];
+ }
+
+ Symbol _symbol;
+};
+
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_INTERFACE_PORTTYPE_HPP
diff --git a/include/ingen/Resource.hpp b/include/ingen/Resource.hpp
new file mode 100644
index 00000000..66183951
--- /dev/null
+++ b/include/ingen/Resource.hpp
@@ -0,0 +1,101 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2008-2009 David Robillard <http://drobilla.net>
+ *
+ * Ingen 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.
+ *
+ * Ingen 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.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef INGEN_INTERFACE_RESOURCE_HPP
+#define INGEN_INTERFACE_RESOURCE_HPP
+
+#include <map>
+#include <string>
+
+#include "raul/Atom.hpp"
+#include "raul/URI.hpp"
+
+namespace Ingen {
+namespace Shared {
+
+
+class Resource
+{
+public:
+ enum Graph {
+ DEFAULT,
+ EXTERNAL,
+ INTERNAL
+ };
+
+ class Property : public Raul::Atom {
+ public:
+ Property(const Raul::Atom& atom, Graph ctx=DEFAULT)
+ : Raul::Atom(atom)
+ , _ctx(ctx)
+ {}
+
+ Property() : Raul::Atom(), _ctx(DEFAULT) {}
+ Property(int32_t val) : Raul::Atom(val), _ctx(DEFAULT) {}
+ Property(float val) : Raul::Atom(val), _ctx(DEFAULT) {}
+ Property(bool val) : Raul::Atom(val), _ctx(DEFAULT) {}
+ Property(const char* val) : Raul::Atom(val), _ctx(DEFAULT) {}
+ Property(const std::string& val) : Raul::Atom(val), _ctx(DEFAULT) {}
+
+ Property(const Raul::Atom::DictValue& dict)
+ : Raul::Atom(dict)
+ , _ctx(DEFAULT)
+ {}
+
+ Property(Type t, const std::string& uri)
+ : Raul::Atom(t, uri)
+ , _ctx(DEFAULT)
+ {}
+
+ Graph context() const { return _ctx; }
+ void set_context(Graph ctx) { _ctx = ctx; }
+
+ private:
+ Graph _ctx;
+ };
+
+ virtual ~Resource() {}
+
+ virtual const Raul::URI& uri() const = 0;
+
+ typedef std::multimap<Raul::URI, Property> Properties;
+
+ static void set_context(Properties& props, Graph ctx) {
+ for (Properties::iterator i = props.begin(); i != props.end(); ++i) {
+ i->second.set_context(ctx);
+ }
+ }
+
+ virtual Properties properties(Resource::Graph ctx) const = 0;
+
+ virtual const Properties& properties() const = 0;
+ virtual Properties& properties() = 0;
+ virtual const Raul::Atom& get_property(const Raul::URI& uri) const = 0;
+ virtual Raul::Atom& set_property(const Raul::URI& uri,
+ const Raul::Atom& value) = 0;
+ virtual void add_property(const Raul::URI& uri,
+ const Raul::Atom& value) = 0;
+ virtual bool has_property(const Raul::URI& uri,
+ const Raul::Atom& value) const = 0;
+};
+
+
+} // namespace Shared
+} // namespace Ingen
+
+#endif // INGEN_INTERFACE_RESOURCE_HPP
+