From ba3e956f5be02730368b75fbec704e75b3f036da Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 26 Mar 2017 15:24:20 +0200 Subject: Remove Node::graph_type() method and GraphType enum --- src/Serialiser.cpp | 12 +++++++----- src/server/BlockImpl.hpp | 2 -- src/server/DuplexPort.cpp | 2 +- src/server/GraphImpl.hpp | 2 -- src/server/InputPort.cpp | 2 +- src/server/PortImpl.cpp | 3 ++- src/server/PortImpl.hpp | 2 -- 7 files changed, 11 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/Serialiser.cpp b/src/Serialiser.cpp index 6c70ca8b..518f0bea 100644 --- a/src/Serialiser.cpp +++ b/src/Serialiser.cpp @@ -303,12 +303,14 @@ Serialiser::serialise(SPtr object) throw (std::logic_error) if (!me->_model) throw std::logic_error("serialise called without serialisation in progress"); - if (object->graph_type() == Node::GraphType::GRAPH) { + const URIs& uris = me->_world.uris(); + if (object->has_property(uris.rdf_type, uris.ingen_Graph)) { me->serialise_graph(object, me->path_rdf_node(object->path())); - } else if (object->graph_type() == Node::GraphType::BLOCK) { + } else if (object->has_property(uris.rdf_type, uris.ingen_Block)) { const Sord::URI plugin_id(me->_model->world(), object->plugin()->uri()); me->serialise_block(object, plugin_id, me->path_rdf_node(object->path())); - } else if (object->graph_type() == Node::GraphType::PORT) { + } else if (object->has_property(uris.rdf_type, uris.lv2_InputPort) || + object->has_property(uris.rdf_type, uris.lv2_OutputPort)) { me->serialise_port(object.get(), Resource::Graph::DEFAULT, me->path_rdf_node(object->path())); @@ -359,7 +361,7 @@ Serialiser::Impl::serialise_graph(SPtr graph, if (n->first.parent() != graph->path()) continue; - if (n->second->graph_type() == Node::GraphType::GRAPH) { + if (n->second->has_property(uris.rdf_type, uris.ingen_Graph)) { SPtr subgraph = n->second; SerdURI base_uri; @@ -392,7 +394,7 @@ Serialiser::Impl::serialise_graph(SPtr graph, Sord::URI(world, uris.ingen_block), block_id); serialise_block(subgraph, subgraph_id, block_id); - } else if (n->second->graph_type() == Node::GraphType::BLOCK) { + } else if (n->second->has_property(uris.rdf_type, uris.ingen_Block)) { SPtr block = n->second; const Sord::URI class_id(world, block->plugin()->uri()); diff --git a/src/server/BlockImpl.hpp b/src/server/BlockImpl.hpp index 1a794e2d..0faf68ff 100644 --- a/src/server/BlockImpl.hpp +++ b/src/server/BlockImpl.hpp @@ -69,8 +69,6 @@ public: virtual ~BlockImpl(); - virtual GraphType graph_type() const { return GraphType::BLOCK; } - BlockImpl* parent() const { return _parent; } GraphImpl* graph_parent() const { return (GraphImpl*)_parent; } const Raul::Path& path() const { return _path; } diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp index b01da97f..0b115bc0 100644 --- a/src/server/DuplexPort.cpp +++ b/src/server/DuplexPort.cpp @@ -56,7 +56,7 @@ DuplexPort::DuplexPort(BufferFactory& bufs, _is_output = is_output; if (is_output) { - if (parent->graph_type() != Node::GraphType::GRAPH) { + if (!dynamic_cast(parent)) { remove_property(bufs.uris().rdf_type, bufs.uris().lv2_InputPort.urid); add_property(bufs.uris().rdf_type, bufs.uris().lv2_OutputPort.urid); } diff --git a/src/server/GraphImpl.hpp b/src/server/GraphImpl.hpp index 8c6e3711..85d4d940 100644 --- a/src/server/GraphImpl.hpp +++ b/src/server/GraphImpl.hpp @@ -59,8 +59,6 @@ public: virtual ~GraphImpl(); - virtual Node::GraphType graph_type() const { return Node::GraphType::GRAPH; } - BlockImpl* duplicate(Engine& engine, const Raul::Symbol& symbol, GraphImpl* parent); diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp index 0e68360e..6bf52ef2 100644 --- a/src/server/InputPort.cpp +++ b/src/server/InputPort.cpp @@ -49,7 +49,7 @@ InputPort::InputPort(BufferFactory& bufs, { const Ingen::URIs& uris = bufs.uris(); - if (parent->graph_type() != Node::GraphType::GRAPH) { + if (!dynamic_cast(parent)) { add_property(uris.rdf_type, uris.lv2_InputPort.urid); } } diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index 7b84be17..183b4c25 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -23,6 +23,7 @@ #include "Buffer.hpp" #include "BufferFactory.hpp" #include "Engine.hpp" +#include "GraphImpl.hpp" #include "PortImpl.hpp" #include "PortType.hpp" #include "ThreadManager.hpp" @@ -97,7 +98,7 @@ PortImpl::PortImpl(BufferFactory& bufs, } if (is_output) { - if (_parent->graph_type() != Node::GraphType::GRAPH) { + if (!dynamic_cast(_parent)) { add_property(bufs.uris().rdf_type, bufs.uris().lv2_OutputPort.urid); } } diff --git a/src/server/PortImpl.hpp b/src/server/PortImpl.hpp index aac31fc8..919db3a0 100644 --- a/src/server/PortImpl.hpp +++ b/src/server/PortImpl.hpp @@ -99,8 +99,6 @@ public: ~PortImpl(); - virtual GraphType graph_type() const { return GraphType::PORT; } - BlockImpl* parent() const { return _parent; } const Raul::Path& path() const { return _path; } const Raul::Symbol& symbol() const { return _symbol; } -- cgit v1.2.1