summaryrefslogtreecommitdiffstats
path: root/ingen/GraphObject.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-07-30 23:00:13 +0000
committerDavid Robillard <d@drobilla.net>2012-07-30 23:00:13 +0000
commit0e1bf6ddfc77866ff6477a3f394c030c2a5e1b39 (patch)
treeafcba1a0ba16837f7b6f1a4822b7164deccb61e7 /ingen/GraphObject.hpp
parent921881813d7fb2e46a0e65d1e888f6cd9a928945 (diff)
downloadingen-0e1bf6ddfc77866ff6477a3f394c030c2a5e1b39.tar.gz
ingen-0e1bf6ddfc77866ff6477a3f394c030c2a5e1b39.tar.bz2
ingen-0e1bf6ddfc77866ff6477a3f394c030c2a5e1b39.zip
Eliminate pure virtual base classes Patch, Node, and Port, and the virtual inheritance they imposed.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4576 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'ingen/GraphObject.hpp')
-rw-r--r--ingen/GraphObject.hpp32
1 files changed, 28 insertions, 4 deletions
diff --git a/ingen/GraphObject.hpp b/ingen/GraphObject.hpp
index b2165972..a0d5ec22 100644
--- a/ingen/GraphObject.hpp
+++ b/ingen/GraphObject.hpp
@@ -17,9 +17,9 @@
#ifndef INGEN_GRAPHOBJECT_HPP
#define INGEN_GRAPHOBJECT_HPP
-#include "raul/Deletable.hpp"
-
#include "ingen/Resource.hpp"
+#include "raul/Deletable.hpp"
+#include "raul/SharedPtr.hpp"
namespace Raul {
class Atom;
@@ -29,10 +29,11 @@ class Symbol;
namespace Ingen {
+class Edge;
+class Plugin;
+
/** An object on the audio graph - Patch, Node, Port, etc.
*
- * Purely virtual (except for the destructor).
- *
* @ingroup Ingen
*/
class GraphObject : public Raul::Deletable
@@ -41,9 +42,32 @@ class GraphObject : public Raul::Deletable
public:
virtual void set_path(const Raul::Path& path) = 0;
+ enum GraphType {
+ PATCH,
+ NODE,
+ PORT
+ };
+
+ typedef std::pair<const GraphObject*, const GraphObject*> EdgesKey;
+ typedef std::map< EdgesKey, SharedPtr<Edge> > Edges;
+
+ // Patches only
+ Edges& edges() { return _edges; }
+ const Edges& edges() const { return _edges; }
+
+ // Nodes and patches only
+ virtual uint32_t num_ports() const { return 0; }
+ virtual GraphObject* port(uint32_t index) const { return NULL; }
+ virtual const Plugin* plugin() const { return NULL; }
+
+ // All objects
+ virtual GraphType graph_type() const = 0;
virtual const Raul::Path& path() const = 0;
virtual const Raul::Symbol& symbol() const = 0;
virtual GraphObject* graph_parent() const = 0;
+
+protected:
+ Edges _edges; ///< Patches only
};
} // namespace Ingen