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 | |
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')
-rw-r--r-- | src/client/NodeModel.cpp | 16 | ||||
-rw-r--r-- | src/client/PatchModel.cpp | 24 | ||||
-rw-r--r-- | src/serialisation/Serialiser.cpp | 123 | ||||
-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 | ||||
-rw-r--r-- | src/shared/Builder.cpp | 8 | ||||
-rw-r--r-- | src/shared/LV2Features.cpp | 2 | ||||
-rw-r--r-- | src/shared/Store.cpp | 10 |
19 files changed, 105 insertions, 135 deletions
diff --git a/src/client/NodeModel.cpp b/src/client/NodeModel.cpp index a92d5aae..2a88b4db 100644 --- a/src/client/NodeModel.cpp +++ b/src/client/NodeModel.cpp @@ -18,7 +18,6 @@ #include <cmath> #include <string> -#include "ingen/Port.hpp" #include "ingen/client/NodeModel.hpp" #include "ingen/shared/URIs.hpp" #include "ingen/shared/World.hpp" @@ -29,8 +28,7 @@ namespace Client { NodeModel::NodeModel(Shared::URIs& uris, SharedPtr<PluginModel> plugin, const Raul::Path& path) - : Node() - , ObjectModel(uris, path) + : ObjectModel(uris, path) , _plugin_uri(plugin->uri()) , _plugin(plugin) , _num_values(0) @@ -42,8 +40,7 @@ NodeModel::NodeModel(Shared::URIs& uris, NodeModel::NodeModel(Shared::URIs& uris, const Raul::URI& plugin_uri, const Raul::Path& path) - : Node() - , ObjectModel(uris, path) + : ObjectModel(uris, path) , _plugin_uri(plugin_uri) , _num_values(0) , _min_values(0) @@ -52,8 +49,7 @@ NodeModel::NodeModel(Shared::URIs& uris, } NodeModel::NodeModel(const NodeModel& copy) - : Node(copy) - , ObjectModel(copy) + : ObjectModel(copy) , _plugin_uri(copy._plugin_uri) , _num_values(copy._num_values) , _min_values((float*)malloc(sizeof(float) * _num_values)) @@ -153,12 +149,12 @@ NodeModel::get_port(const Raul::Symbol& symbol) const return SharedPtr<PortModel>(); } -Ingen::Port* +Ingen::GraphObject* NodeModel::port(uint32_t index) const { assert(index < num_ports()); - return const_cast<Ingen::Port*>( - dynamic_cast<const Ingen::Port*>(_ports[index].get())); + return const_cast<Ingen::GraphObject*>( + dynamic_cast<const Ingen::GraphObject*>(_ports[index].get())); } void diff --git a/src/client/PatchModel.cpp b/src/client/PatchModel.cpp index df6f63c0..7acb8aec 100644 --- a/src/client/PatchModel.cpp +++ b/src/client/PatchModel.cpp @@ -53,7 +53,7 @@ PatchModel::remove_child(SharedPtr<ObjectModel> o) // Remove any connections which referred to this object, // since they can't possibly exist anymore - for (Edges::iterator j = _edges->begin(); j != _edges->end();) { + for (Edges::iterator j = _edges.begin(); j != _edges.end();) { Edges::iterator next = j; ++next; @@ -65,7 +65,7 @@ PatchModel::remove_child(SharedPtr<ObjectModel> o) || cm->head_path().parent() == o->path() || cm->head_path() == o->path()) { _signal_removed_edge.emit(cm); - _edges->erase(j); // cuts our reference + _edges.erase(j); // cuts our reference } j = next; } @@ -84,19 +84,19 @@ PatchModel::remove_child(SharedPtr<ObjectModel> o) void PatchModel::clear() { - _edges->clear(); + _edges.clear(); NodeModel::clear(); - assert(_edges->empty()); + assert(_edges.empty()); assert(_ports.empty()); } SharedPtr<EdgeModel> -PatchModel::get_edge(const Port* tail, const Ingen::Port* head) +PatchModel::get_edge(const GraphObject* tail, const GraphObject* head) { - Edges::iterator i = _edges->find(make_pair(tail, head)); - if (i != _edges->end()) + Edges::iterator i = _edges.find(make_pair(tail, head)); + if (i != _edges.end()) return PtrCast<EdgeModel>(i->second); else return SharedPtr<EdgeModel>(); @@ -131,20 +131,20 @@ PatchModel::add_edge(SharedPtr<EdgeModel> cm) assert(cm->tail() == existing->tail()); assert(cm->head() == existing->head()); } else { - _edges->insert(make_pair(make_pair(cm->tail().get(), + _edges.insert(make_pair(make_pair(cm->tail().get(), cm->head().get()), cm)); _signal_new_edge.emit(cm); } } void -PatchModel::remove_edge(const Port* tail, const Ingen::Port* head) +PatchModel::remove_edge(const GraphObject* tail, const GraphObject* head) { - Edges::iterator i = _edges->find(make_pair(tail, head)); - if (i != _edges->end()) { + Edges::iterator i = _edges.find(make_pair(tail, head)); + if (i != _edges.end()) { SharedPtr<EdgeModel> c = PtrCast<EdgeModel>(i->second); _signal_removed_edge.emit(c); - _edges->erase(i); + _edges.erase(i); } else { Raul::warn(Raul::fmt("Failed to remove patch connection %1% => %2%\n") % tail->path() % head->path()); diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index 8f82ed5f..d0ed16ca 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -27,11 +27,9 @@ #include <glibmm/module.h> #include "ingen/Edge.hpp" +#include "ingen/GraphObject.hpp" #include "ingen/Interface.hpp" -#include "ingen/Node.hpp" -#include "ingen/Patch.hpp" #include "ingen/Plugin.hpp" -#include "ingen/Port.hpp" #include "ingen/Resource.hpp" #include "ingen/serialisation/Serialiser.hpp" #include "ingen/shared/Store.hpp" @@ -72,28 +70,28 @@ struct Serialiser::Impl { void start_to_filename(const std::string& filename); - void serialise_patch(SharedPtr<const Patch> p, - const Sord::Node& id); + void serialise_patch(SharedPtr<const GraphObject> p, + const Sord::Node& id); - void serialise_node(SharedPtr<const Node> n, - const Sord::Node& class_id, - const Sord::Node& id); + void serialise_node(SharedPtr<const GraphObject> n, + const Sord::Node& class_id, + const Sord::Node& id); - void serialise_port(const Port* p, - Resource::Graph context, - const Sord::Node& id); + void serialise_port(const GraphObject* p, + Resource::Graph context, + const Sord::Node& id); void serialise_properties(Sord::Node id, const Resource::Properties& props); - void write_bundle(SharedPtr<const Patch> patch, - const std::string& uri); + void write_bundle(SharedPtr<const GraphObject> patch, + const std::string& uri); Sord::Node path_rdf_node(const Raul::Path& path); - void write_manifest(const std::string& bundle_path, - SharedPtr<const Patch> patch, - const std::string& patch_symbol); + void write_manifest(const std::string& bundle_path, + SharedPtr<const GraphObject> patch, + const std::string& patch_symbol); void serialise_edge(const Sord::Node& parent, SharedPtr<const Edge> c) @@ -130,9 +128,9 @@ Serialiser::to_file(SharedPtr<const GraphObject> object, } void -Serialiser::Impl::write_manifest(const std::string& bundle_path, - SharedPtr<const Patch> patch, - const std::string& patch_symbol) +Serialiser::Impl::write_manifest(const std::string& bundle_path, + SharedPtr<const GraphObject> patch, + const std::string& patch_symbol) { const string manifest_path(Glib::build_filename(bundle_path, "manifest.ttl")); const string binary_path(Glib::Module::build_path("", "ingen_lv2")); @@ -181,15 +179,15 @@ normal_bundle_uri(const std::string& uri) } void -Serialiser::write_bundle(SharedPtr<const Patch> patch, - const std::string& path) +Serialiser::write_bundle(SharedPtr<const GraphObject> patch, + const std::string& path) { me->write_bundle(patch, path); } void -Serialiser::Impl::write_bundle(SharedPtr<const Patch> patch, - const std::string& a_path) +Serialiser::Impl::write_bundle(SharedPtr<const GraphObject> patch, + const std::string& a_path) { std::string path = Glib::filename_from_uri(a_path); if (Glib::file_test(path, Glib::FILE_TEST_EXISTS) @@ -307,32 +305,24 @@ Serialiser::serialise(SharedPtr<const GraphObject> object) throw (std::logic_err if (!me->_model) throw std::logic_error("serialise called without serialisation in progress"); - SharedPtr<const Patch> patch = PtrCast<const Patch>(object); - if (patch) { - me->serialise_patch(patch, me->path_rdf_node(patch->path())); - return; - } - - SharedPtr<const Node> node = PtrCast<const Node>(object); - if (node) { - const Sord::URI plugin_id(me->_model->world(), node->plugin()->uri().str()); - me->serialise_node(node, plugin_id, me->path_rdf_node(node->path())); - return; - } - - SharedPtr<const Port> port = PtrCast<const Port>(object); - if (port) { - me->serialise_port(port.get(), Resource::DEFAULT, me->path_rdf_node(port->path())); - return; + if (object->graph_type() == GraphObject::PATCH) { + me->serialise_patch(object, me->path_rdf_node(object->path())); + } else if (object->graph_type() == GraphObject::NODE) { + const Sord::URI plugin_id(me->_model->world(), object->plugin()->uri().str()); + me->serialise_node(object, plugin_id, me->path_rdf_node(object->path())); + } else if (object->graph_type() == GraphObject::PORT) { + me->serialise_port(object.get(), + Resource::DEFAULT, + me->path_rdf_node(object->path())); + } else { + LOG(warn) << "Unsupported object type, " + << object->path() << " not serialised." << endl; } - - LOG(warn) << "Unsupported object type, " - << object->path() << " not serialised." << endl; } void -Serialiser::Impl::serialise_patch(SharedPtr<const Patch> patch, - const Sord::Node& patch_id) +Serialiser::Impl::serialise_patch(SharedPtr<const GraphObject> patch, + const Sord::Node& patch_id) { assert(_model); Sord::World& world = _model->world(); @@ -386,9 +376,9 @@ Serialiser::Impl::serialise_patch(SharedPtr<const Patch> patch, if (n->first.parent() != patch->path()) continue; - SharedPtr<Patch> subpatch = PtrCast<Patch>(n->second); - SharedPtr<Node> node = PtrCast<Node>(n->second); - if (subpatch) { + if (n->second->graph_type() == GraphObject::PATCH) { + SharedPtr<GraphObject> subpatch = n->second; + SerdURI base_uri; serd_uri_parse((const uint8_t*)_base_uri.c_str(), &base_uri); @@ -419,7 +409,9 @@ Serialiser::Impl::serialise_patch(SharedPtr<const Patch> patch, Sord::Curie(world, "ingen:node"), node_id); serialise_node(subpatch, subpatch_id, node_id); - } else if (node) { + } else if (n->second->graph_type() == GraphObject::NODE) { + SharedPtr<const GraphObject> node = n->second; + const Sord::URI class_id(world, node->plugin()->uri().str()); const Sord::Node node_id(path_rdf_node(n->second->path())); _model->add_statement(patch_id, @@ -430,7 +422,7 @@ Serialiser::Impl::serialise_patch(SharedPtr<const Patch> patch, } for (uint32_t i = 0; i < patch->num_ports(); ++i) { - Port* p = patch->port(i); + GraphObject* p = patch->port(i); const Sord::Node port_id = path_rdf_node(p->path()); // Ensure lv2:name always exists so Patch is a valid LV2 plugin @@ -444,16 +436,16 @@ Serialiser::Impl::serialise_patch(SharedPtr<const Patch> patch, serialise_port(p, Resource::INTERNAL, port_id); } - for (Patch::Edges::const_iterator c = patch->edges().begin(); + for (GraphObject::Edges::const_iterator c = patch->edges().begin(); c != patch->edges().end(); ++c) { serialise_edge(patch_id, c->second); } } void -Serialiser::Impl::serialise_node(SharedPtr<const Node> node, - const Sord::Node& class_id, - const Sord::Node& node_id) +Serialiser::Impl::serialise_node(SharedPtr<const GraphObject> node, + const Sord::Node& class_id, + const Sord::Node& node_id) { _model->add_statement(node_id, Sord::Curie(_model->world(), "rdf:type"), @@ -469,8 +461,8 @@ Serialiser::Impl::serialise_node(SharedPtr<const Node> node, serialise_properties(node_id, props); for (uint32_t i = 0; i < node->num_ports(); ++i) { - Port* const p = node->port(i); - const Sord::Node port_id = path_rdf_node(p->path()); + GraphObject* const p = node->port(i); + const Sord::Node port_id = path_rdf_node(p->path()); serialise_port(p, Resource::EXTERNAL, port_id); _model->add_statement(node_id, Sord::Curie(_model->world(), "lv2:port"), @@ -479,29 +471,20 @@ Serialiser::Impl::serialise_node(SharedPtr<const Node> node, } void -Serialiser::Impl::serialise_port(const Port* port, - Resource::Graph context, - const Sord::Node& port_id) +Serialiser::Impl::serialise_port(const GraphObject* port, + Resource::Graph context, + const Sord::Node& port_id) { Sord::World& world = _model->world(); - if (port->is_input()) { - _model->add_statement(port_id, - Sord::Curie(world, "rdf:type"), - Sord::Curie(world, "lv2:InputPort")); - } else { - _model->add_statement(port_id, - Sord::Curie(world, "rdf:type"), - Sord::Curie(world, "lv2:OutputPort")); - } - _model->add_statement(port_id, Sord::Curie(world, "lv2:symbol"), Sord::Literal(world, port->path().symbol())); GraphObject::Properties props = port->properties(context); if (context == Resource::INTERNAL) { - props.insert(make_pair(_world.uris().lv2_default, port->value())); + props.insert(make_pair(_world.uris().lv2_default, + _world.uris().ingen_value)); } serialise_properties(port_id, props); 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) { diff --git a/src/shared/Builder.cpp b/src/shared/Builder.cpp index 944b00ce..dadd2989 100644 --- a/src/shared/Builder.cpp +++ b/src/shared/Builder.cpp @@ -15,6 +15,7 @@ */ #include "ingen/Edge.hpp" +#include "ingen/GraphObject.hpp" #include "ingen/Interface.hpp" #include "ingen/shared/Builder.hpp" #include "ingen/shared/URIs.hpp" @@ -41,10 +42,9 @@ Builder::build(SharedPtr<const GraphObject> object) void Builder::connect(SharedPtr<const GraphObject> object) { - SharedPtr<const Patch> patch = PtrCast<const Patch>(object); - if (patch) { - for (Patch::Edges::const_iterator i = patch->edges().begin(); - i != patch->edges().end(); ++i) { + if (object->graph_type() == GraphObject::PATCH) { + for (GraphObject::Edges::const_iterator i = object->edges().begin(); + i != object->edges().end(); ++i) { _interface.connect(i->second->tail_path(), i->second->head_path()); } return; diff --git a/src/shared/LV2Features.cpp b/src/shared/LV2Features.cpp index 24b3f6fa..7061ff76 100644 --- a/src/shared/LV2Features.cpp +++ b/src/shared/LV2Features.cpp @@ -49,7 +49,7 @@ LV2Features::FeatureArray::~FeatureArray() } SharedPtr<LV2Features::FeatureArray> -LV2Features::lv2_features(Shared::World* world, Node* node) const +LV2Features::lv2_features(Shared::World* world, GraphObject* node) const { FeatureArray::FeatureVector vec; for (Features::const_iterator f = _features.begin(); f != _features.end(); ++f) { diff --git a/src/shared/Store.cpp b/src/shared/Store.cpp index 821322e7..ad950fd7 100644 --- a/src/shared/Store.cpp +++ b/src/shared/Store.cpp @@ -17,8 +17,7 @@ #include <sstream> #include <string> -#include "ingen/Node.hpp" -#include "ingen/Port.hpp" +#include "ingen/GraphObject.hpp" #include "ingen/shared/Store.hpp" #include "raul/PathTable.hpp" #include "raul/TableImpl.hpp" @@ -39,11 +38,8 @@ Store::add(GraphObject* o) insert(make_pair(o->path(), o)); - Node* node = dynamic_cast<Node*>(o); - if (node) { - for (uint32_t i=0; i < node->num_ports(); ++i) { - add(node->port(i)); - } + for (uint32_t i = 0; i < o->num_ports(); ++i) { + add(o->port(i)); } } |