diff options
author | David Robillard <d@drobilla.net> | 2017-03-26 15:24:20 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-03-26 18:13:33 +0200 |
commit | ba3e956f5be02730368b75fbec704e75b3f036da (patch) | |
tree | 1163df60cc7f3279cf940ccd17d9290e7f0da317 | |
parent | 6268bb2accfdc0dcad6cb8b54ba56ec64609d474 (diff) | |
download | ingen-ba3e956f5be02730368b75fbec704e75b3f036da.tar.gz ingen-ba3e956f5be02730368b75fbec704e75b3f036da.tar.bz2 ingen-ba3e956f5be02730368b75fbec704e75b3f036da.zip |
Remove Node::graph_type() method and GraphType enum
-rw-r--r-- | ingen/Node.hpp | 7 | ||||
-rw-r--r-- | ingen/client/BlockModel.hpp | 2 | ||||
-rw-r--r-- | ingen/client/GraphModel.hpp | 2 | ||||
-rw-r--r-- | ingen/client/PortModel.hpp | 2 | ||||
-rw-r--r-- | src/Serialiser.cpp | 12 | ||||
-rw-r--r-- | src/server/BlockImpl.hpp | 2 | ||||
-rw-r--r-- | src/server/DuplexPort.cpp | 2 | ||||
-rw-r--r-- | src/server/GraphImpl.hpp | 2 | ||||
-rw-r--r-- | src/server/InputPort.cpp | 2 | ||||
-rw-r--r-- | src/server/PortImpl.cpp | 3 | ||||
-rw-r--r-- | src/server/PortImpl.hpp | 2 |
11 files changed, 11 insertions, 27 deletions
diff --git a/ingen/Node.hpp b/ingen/Node.hpp index e0fcf338..cde50f63 100644 --- a/ingen/Node.hpp +++ b/ingen/Node.hpp @@ -49,12 +49,6 @@ class Store; class INGEN_API Node : public Resource { public: - enum class GraphType { - GRAPH, - BLOCK, - PORT - }; - typedef std::pair<const Node*, const Node*> ArcsKey; typedef std::map< ArcsKey, SPtr<Arc> > Arcs; @@ -71,7 +65,6 @@ public: virtual bool save_state(const std::string& dir) const { return false; } // All objects - virtual GraphType graph_type() const = 0; virtual const Raul::Path& path() const = 0; virtual const Raul::Symbol& symbol() const = 0; diff --git a/ingen/client/BlockModel.hpp b/ingen/client/BlockModel.hpp index e689414c..0fcfce36 100644 --- a/ingen/client/BlockModel.hpp +++ b/ingen/client/BlockModel.hpp @@ -49,8 +49,6 @@ public: BlockModel(const BlockModel& copy); virtual ~BlockModel(); - GraphType graph_type() const { return Node::GraphType::BLOCK; } - typedef std::vector< SPtr<const PortModel> > Ports; SPtr<const PortModel> get_port(const Raul::Symbol& symbol) const; diff --git a/ingen/client/GraphModel.hpp b/ingen/client/GraphModel.hpp index 52c5ed2c..94b365fc 100644 --- a/ingen/client/GraphModel.hpp +++ b/ingen/client/GraphModel.hpp @@ -36,8 +36,6 @@ class INGEN_API GraphModel : public BlockModel public: /* WARNING: Copy constructor creates a shallow copy WRT connections */ - GraphType graph_type() const { return Node::GraphType::GRAPH; } - SPtr<ArcModel> get_arc(const Ingen::Node* tail, const Ingen::Node* head); diff --git a/ingen/client/PortModel.hpp b/ingen/client/PortModel.hpp index f03e5bc1..b29ce652 100644 --- a/ingen/client/PortModel.hpp +++ b/ingen/client/PortModel.hpp @@ -40,8 +40,6 @@ class INGEN_API PortModel : public ObjectModel public: enum class Direction { INPUT, OUTPUT }; - GraphType graph_type() const { return Node::GraphType::PORT; } - bool supports(const URIs::Quark& value_type) const; inline uint32_t index() const { return _index; } 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<const Node> 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<const Node> 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<Node> subgraph = n->second; SerdURI base_uri; @@ -392,7 +394,7 @@ Serialiser::Impl::serialise_graph(SPtr<const Node> 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<const Node> 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<GraphImpl*>(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<GraphImpl*>(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<GraphImpl*>(_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; } |