diff options
author | David Robillard <d@drobilla.net> | 2012-08-19 02:57:26 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-08-19 02:57:26 +0000 |
commit | ba1f169967f64b9657074fba2de803b29829345c (patch) | |
tree | b46baed3c4d96f2129cb58686b09b2b86d86d05e /ingen | |
parent | 800c329a0b77f9044923885abe0728028eca8350 (diff) | |
download | ingen-ba1f169967f64b9657074fba2de803b29829345c.tar.gz ingen-ba1f169967f64b9657074fba2de803b29829345c.tar.bz2 ingen-ba1f169967f64b9657074fba2de803b29829345c.zip |
GraphObject => Node
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4722 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'ingen')
-rw-r--r-- | ingen/Builder.hpp | 6 | ||||
-rw-r--r-- | ingen/LV2Features.hpp | 10 | ||||
-rw-r--r-- | ingen/Node.hpp (renamed from ingen/GraphObject.hpp) | 26 | ||||
-rw-r--r-- | ingen/Store.hpp | 12 | ||||
-rw-r--r-- | ingen/URIMap.hpp | 2 | ||||
-rw-r--r-- | ingen/client/BlockModel.hpp | 8 | ||||
-rw-r--r-- | ingen/client/ClientStore.hpp | 2 | ||||
-rw-r--r-- | ingen/client/GraphModel.hpp | 10 | ||||
-rw-r--r-- | ingen/client/ObjectModel.hpp | 8 | ||||
-rw-r--r-- | ingen/client/PortModel.hpp | 2 | ||||
-rw-r--r-- | ingen/serialisation/Parser.hpp | 4 | ||||
-rw-r--r-- | ingen/serialisation/Serialiser.hpp | 20 |
12 files changed, 59 insertions, 51 deletions
diff --git a/ingen/Builder.hpp b/ingen/Builder.hpp index 168ab841..96096b3d 100644 --- a/ingen/Builder.hpp +++ b/ingen/Builder.hpp @@ -21,8 +21,8 @@ namespace Ingen { -class GraphObject; class Interface; +class Node; class URIs; /** Wrapper for Interface to create existing objects/models. @@ -35,8 +35,8 @@ public: Builder(URIs& uris, Interface& interface); virtual ~Builder() {} - void build(SharedPtr<const GraphObject> object); - void connect(SharedPtr<const GraphObject> object); + void build(SharedPtr<const Node> object); + void connect(SharedPtr<const Node> object); private: URIs& _uris; diff --git a/ingen/LV2Features.hpp b/ingen/LV2Features.hpp index 34c43a79..80339c84 100644 --- a/ingen/LV2Features.hpp +++ b/ingen/LV2Features.hpp @@ -26,7 +26,7 @@ namespace Ingen { -class GraphObject; +class Node; class World; /** Features for use by LV2 plugins. @@ -40,8 +40,8 @@ public: public: virtual ~Feature() {} - virtual SharedPtr<LV2_Feature> feature(World* world, - GraphObject* block) = 0; + virtual SharedPtr<LV2_Feature> feature(World* world, + Node* block) = 0; }; class FeatureArray : public Raul::Noncopyable { @@ -61,8 +61,8 @@ public: void add_feature(SharedPtr<Feature> feature); - SharedPtr<FeatureArray> lv2_features(World* world, - GraphObject* block) const; + SharedPtr<FeatureArray> lv2_features(World* world, + Node* block) const; private: typedef std::vector< SharedPtr<Feature> > Features; diff --git a/ingen/GraphObject.hpp b/ingen/Node.hpp index cca3af45..9ec6abd1 100644 --- a/ingen/GraphObject.hpp +++ b/ingen/Node.hpp @@ -14,8 +14,8 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef INGEN_GRAPHOBJECT_HPP -#define INGEN_GRAPHOBJECT_HPP +#ifndef INGEN_NODE_HPP +#define INGEN_NODE_HPP #include "raul/Path.hpp" #include "raul/SharedPtr.hpp" @@ -33,11 +33,19 @@ class Edge; class Plugin; class Store; -/** An object on the audio graph - Graph, Block, Port, etc. +/** An object on the audio graph. + * + * The key property of nodes is that all nodes have a path and a symbol, as + * well as a URI. + * + * To avoid ugly inheritance issues and the need for excessive use of + * dynamic_cast, this class contains some members which are only applicable to + * certain types of node. There is a type tag which can be used to determine + * the type of any Node. * * @ingroup Ingen */ -class GraphObject : public Resource +class Node : public Resource { public: enum GraphType { @@ -46,7 +54,7 @@ public: PORT }; - typedef std::pair<const GraphObject*, const GraphObject*> EdgesKey; + typedef std::pair<const Node*, const Node*> EdgesKey; typedef std::map< EdgesKey, SharedPtr<Edge> > Edges; // Graphs only @@ -55,14 +63,14 @@ public: // Blocks and graphs only virtual uint32_t num_ports() const { return 0; } - virtual GraphObject* port(uint32_t index) const { return NULL; } + virtual Node* port(uint32_t index) const { return NULL; } virtual const Plugin* plugin() const { return NULL; } // All objects virtual GraphType graph_type() const = 0; virtual const Raul::Path& path() const = 0; virtual const Raul::Symbol& symbol() const = 0; - virtual GraphObject* graph_parent() const = 0; + virtual Node* graph_parent() const = 0; static Raul::URI root_uri() { return Raul::URI("ingen:root"); } @@ -84,7 +92,7 @@ protected: friend class Store; virtual void set_path(const Raul::Path& p) = 0; - GraphObject(URIs& uris, const Raul::Path& path) + Node(URIs& uris, const Raul::Path& path) : Resource(uris, path_to_uri(path)) {} @@ -93,4 +101,4 @@ protected: } // namespace Ingen -#endif // INGEN_GRAPHOBJECT_HPP +#endif // INGEN_NODE_HPP diff --git a/ingen/Store.hpp b/ingen/Store.hpp index 1f329484..c176cdd3 100644 --- a/ingen/Store.hpp +++ b/ingen/Store.hpp @@ -22,7 +22,7 @@ #undef nil #include <glibmm/thread.h> -#include "ingen/GraphObject.hpp" +#include "ingen/Node.hpp" #include "raul/Deletable.hpp" #include "raul/Noncopyable.hpp" @@ -33,23 +33,23 @@ namespace Ingen { */ class Store : public Raul::Noncopyable , public Raul::Deletable - , public std::map< const Raul::Path, SharedPtr<GraphObject> > { + , public std::map< const Raul::Path, SharedPtr<Node> > { public: - void add(GraphObject* o); + void add(Node* o); - GraphObject* get(const Raul::Path& path) { + Node* get(const Raul::Path& path) { const iterator i = find(path); return (i == end()) ? NULL : i->second.get(); } typedef std::pair<const_iterator, const_iterator> const_range; - typedef std::map< Raul::Path, SharedPtr<GraphObject> > Objects; + typedef std::map< Raul::Path, SharedPtr<Node> > Objects; iterator find_descendants_end(Store::iterator parent); const_iterator find_descendants_end(Store::const_iterator parent) const; - const_range children_range(SharedPtr<const GraphObject> o) const; + const_range children_range(SharedPtr<const Node> o) const; /** Remove the object at @p top and all its children from the store. * diff --git a/ingen/URIMap.hpp b/ingen/URIMap.hpp index d519b564..5f3aca63 100644 --- a/ingen/URIMap.hpp +++ b/ingen/URIMap.hpp @@ -46,7 +46,7 @@ public: _feature.data = data; } - SharedPtr<LV2_Feature> feature(World*, GraphObject*) { + SharedPtr<LV2_Feature> feature(World*, Node*) { return SharedPtr<LV2_Feature>(&_feature, NullDeleter<LV2_Feature>); } diff --git a/ingen/client/BlockModel.hpp b/ingen/client/BlockModel.hpp index d0bae8de..65d632d5 100644 --- a/ingen/client/BlockModel.hpp +++ b/ingen/client/BlockModel.hpp @@ -22,10 +22,10 @@ #include <vector> #include "raul/SharedPtr.hpp" -#include "ingen/GraphObject.hpp" +#include "ingen/Node.hpp" #include "ingen/client/ObjectModel.hpp" -#include "ingen/client/PortModel.hpp" #include "ingen/client/PluginModel.hpp" +#include "ingen/client/PortModel.hpp" namespace Raul { class Path; } @@ -48,13 +48,13 @@ public: BlockModel(const BlockModel& copy); virtual ~BlockModel(); - GraphType graph_type() const { return GraphObject::GRAPH; } + GraphType graph_type() const { return Node::GRAPH; } typedef std::vector< SharedPtr<const PortModel> > Ports; SharedPtr<const PortModel> get_port(const Raul::Symbol& symbol) const; - GraphObject* port(uint32_t index) const; + Node* 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/ClientStore.hpp b/ingen/client/ClientStore.hpp index e7e6105b..2ca25dde 100644 --- a/ingen/client/ClientStore.hpp +++ b/ingen/client/ClientStore.hpp @@ -31,8 +31,8 @@ namespace Raul { class Atom; } namespace Ingen { -class GraphObject; class Log; +class Node; class URIs; namespace Client { diff --git a/ingen/client/GraphModel.hpp b/ingen/client/GraphModel.hpp index 03a41891..d527eb82 100644 --- a/ingen/client/GraphModel.hpp +++ b/ingen/client/GraphModel.hpp @@ -35,10 +35,10 @@ class GraphModel : public BlockModel public: /* WARNING: Copy constructor creates a shallow copy WRT connections */ - GraphType graph_type() const { return GraphObject::GRAPH; } + GraphType graph_type() const { return Node::GRAPH; } - SharedPtr<EdgeModel> get_edge(const Ingen::GraphObject* tail, - const Ingen::GraphObject* head); + SharedPtr<EdgeModel> get_edge(const Ingen::Node* tail, + const Ingen::Node* head); bool enabled() const; bool polyphonic() const; @@ -62,8 +62,8 @@ private: bool remove_child(SharedPtr<ObjectModel> c); void add_edge(SharedPtr<EdgeModel> cm); - void remove_edge(const Ingen::GraphObject* tail, - const Ingen::GraphObject* head); + void remove_edge(const Ingen::Node* tail, + const Ingen::Node* head); }; } // namespace Client diff --git a/ingen/client/ObjectModel.hpp b/ingen/client/ObjectModel.hpp index c9f4e6d1..60e873e4 100644 --- a/ingen/client/ObjectModel.hpp +++ b/ingen/client/ObjectModel.hpp @@ -29,7 +29,7 @@ #include "raul/SharedPtr.hpp" #include "raul/URI.hpp" -#include "ingen/GraphObject.hpp" +#include "ingen/Node.hpp" #include "ingen/Resource.hpp" #include "ingen/client/signal.hpp" @@ -41,7 +41,7 @@ namespace Client { class ClientStore; -/** Base class for all GraphObject models (BlockModel, GraphModel, PortModel). +/** Base class for all Node models (BlockModel, GraphModel, PortModel). * * There are no non-const public methods intentionally, models are not allowed * to be manipulated directly by anything (but the Store) because of the @@ -52,7 +52,7 @@ class ClientStore; * * @ingroup IngenClient */ -class ObjectModel : public GraphObject +class ObjectModel : public Node { public: virtual ~ObjectModel(); @@ -68,7 +68,7 @@ public: SharedPtr<ObjectModel> parent() const { return _parent; } bool polyphonic() const; - GraphObject* graph_parent() const { return _parent.get(); } + Node* graph_parent() const { return _parent.get(); } // Signals INGEN_SIGNAL(new_child, void, SharedPtr<ObjectModel>); diff --git a/ingen/client/PortModel.hpp b/ingen/client/PortModel.hpp index bfc56a9d..675cc827 100644 --- a/ingen/client/PortModel.hpp +++ b/ingen/client/PortModel.hpp @@ -41,7 +41,7 @@ class PortModel : public ObjectModel public: enum Direction { INPUT, OUTPUT }; - GraphType graph_type() const { return GraphObject::PORT; } + GraphType graph_type() const { return Node::PORT; } bool supports(const Raul::URI& value_type) const; diff --git a/ingen/serialisation/Parser.hpp b/ingen/serialisation/Parser.hpp index 666d9acb..6ece6965 100644 --- a/ingen/serialisation/Parser.hpp +++ b/ingen/serialisation/Parser.hpp @@ -27,7 +27,7 @@ #include <boost/optional.hpp> #include <glibmm/ustring.h> -#include "ingen/GraphObject.hpp" +#include "ingen/Node.hpp" #include "raul/Path.hpp" namespace Ingen { @@ -48,7 +48,7 @@ public: virtual ~Parser() {} - typedef GraphObject::Properties Properties; + typedef Node::Properties Properties; virtual bool parse_file( World* world, diff --git a/ingen/serialisation/Serialiser.hpp b/ingen/serialisation/Serialiser.hpp index ae18693e..a694e800 100644 --- a/ingen/serialisation/Serialiser.hpp +++ b/ingen/serialisation/Serialiser.hpp @@ -25,12 +25,12 @@ #include "sord/sordmm.hpp" -#include "ingen/GraphObject.hpp" +#include "ingen/Node.hpp" namespace Ingen { class Edge; -class GraphObject; +class Node; class Store; class World; @@ -47,21 +47,21 @@ public: explicit Serialiser(World& world); virtual ~Serialiser(); - typedef GraphObject::Properties Properties; + typedef Node::Properties Properties; - virtual void to_file(SharedPtr<const GraphObject> object, - const std::string& filename); + virtual void to_file(SharedPtr<const Node> object, + const std::string& filename); - virtual void write_bundle(SharedPtr<const GraphObject> graph, - const std::string& path); + virtual void write_bundle(SharedPtr<const Node> graph, + const std::string& path); - virtual std::string to_string(SharedPtr<const GraphObject> object, - const std::string& base_uri); + virtual std::string to_string(SharedPtr<const Node> object, + const std::string& base_uri); virtual void start_to_string(const Raul::Path& root, const std::string& base_uri); - virtual void serialise(SharedPtr<const GraphObject> object) + virtual void serialise(SharedPtr<const Node> object) throw (std::logic_error); virtual void serialise_edge(const Sord::Node& parent, |