diff options
author | David Robillard <d@drobilla.net> | 2012-07-30 23:00:13 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-07-30 23:00:13 +0000 |
commit | 0e1bf6ddfc77866ff6477a3f394c030c2a5e1b39 (patch) | |
tree | afcba1a0ba16837f7b6f1a4822b7164deccb61e7 /src/server | |
parent | 921881813d7fb2e46a0e65d1e888f6cd9a928945 (diff) | |
download | ingen-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 'src/server')
-rw-r--r-- | src/server/Context.hpp | 4 | ||||
-rw-r--r-- | src/server/EdgeImpl.hpp | 3 | ||||
-rw-r--r-- | src/server/InputPort.cpp | 5 | ||||
-rw-r--r-- | src/server/JackDriver.cpp | 2 | ||||
-rw-r--r-- | src/server/LV2ResizeFeature.hpp | 2 | ||||
-rw-r--r-- | src/server/NodeImpl.cpp | 2 | ||||
-rw-r--r-- | src/server/NodeImpl.hpp | 10 | ||||
-rw-r--r-- | src/server/OutputPort.cpp | 6 | ||||
-rw-r--r-- | src/server/PatchImpl.hpp | 11 | ||||
-rw-r--r-- | src/server/PortImpl.hpp | 6 | ||||
-rw-r--r-- | src/server/Worker.cpp | 2 | ||||
-rw-r--r-- | src/server/Worker.hpp | 2 | ||||
-rw-r--r-- | src/server/events/DisconnectAll.cpp | 2 |
13 files changed, 26 insertions, 31 deletions
diff --git a/src/server/Context.hpp b/src/server/Context.hpp index caebd7a4..70bf9949 100644 --- a/src/server/Context.hpp +++ b/src/server/Context.hpp @@ -17,9 +17,9 @@ #ifndef INGEN_ENGINE_CONTEXT_HPP #define INGEN_ENGINE_CONTEXT_HPP -#include "raul/RingBuffer.hpp" - #include "ingen/shared/World.hpp" +#include "raul/Atom.hpp" +#include "raul/RingBuffer.hpp" #include "types.hpp" diff --git a/src/server/EdgeImpl.hpp b/src/server/EdgeImpl.hpp index b93d65f6..23a22ba3 100644 --- a/src/server/EdgeImpl.hpp +++ b/src/server/EdgeImpl.hpp @@ -52,8 +52,7 @@ class BufferFactory; * \ingroup engine */ class EdgeImpl - : public Raul::Deletable - , private Raul::Noncopyable + : private Raul::Noncopyable , public Edge , public boost::intrusive::slist_base_hook< boost::intrusive::link_mode<boost::intrusive::auto_unlink> > diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp index 70d3662c..90d01cca 100644 --- a/src/server/InputPort.cpp +++ b/src/server/InputPort.cpp @@ -17,8 +17,6 @@ #include <cstdlib> #include <cassert> -#include "ingen/Patch.hpp" - #include "BufferFactory.hpp" #include "EdgeImpl.hpp" #include "Engine.hpp" @@ -48,8 +46,9 @@ InputPort::InputPort(BufferFactory& bufs, { const Ingen::Shared::URIs& uris = bufs.uris(); - if (!dynamic_cast<Patch*>(parent)) + if (parent->graph_type() != GraphObject::PATCH) { add_property(uris.rdf_type, uris.lv2_InputPort); + } // Set default control range if (type == PortType::CONTROL || type == PortType::CV) { diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index 0316c401..3dcf6072 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -468,7 +468,7 @@ JackDriver::_session_cb(jack_session_event_t* event) SharedPtr<Serialisation::Serialiser> serialiser = _engine.world()->serialiser(); if (serialiser) { - SharedPtr<Patch> root(_engine.root_patch(), NullDeleter<Patch>); + SharedPtr<GraphObject> root(_engine.root_patch(), NullDeleter<GraphObject>); serialiser->write_bundle(root, string("file://") + event->session_dir); } diff --git a/src/server/LV2ResizeFeature.hpp b/src/server/LV2ResizeFeature.hpp index a2d9e8b6..978a1c8f 100644 --- a/src/server/LV2ResizeFeature.hpp +++ b/src/server/LV2ResizeFeature.hpp @@ -46,7 +46,7 @@ struct ResizeFeature : public Ingen::Shared::LV2Features::Feature { free(feature); } - SharedPtr<LV2_Feature> feature(Shared::World* w, Node* n) { + SharedPtr<LV2_Feature> feature(Shared::World* w, GraphObject* n) { NodeImpl* node = dynamic_cast<NodeImpl*>(n); if (!node) return SharedPtr<LV2_Feature>(); diff --git a/src/server/NodeImpl.cpp b/src/server/NodeImpl.cpp index 39affd63..2b465b76 100644 --- a/src/server/NodeImpl.cpp +++ b/src/server/NodeImpl.cpp @@ -62,7 +62,7 @@ NodeImpl::~NodeImpl() delete _ports; } -Port* +GraphObject* NodeImpl::port(uint32_t index) const { return (*_ports)[index]; diff --git a/src/server/NodeImpl.hpp b/src/server/NodeImpl.hpp index 995450f3..f9509e49 100644 --- a/src/server/NodeImpl.hpp +++ b/src/server/NodeImpl.hpp @@ -20,7 +20,6 @@ #include <list> #include <string> -#include "ingen/Node.hpp" #include "raul/Array.hpp" #include "raul/AtomicInt.hpp" #include "raul/Semaphore.hpp" @@ -39,7 +38,6 @@ class Maid; namespace Ingen { class Plugin; -class Port; namespace Server { @@ -59,7 +57,7 @@ class ProcessContext; * * \ingroup engine */ -class NodeImpl : public GraphObjectImpl, virtual public Node +class NodeImpl : public GraphObjectImpl { public: NodeImpl(PluginImpl* plugin, @@ -70,6 +68,8 @@ public: virtual ~NodeImpl(); + virtual GraphType graph_type() const { return NODE; } + /** Activate this Node. * * This function must be called in a non-realtime thread before it is @@ -142,8 +142,8 @@ public: BufferRef buf, SampleCount offset); - virtual Port* port(uint32_t index) const; - virtual PortImpl* port_impl(uint32_t index) const { return (*_ports)[index]; } + virtual GraphObject* port(uint32_t index) const; + virtual PortImpl* port_impl(uint32_t index) const { return (*_ports)[index]; } /** Nodes that are connected to this Node's inputs. */ std::list<NodeImpl*>& providers() { return _providers; } diff --git a/src/server/OutputPort.cpp b/src/server/OutputPort.cpp index eee852f5..30650f90 100644 --- a/src/server/OutputPort.cpp +++ b/src/server/OutputPort.cpp @@ -14,14 +14,13 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/Patch.hpp" +#include "ingen/shared/URIs.hpp" #include "Buffer.hpp" #include "BufferFactory.hpp" #include "Engine.hpp" #include "NodeImpl.hpp" #include "OutputPort.hpp" -#include "ingen/shared/URIs.hpp" using namespace std; @@ -39,8 +38,9 @@ OutputPort::OutputPort(BufferFactory& bufs, size_t buffer_size) : PortImpl(bufs, parent, symbol, index, poly, type, buffer_type, value, buffer_size) { - if (!dynamic_cast<Patch*>(parent)) + if (parent->graph_type() != GraphObject::PATCH) { add_property(bufs.uris().rdf_type, bufs.uris().lv2_OutputPort); + } _broadcast = true; diff --git a/src/server/PatchImpl.hpp b/src/server/PatchImpl.hpp index 0a8d5547..1d8cef08 100644 --- a/src/server/PatchImpl.hpp +++ b/src/server/PatchImpl.hpp @@ -21,7 +21,6 @@ #include <list> #include <string> -#include "ingen/Patch.hpp" #include "raul/List.hpp" #include "CompiledPatch.hpp" @@ -50,7 +49,7 @@ class ProcessContext; * * \ingroup engine */ -class PatchImpl : public NodeImpl, public Patch +class PatchImpl : public NodeImpl { public: PatchImpl(Engine& engine, @@ -62,6 +61,8 @@ public: virtual ~PatchImpl(); + virtual GraphType graph_type() const { return PATCH; } + void activate(BufferFactory& bufs); void deactivate(); @@ -100,11 +101,8 @@ public: void add_node(Nodes::Node* tn); Nodes::Node* remove_node(const Raul::Symbol& symbol); - Nodes& nodes() { return _nodes; } - Edges& edges() { return _edges; } - + Nodes& nodes() { return _nodes; } const Nodes& nodes() const { return _nodes; } - const Edges& edges() const { return _edges; } uint32_t num_ports_non_rt() const; @@ -165,7 +163,6 @@ private: uint32_t _poly_pre; ///< Pre-process thread only uint32_t _poly_process; ///< Process thread only CompiledPatch* _compiled_patch; ///< Process thread only - Edges _edges; ///< Pre-process thread only Ports _inputs; ///< Pre-process thread only Ports _outputs; ///< Pre-process thread only Nodes _nodes; ///< Pre-process thread only diff --git a/src/server/PortImpl.hpp b/src/server/PortImpl.hpp index 690461cc..63efb64f 100644 --- a/src/server/PortImpl.hpp +++ b/src/server/PortImpl.hpp @@ -23,8 +23,6 @@ #include "raul/Array.hpp" #include "raul/Atom.hpp" -#include "ingen/Port.hpp" - #include "Buffer.hpp" #include "BufferRef.hpp" #include "Context.hpp" @@ -48,11 +46,13 @@ class BufferFactory; * * \ingroup engine */ -class PortImpl : public GraphObjectImpl, public Port +class PortImpl : public GraphObjectImpl { public: ~PortImpl(); + virtual GraphType graph_type() const { return PORT; } + /** A port's parent is always a node, so static cast should be safe */ NodeImpl* parent_node() const { return (NodeImpl*)_parent; } diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp index 006b45d4..58cf6104 100644 --- a/src/server/Worker.cpp +++ b/src/server/Worker.cpp @@ -80,7 +80,7 @@ delete_feature(LV2_Feature* feature) } SharedPtr<LV2_Feature> -Worker::Schedule::feature(Shared::World* world, Node* n) +Worker::Schedule::feature(Shared::World* world, GraphObject* n) { LV2Node* node = dynamic_cast<LV2Node*>(n); if (!node) { diff --git a/src/server/Worker.hpp b/src/server/Worker.hpp index c390564e..785c8fa2 100644 --- a/src/server/Worker.hpp +++ b/src/server/Worker.hpp @@ -34,7 +34,7 @@ public: Worker(uint32_t buffer_size); struct Schedule : public Shared::LV2Features::Feature { - SharedPtr<LV2_Feature> feature(Shared::World* world, Node* n); + SharedPtr<LV2_Feature> feature(Shared::World* world, GraphObject* n); }; LV2_Worker_Status request(LV2Node* node, diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index 13d6e00f..33cd236b 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -111,7 +111,7 @@ DisconnectAll::pre_process() // Find set of edges to remove std::set<EdgeImpl*> to_remove; - for (Patch::Edges::const_iterator i = _parent->edges().begin(); + for (GraphObject::Edges::const_iterator i = _parent->edges().begin(); i != _parent->edges().end(); ++i) { EdgeImpl* const c = (EdgeImpl*)i->second.get(); if (_node) { |