From 0e1bf6ddfc77866ff6477a3f394c030c2a5e1b39 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 30 Jul 2012 23:00:13 +0000 Subject: 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 --- ingen/client/NodeModel.hpp | 11 +++++------ ingen/client/PatchModel.hpp | 22 +++++++--------------- ingen/client/PortModel.hpp | 5 +++-- 3 files changed, 15 insertions(+), 23 deletions(-) (limited to 'ingen/client') diff --git a/ingen/client/NodeModel.hpp b/ingen/client/NodeModel.hpp index cc41070c..07810eed 100644 --- a/ingen/client/NodeModel.hpp +++ b/ingen/client/NodeModel.hpp @@ -22,9 +22,7 @@ #include #include "raul/SharedPtr.hpp" - -#include "ingen/Node.hpp" -#include "ingen/Port.hpp" +#include "ingen/GraphObject.hpp" #include "ingen/client/ObjectModel.hpp" #include "ingen/client/PortModel.hpp" #include "ingen/client/PluginModel.hpp" @@ -44,18 +42,19 @@ class ClientStore; * * @ingroup IngenClient */ -class NodeModel : public ObjectModel, - virtual public Ingen::Node +class NodeModel : public ObjectModel { public: NodeModel(const NodeModel& copy); virtual ~NodeModel(); + GraphType graph_type() const { return GraphObject::PATCH; } + typedef std::vector< SharedPtr > Ports; SharedPtr get_port(const Raul::Symbol& symbol) const; - Port* port(uint32_t index) const; + GraphObject* port(uint32_t index) const; const Raul::URI& plugin_uri() const { return _plugin_uri; } const Plugin* plugin() const { return _plugin.get(); } diff --git a/ingen/client/PatchModel.hpp b/ingen/client/PatchModel.hpp index 9d4e7752..1ad55c78 100644 --- a/ingen/client/PatchModel.hpp +++ b/ingen/client/PatchModel.hpp @@ -17,15 +17,10 @@ #ifndef INGEN_CLIENT_PATCHMODEL_HPP #define INGEN_CLIENT_PATCHMODEL_HPP -#include "raul/SharedPtr.hpp" - -#include "ingen/Patch.hpp" #include "ingen/client/NodeModel.hpp" +#include "raul/SharedPtr.hpp" namespace Ingen { - -class Port; - namespace Client { class ClientStore; @@ -35,15 +30,15 @@ class EdgeModel; * * @ingroup IngenClient */ -class PatchModel : public NodeModel, public Ingen::Patch +class PatchModel : public NodeModel { public: /* WARNING: Copy constructor creates a shallow copy WRT connections */ - const Edges& edges() const { return *_edges.get(); } + GraphType graph_type() const { return GraphObject::PATCH; } - SharedPtr get_edge(const Ingen::Port* tail, - const Ingen::Port* head); + SharedPtr get_edge(const Ingen::GraphObject* tail, + const Ingen::GraphObject* head); bool enabled() const; bool polyphonic() const; @@ -60,7 +55,6 @@ private: PatchModel(Shared::URIs& uris, const Raul::Path& patch_path) : NodeModel(uris, "http://drobilla.net/ns/ingen#Patch", patch_path) - , _edges(new Edges()) { } @@ -69,10 +63,8 @@ private: bool remove_child(SharedPtr c); void add_edge(SharedPtr cm); - void remove_edge(const Ingen::Port* tail, - const Ingen::Port* head); - - SharedPtr _edges; + void remove_edge(const Ingen::GraphObject* tail, + const Ingen::GraphObject* head); }; } // namespace Client diff --git a/ingen/client/PortModel.hpp b/ingen/client/PortModel.hpp index 477186fb..99cd85be 100644 --- a/ingen/client/PortModel.hpp +++ b/ingen/client/PortModel.hpp @@ -26,7 +26,6 @@ #include "lv2/lv2plug.in/ns/ext/port-props/port-props.h" #include "lv2/lv2plug.in/ns/lv2core/lv2.h" -#include "ingen/Port.hpp" #include "ingen/client/ObjectModel.hpp" namespace Raul { class Path; } @@ -38,11 +37,13 @@ namespace Client { * * @ingroup IngenClient */ -class PortModel : public ObjectModel, public Ingen::Port +class PortModel : public ObjectModel { public: enum Direction { INPUT, OUTPUT }; + GraphType graph_type() const { return GraphObject::PORT; } + bool supports(const Raul::URI& value_type) const; inline uint32_t index() const { return _index; } -- cgit v1.2.1