From ba1f169967f64b9657074fba2de803b29829345c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 19 Aug 2012 02:57:26 +0000 Subject: GraphObject => Node git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4722 a436a847-0d15-0410-975c-d299462d15a1 --- bundles/ingen.lv2/ingen.ttl | 32 +++++------ ingen/Builder.hpp | 6 +- ingen/GraphObject.hpp | 96 -------------------------------- ingen/LV2Features.hpp | 10 ++-- ingen/Node.hpp | 104 ++++++++++++++++++++++++++++++++++ ingen/Store.hpp | 12 ++-- ingen/URIMap.hpp | 2 +- ingen/client/BlockModel.hpp | 8 +-- ingen/client/ClientStore.hpp | 2 +- ingen/client/GraphModel.hpp | 10 ++-- ingen/client/ObjectModel.hpp | 8 +-- ingen/client/PortModel.hpp | 2 +- ingen/serialisation/Parser.hpp | 4 +- ingen/serialisation/Serialiser.hpp | 20 +++---- src/AtomReader.cpp | 6 +- src/AtomWriter.cpp | 16 +++--- src/Builder.cpp | 10 ++-- src/ClashAvoider.cpp | 4 +- src/LV2Features.cpp | 2 +- src/Store.cpp | 4 +- src/client/BlockModel.cpp | 6 +- src/client/ClientStore.cpp | 16 +++--- src/client/GraphModel.cpp | 4 +- src/client/ObjectModel.cpp | 8 +-- src/gui/ConnectWindow.cpp | 2 +- src/gui/GraphCanvas.cpp | 20 +++---- src/gui/GraphCanvas.hpp | 4 +- src/gui/GraphPortModule.cpp | 2 +- src/gui/GraphView.cpp | 2 +- src/gui/LoadGraphWindow.cpp | 2 +- src/gui/LoadGraphWindow.hpp | 6 +- src/gui/LoadPluginWindow.cpp | 4 +- src/gui/LoadPluginWindow.hpp | 6 +- src/gui/NewSubgraphWindow.cpp | 6 +- src/gui/NewSubgraphWindow.hpp | 6 +- src/gui/NodeMenu.cpp | 2 +- src/gui/NodeModule.cpp | 2 +- src/gui/PortMenu.cpp | 2 +- src/gui/RenameWindow.cpp | 2 +- src/gui/ThreadedLoader.cpp | 10 ++-- src/gui/ThreadedLoader.hpp | 10 ++-- src/gui/WindowFactory.cpp | 8 +-- src/gui/WindowFactory.hpp | 4 +- src/gui/ingen_gui_lv2.cpp | 4 +- src/ingen/main.cpp | 2 +- src/serialisation/Parser.cpp | 94 +++++++++++++++---------------- src/serialisation/Serialiser.cpp | 104 +++++++++++++++++----------------- src/server/BlockImpl.cpp | 4 +- src/server/BlockImpl.hpp | 8 +-- src/server/Context.hpp | 4 +- src/server/Driver.hpp | 6 +- src/server/Engine.cpp | 2 +- src/server/Event.hpp | 4 +- src/server/GraphObjectImpl.cpp | 52 ----------------- src/server/GraphObjectImpl.hpp | 108 ------------------------------------ src/server/InputPort.cpp | 2 +- src/server/JackDriver.cpp | 2 +- src/server/LV2ResizeFeature.hpp | 2 +- src/server/NodeImpl.cpp | 52 +++++++++++++++++ src/server/NodeImpl.hpp | 108 ++++++++++++++++++++++++++++++++++++ src/server/OutputPort.cpp | 2 +- src/server/PortImpl.cpp | 2 +- src/server/PortImpl.hpp | 4 +- src/server/Worker.cpp | 2 +- src/server/Worker.hpp | 2 +- src/server/events/Connect.cpp | 4 +- src/server/events/CreateGraph.cpp | 2 +- src/server/events/CreatePort.cpp | 4 +- src/server/events/Delete.cpp | 4 +- src/server/events/Delta.cpp | 14 ++--- src/server/events/DisconnectAll.cpp | 10 ++-- src/server/events/DisconnectAll.hpp | 6 +- src/server/events/Get.cpp | 6 +- src/server/events/Get.hpp | 2 +- src/server/wscript | 2 +- 75 files changed, 561 insertions(+), 555 deletions(-) delete mode 100644 ingen/GraphObject.hpp create mode 100644 ingen/Node.hpp delete mode 100644 src/server/GraphObjectImpl.cpp delete mode 100644 src/server/GraphObjectImpl.hpp create mode 100644 src/server/NodeImpl.cpp create mode 100644 src/server/NodeImpl.hpp diff --git a/bundles/ingen.lv2/ingen.ttl b/bundles/ingen.lv2/ingen.ttl index bf35f46a..d4de601a 100644 --- a/bundles/ingen.lv2/ingen.ttl +++ b/bundles/ingen.lv2/ingen.ttl @@ -76,34 +76,34 @@ ingen:value rdfs:label "Value" ; rdfs:comment "The current value of a port." . -ingen:Object +ingen:Node a owl:Class ; - rdfs:label "Ingen Object" ; + rdfs:label "Ingen Node" ; rdfs:comment """ -A signal processing object which is part of a Graph. An Object MUST have -exactly one lv2:symbol property. This MAY be inferred from the URI where -possible (e.g. in a system which publishes block URIs in a heirarchial way -such that the parent can be 'chopped' to get a legal symbol). +An element of a Graph. A Node always has a valid path and symbol, with the +possible exception of the root graph which may not have a symbol depending on +context. Ingen uses restricted paths and/or URIs built from valid lv2:symbol +components, so the symbol of a Node may be inferred from its URI if no explicit +lv2:symbol property is given. """ . ingen:polyphonic a owl:DatatypeProperty ; - rdfs:domain ingen:Object ; + rdfs:domain ingen:Node ; rdfs:range xsd:boolean ; rdfs:label "Polyphonic" ; rdfs:comment """ -Signifies this object should be replicated when it is part of a polyphonic -graph. The amount of polyphony (i.e. the number of voices) is determined -by the :polyphony property of the containing graph. This is a boolean -property which defines whether the parent can access each voice individuall: -All objects within a graph are either polyphonic or not from their parent's -perspective. An Object may itself have "internal" polyphony but not be -polyphonic according to this property, if those voices are mixed down. -""" . +Signifies this node should be replicated when it is part of a polyphonic graph. +The amount of polyphony (i.e. the number of voices) is determined by the +ingen:polyphony property of the containing graph. This is a boolean property +which defines whether the parent can access each voice individually: All nodes +within a graph are either polyphonic or not from their parent's perspective. +An Node may itself have "internal" polyphony but not be polyphonic according to +this property, if those voices are mixed down. """ . ingen:Block a owl:Class ; - rdfs:subClassOf ingen:Object , + rdfs:subClassOf ingen:Node , lv2:PluginBase ; rdfs:label "Block" ; rdfs:comment """ 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 object); - void connect(SharedPtr object); + void build(SharedPtr object); + void connect(SharedPtr object); private: URIs& _uris; diff --git a/ingen/GraphObject.hpp b/ingen/GraphObject.hpp deleted file mode 100644 index cca3af45..00000000 --- a/ingen/GraphObject.hpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_GRAPHOBJECT_HPP -#define INGEN_GRAPHOBJECT_HPP - -#include "raul/Path.hpp" -#include "raul/SharedPtr.hpp" -#include "ingen/Resource.hpp" - -namespace Raul { -class Atom; -class Path; -class Symbol; -} - -namespace Ingen { - -class Edge; -class Plugin; -class Store; - -/** An object on the audio graph - Graph, Block, Port, etc. - * - * @ingroup Ingen - */ -class GraphObject : public Resource -{ -public: - enum GraphType { - GRAPH, - BLOCK, - PORT - }; - - typedef std::pair EdgesKey; - typedef std::map< EdgesKey, SharedPtr > Edges; - - // Graphs only - Edges& edges() { return _edges; } - const Edges& edges() const { return _edges; } - - // Blocks and graphs only - virtual uint32_t num_ports() const { return 0; } - virtual GraphObject* 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; - - static Raul::URI root_uri() { return Raul::URI("ingen:root"); } - - static bool uri_is_path(const Raul::URI& uri) { - return uri.substr(0, root_uri().length()) == root_uri(); - } - - static Raul::Path uri_to_path(const Raul::URI& uri) { - return (uri == root_uri()) - ? Raul::Path("/") - : Raul::Path(uri.substr(root_uri().length())); - } - - static Raul::URI path_to_uri(const Raul::Path& path) { - return Raul::URI(root_uri() + path.c_str()); - } - -protected: - friend class Store; - virtual void set_path(const Raul::Path& p) = 0; - - GraphObject(URIs& uris, const Raul::Path& path) - : Resource(uris, path_to_uri(path)) - {} - - Edges _edges; ///< Graphs only -}; - -} // namespace Ingen - -#endif // INGEN_GRAPHOBJECT_HPP 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 feature(World* world, - GraphObject* block) = 0; + virtual SharedPtr feature(World* world, + Node* block) = 0; }; class FeatureArray : public Raul::Noncopyable { @@ -61,8 +61,8 @@ public: void add_feature(SharedPtr feature); - SharedPtr lv2_features(World* world, - GraphObject* block) const; + SharedPtr lv2_features(World* world, + Node* block) const; private: typedef std::vector< SharedPtr > Features; diff --git a/ingen/Node.hpp b/ingen/Node.hpp new file mode 100644 index 00000000..9ec6abd1 --- /dev/null +++ b/ingen/Node.hpp @@ -0,0 +1,104 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_NODE_HPP +#define INGEN_NODE_HPP + +#include "raul/Path.hpp" +#include "raul/SharedPtr.hpp" +#include "ingen/Resource.hpp" + +namespace Raul { +class Atom; +class Path; +class Symbol; +} + +namespace Ingen { + +class Edge; +class Plugin; +class Store; + +/** 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 Node : public Resource +{ +public: + enum GraphType { + GRAPH, + BLOCK, + PORT + }; + + typedef std::pair EdgesKey; + typedef std::map< EdgesKey, SharedPtr > Edges; + + // Graphs only + Edges& edges() { return _edges; } + const Edges& edges() const { return _edges; } + + // Blocks and graphs only + virtual uint32_t num_ports() const { return 0; } + 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 Node* graph_parent() const = 0; + + static Raul::URI root_uri() { return Raul::URI("ingen:root"); } + + static bool uri_is_path(const Raul::URI& uri) { + return uri.substr(0, root_uri().length()) == root_uri(); + } + + static Raul::Path uri_to_path(const Raul::URI& uri) { + return (uri == root_uri()) + ? Raul::Path("/") + : Raul::Path(uri.substr(root_uri().length())); + } + + static Raul::URI path_to_uri(const Raul::Path& path) { + return Raul::URI(root_uri() + path.c_str()); + } + +protected: + friend class Store; + virtual void set_path(const Raul::Path& p) = 0; + + Node(URIs& uris, const Raul::Path& path) + : Resource(uris, path_to_uri(path)) + {} + + Edges _edges; ///< Graphs only +}; + +} // namespace Ingen + +#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 -#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 > { + , public std::map< const Raul::Path, SharedPtr > { 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_range; - typedef std::map< Raul::Path, SharedPtr > Objects; + typedef std::map< Raul::Path, SharedPtr > Objects; iterator find_descendants_end(Store::iterator parent); const_iterator find_descendants_end(Store::const_iterator parent) const; - const_range children_range(SharedPtr o) const; + const_range children_range(SharedPtr 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 feature(World*, GraphObject*) { + SharedPtr feature(World*, Node*) { return SharedPtr(&_feature, NullDeleter); } 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 #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 > Ports; SharedPtr 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 get_edge(const Ingen::GraphObject* tail, - const Ingen::GraphObject* head); + SharedPtr 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 c); void add_edge(SharedPtr 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 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); 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 #include -#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 object, - const std::string& filename); + virtual void to_file(SharedPtr object, + const std::string& filename); - virtual void write_bundle(SharedPtr graph, - const std::string& path); + virtual void write_bundle(SharedPtr graph, + const std::string& path); - virtual std::string to_string(SharedPtr object, - const std::string& base_uri); + virtual std::string to_string(SharedPtr object, + const std::string& base_uri); virtual void start_to_string(const Raul::Path& root, const std::string& base_uri); - virtual void serialise(SharedPtr object) + virtual void serialise(SharedPtr object) throw (std::logic_error); virtual void serialise_edge(const Sord::Node& parent, diff --git a/src/AtomReader.cpp b/src/AtomReader.cpp index 712f8dd2..8e0d296d 100644 --- a/src/AtomReader.cpp +++ b/src/AtomReader.cpp @@ -17,8 +17,8 @@ #include #include "ingen/AtomReader.hpp" -#include "ingen/GraphObject.hpp" #include "ingen/Log.hpp" +#include "ingen/Node.hpp" #include "ingen/URIMap.hpp" #include "lv2/lv2plug.in/ns/ext/atom/util.h" #include "raul/Path.hpp" @@ -90,8 +90,8 @@ AtomReader::atom_to_path(const LV2_Atom* atom) { const char* uri_str = atom_to_uri(atom); if (uri_str && Raul::URI::is_valid(uri_str) && - GraphObject::uri_is_path(Raul::URI(uri_str))) { - return GraphObject::uri_to_path(Raul::URI(uri_str)); + Node::uri_is_path(Raul::URI(uri_str))) { + return Node::uri_to_path(Raul::URI(uri_str)); } return boost::optional(); } diff --git a/src/AtomWriter.cpp b/src/AtomWriter.cpp index 34ea62d0..f102c8a8 100644 --- a/src/AtomWriter.cpp +++ b/src/AtomWriter.cpp @@ -18,7 +18,7 @@ #include "ingen/AtomSink.hpp" #include "ingen/AtomWriter.hpp" -#include "ingen/GraphObject.hpp" +#include "ingen/Node.hpp" #include "ingen/URIMap.hpp" #include "raul/Path.hpp" #include "serd/serd.h" @@ -113,9 +113,9 @@ AtomWriter::forge_edge(const Raul::Path& tail, const Raul::Path& head) LV2_Atom_Forge_Frame edge; lv2_atom_forge_blank(&_forge, &edge, 0, _uris.ingen_Edge); lv2_atom_forge_property_head(&_forge, _uris.ingen_tail, 0); - forge_uri(GraphObject::path_to_uri(tail)); + forge_uri(Node::path_to_uri(tail)); lv2_atom_forge_property_head(&_forge, _uris.ingen_head, 0); - forge_uri(GraphObject::path_to_uri(head)); + forge_uri(Node::path_to_uri(head)); lv2_atom_forge_pop(&_forge, &edge); } @@ -172,9 +172,9 @@ AtomWriter::move(const Raul::Path& old_path, LV2_Atom_Forge_Frame msg; lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Move); lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); - forge_uri(GraphObject::path_to_uri(old_path)); + forge_uri(Node::path_to_uri(old_path)); lv2_atom_forge_property_head(&_forge, _uris.patch_destination, 0); - forge_uri(GraphObject::path_to_uri(new_path)); + forge_uri(Node::path_to_uri(new_path)); } void @@ -193,7 +193,7 @@ AtomWriter::connect(const Raul::Path& tail, LV2_Atom_Forge_Frame msg; lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Put); lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); - forge_uri(GraphObject::path_to_uri(Raul::Path::lca(tail, head))); + forge_uri(Node::path_to_uri(Raul::Path::lca(tail, head))); lv2_atom_forge_property_head(&_forge, _uris.patch_body, 0); forge_edge(tail, head); lv2_atom_forge_pop(&_forge, &msg); @@ -220,13 +220,13 @@ AtomWriter::disconnect_all(const Raul::Path& graph, lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Delete); lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); - forge_uri(GraphObject::path_to_uri(graph)); + forge_uri(Node::path_to_uri(graph)); lv2_atom_forge_property_head(&_forge, _uris.patch_body, 0); LV2_Atom_Forge_Frame edge; lv2_atom_forge_blank(&_forge, &edge, 0, _uris.ingen_Edge); lv2_atom_forge_property_head(&_forge, _uris.ingen_incidentTo, 0); - forge_uri(GraphObject::path_to_uri(path)); + forge_uri(Node::path_to_uri(path)); lv2_atom_forge_pop(&_forge, &edge); lv2_atom_forge_pop(&_forge, &msg); diff --git a/src/Builder.cpp b/src/Builder.cpp index 49f5d76b..023f22cd 100644 --- a/src/Builder.cpp +++ b/src/Builder.cpp @@ -16,8 +16,8 @@ #include "ingen/Builder.hpp" #include "ingen/Edge.hpp" -#include "ingen/GraphObject.hpp" #include "ingen/Interface.hpp" +#include "ingen/Node.hpp" #include "ingen/URIs.hpp" #include "raul/Atom.hpp" #include "raul/Path.hpp" @@ -33,16 +33,16 @@ Builder::Builder(URIs& uris, Interface& interface) } void -Builder::build(SharedPtr object) +Builder::build(SharedPtr object) { _interface.put(object->uri(), object->properties()); } void -Builder::connect(SharedPtr object) +Builder::connect(SharedPtr object) { - if (object->graph_type() == GraphObject::GRAPH) { - for (GraphObject::Edges::const_iterator i = object->edges().begin(); + if (object->graph_type() == Node::GRAPH) { + for (Node::Edges::const_iterator i = object->edges().begin(); i != object->edges().end(); ++i) { _interface.connect(i->second->tail_path(), i->second->head_path()); } diff --git a/src/ClashAvoider.cpp b/src/ClashAvoider.cpp index fce60291..9cafa06a 100644 --- a/src/ClashAvoider.cpp +++ b/src/ClashAvoider.cpp @@ -29,8 +29,8 @@ namespace Ingen { const Raul::URI ClashAvoider::map_uri(const Raul::URI& in) { - if (GraphObject::uri_is_path(in)) { - return GraphObject::path_to_uri(map_path(GraphObject::uri_to_path(in))); + if (Node::uri_is_path(in)) { + return Node::path_to_uri(map_path(Node::uri_to_path(in))); } else { return in; } diff --git a/src/LV2Features.cpp b/src/LV2Features.cpp index 9846dd80..122f794e 100644 --- a/src/LV2Features.cpp +++ b/src/LV2Features.cpp @@ -48,7 +48,7 @@ LV2Features::FeatureArray::~FeatureArray() } SharedPtr -LV2Features::lv2_features(World* world, GraphObject* node) const +LV2Features::lv2_features(World* world, Node* node) const { FeatureArray::FeatureVector vec; for (Features::const_iterator f = _features.begin(); f != _features.end(); ++f) { diff --git a/src/Store.cpp b/src/Store.cpp index ae40bcc5..87a0315e 100644 --- a/src/Store.cpp +++ b/src/Store.cpp @@ -23,7 +23,7 @@ using namespace std; namespace Ingen { void -Store::add(GraphObject* o) +Store::add(Node* o) { if (find(o->path()) != end()) { return; @@ -72,7 +72,7 @@ Store::find_descendants_end(const const_iterator parent) const } Store::const_range -Store::children_range(SharedPtr o) const +Store::children_range(SharedPtr o) const { const const_iterator parent = find(o->path()); if (parent != end()) { diff --git a/src/client/BlockModel.cpp b/src/client/BlockModel.cpp index 865f081c..cacba04c 100644 --- a/src/client/BlockModel.cpp +++ b/src/client/BlockModel.cpp @@ -149,12 +149,12 @@ BlockModel::get_port(const Raul::Symbol& symbol) const return SharedPtr(); } -Ingen::GraphObject* +Ingen::Node* BlockModel::port(uint32_t index) const { assert(index < num_ports()); - return const_cast( - dynamic_cast(_ports[index].get())); + return const_cast( + dynamic_cast(_ports[index].get())); } void diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 6d4cbfd4..20928d33 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -165,8 +165,8 @@ ClientStore::object(const Raul::Path& path) const SharedPtr ClientStore::_resource(const Raul::URI& uri) { - if (GraphObject::uri_is_path(uri)) { - return _object(GraphObject::uri_to_path(uri)); + if (Node::uri_is_path(uri)) { + return _object(Node::uri_to_path(uri)); } else { return _plugin(uri); } @@ -195,8 +195,8 @@ ClientStore::add_plugin(SharedPtr pm) void ClientStore::del(const Raul::URI& uri) { - if (GraphObject::uri_is_path(uri)) { - remove_object(GraphObject::uri_to_path(uri)); + if (Node::uri_is_path(uri)) { + remove_object(Node::uri_to_path(uri)); } } @@ -243,13 +243,13 @@ ClientStore::put(const Raul::URI& uri, } } - if (!GraphObject::uri_is_path(uri)) { + if (!Node::uri_is_path(uri)) { _log.error(Raul::fmt("Put for unknown subject <%1%>\n") % uri.c_str()); return; } - const Raul::Path path(GraphObject::uri_to_path(uri)); + const Raul::Path path(Node::uri_to_path(uri)); SharedPtr obj = PtrCast(_object(path)); if (obj) { @@ -326,13 +326,13 @@ ClientStore::delta(const Raul::URI& uri, std::cerr << "}" << endl; #endif - if (!GraphObject::uri_is_path(uri)) { + if (!Node::uri_is_path(uri)) { _log.error(Raul::fmt("Delta for unknown subject <%1%>\n") % uri.c_str()); return; } - const Raul::Path path(GraphObject::uri_to_path(uri)); + const Raul::Path path(Node::uri_to_path(uri)); SharedPtr obj = _object(path); if (obj) { diff --git a/src/client/GraphModel.cpp b/src/client/GraphModel.cpp index 88943978..fe838725 100644 --- a/src/client/GraphModel.cpp +++ b/src/client/GraphModel.cpp @@ -93,7 +93,7 @@ GraphModel::clear() } SharedPtr -GraphModel::get_edge(const GraphObject* tail, const GraphObject* head) +GraphModel::get_edge(const Node* tail, const Node* head) { Edges::iterator i = _edges.find(make_pair(tail, head)); if (i != _edges.end()) @@ -138,7 +138,7 @@ GraphModel::add_edge(SharedPtr cm) } void -GraphModel::remove_edge(const GraphObject* tail, const GraphObject* head) +GraphModel::remove_edge(const Node* tail, const Node* head) { Edges::iterator i = _edges.find(make_pair(tail, head)); if (i != _edges.end()) { diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp index fb077a94..5c2bae00 100644 --- a/src/client/ObjectModel.cpp +++ b/src/client/ObjectModel.cpp @@ -14,22 +14,22 @@ along with Ingen. If not, see . */ -#include "ingen/GraphObject.hpp" -#include "ingen/client/ObjectModel.hpp" +#include "ingen/Node.hpp" #include "ingen/URIs.hpp" +#include "ingen/client/ObjectModel.hpp" namespace Ingen { namespace Client { ObjectModel::ObjectModel(URIs& uris, const Raul::Path& path) - : GraphObject(uris, path) + : Node(uris, path) , _path(path) , _symbol((path == "/") ? "root" : path.symbol()) { } ObjectModel::ObjectModel(const ObjectModel& copy) - : GraphObject(copy) + : Node(copy) , _parent(copy._parent) , _path(copy._path) , _symbol(copy._symbol) diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index 73874449..97ffe03e 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -412,7 +412,7 @@ ConnectWindow::gtk_callback() } } } else if (_connect_stage == 2) { - _app->interface()->get(GraphObject::root_uri()); + _app->interface()->get(Node::root_uri()); if (_widgets_loaded) _progress_label->set_text(string("Requesting root graph...")); ++_connect_stage; diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index e6fe3db7..d6c4d01b 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -724,13 +724,13 @@ GraphCanvas::paste() uris.ingen_Graph)); props.insert(make_pair(uris.ingen_polyphony, _app.forge().make(int32_t(_graph->internal_poly())))); - clipboard.put(GraphObject::root_uri(), props); + clipboard.put(Node::root_uri(), props); size_t first_slash; while (to_create != "/" && !to_create.empty() && (first_slash = to_create.find("/")) != string::npos) { created += to_create.substr(0, first_slash); assert(Raul::Path::is_valid(created)); - clipboard.put(GraphObject::path_to_uri(Raul::Path(created)), props); + clipboard.put(Node::path_to_uri(Raul::Path(created)), props); to_create = to_create.substr(first_slash + 1); } @@ -753,14 +753,14 @@ GraphCanvas::paste() if (_graph->path().is_root() && i->first.is_root()) continue; - GraphObject::Properties& props = i->second->properties(); + Node::Properties& props = i->second->properties(); - GraphObject::Properties::iterator x = props.find(uris.ingen_canvasX); + Node::Properties::iterator x = props.find(uris.ingen_canvasX); if (x != i->second->properties().end()) x->second = _app.forge().make( x->second.get_float() + (20.0f * _paste_count)); - GraphObject::Properties::iterator y = props.find(uris.ingen_canvasY); + Node::Properties::iterator y = props.find(uris.ingen_canvasY); if (y != i->second->properties().end()) y->second = _app.forge().make( y->second.get_float() + (20.0f * _paste_count)); @@ -818,7 +818,7 @@ GraphCanvas::menu_add_port(const string& sym_base, const string& name_base, _app.forge().make(int32_t(_graph->num_ports())))); props.insert(make_pair(uris.lv2_name, _app.forge().alloc(name.c_str()))); - _app.interface()->put(GraphObject::path_to_uri(path), props); + _app.interface()->put(Node::path_to_uri(path), props); } void @@ -840,11 +840,11 @@ GraphCanvas::load_plugin(WeakPtr weak_plugin) const Raul::Path path = _graph->path().child(symbol); // FIXME: polyphony? - GraphObject::Properties props = get_initial_data(); + Node::Properties props = get_initial_data(); props.insert(make_pair(uris.rdf_type, uris.ingen_Block)); props.insert(make_pair(uris.ingen_prototype, uris.forge.alloc_uri(plugin->uri()))); - _app.interface()->put(GraphObject::path_to_uri(path), props); + _app.interface()->put(Node::path_to_uri(path), props); } /** Try to guess a suitable location for a new module. @@ -859,10 +859,10 @@ GraphCanvas::get_new_module_location(double& x, double& y) y = scroll_y + 20; } -GraphObject::Properties +Node::Properties GraphCanvas::get_initial_data(Resource::Graph ctx) { - GraphObject::Properties result; + Node::Properties result; const URIs& uris = _app.uris(); result.insert( make_pair(uris.ingen_canvasX, diff --git a/src/gui/GraphCanvas.hpp b/src/gui/GraphCanvas.hpp index 9144518a..5151476e 100644 --- a/src/gui/GraphCanvas.hpp +++ b/src/gui/GraphCanvas.hpp @@ -31,7 +31,7 @@ #include "raul/Path.hpp" #include "NodeModule.hpp" -#include "ingen/GraphObject.hpp" +#include "ingen/Node.hpp" #include "ingen/client/EdgeModel.hpp" namespace Ingen { @@ -113,7 +113,7 @@ private: const LV2Children& children, std::set& ancestors); - GraphObject::Properties get_initial_data(Resource::Graph ctx=Resource::DEFAULT); + Node::Properties get_initial_data(Resource::Graph ctx=Resource::DEFAULT); Ganv::Port* get_port_view(SharedPtr port); diff --git a/src/gui/GraphPortModule.cpp b/src/gui/GraphPortModule.cpp index 38735088..443626dc 100644 --- a/src/gui/GraphPortModule.cpp +++ b/src/gui/GraphPortModule.cpp @@ -69,7 +69,7 @@ GraphPortModule::create(GraphCanvas& canvas, ret->set_port(port); - for (GraphObject::Properties::const_iterator m = model->properties().begin(); + for (Resource::Properties::const_iterator m = model->properties().begin(); m != model->properties().end(); ++m) ret->property_changed(m->first, m->second); diff --git a/src/gui/GraphView.cpp b/src/gui/GraphView.cpp index 119438e6..9a755ffe 100644 --- a/src/gui/GraphView.cpp +++ b/src/gui/GraphView.cpp @@ -83,7 +83,7 @@ GraphView::set_graph(SharedPtr graph) _poly_spin->set_increments(1, 4); _poly_spin->set_value(graph->internal_poly()); - for (GraphObject::Properties::const_iterator i = graph->properties().begin(); + for (Node::Properties::const_iterator i = graph->properties().begin(); i != graph->properties().end(); ++i) property_changed(i->first, i->second); diff --git a/src/gui/LoadGraphWindow.cpp b/src/gui/LoadGraphWindow.cpp index 9f4dde5c..b5297c86 100644 --- a/src/gui/LoadGraphWindow.cpp +++ b/src/gui/LoadGraphWindow.cpp @@ -96,7 +96,7 @@ LoadGraphWindow::LoadGraphWindow(BaseObjectType* cobject, void LoadGraphWindow::present(SharedPtr graph, bool import, - GraphObject::Properties data) + Node::Properties data) { _import = import; set_graph(graph); diff --git a/src/gui/LoadGraphWindow.hpp b/src/gui/LoadGraphWindow.hpp index 2af8e9d2..64ebe99b 100644 --- a/src/gui/LoadGraphWindow.hpp +++ b/src/gui/LoadGraphWindow.hpp @@ -27,7 +27,7 @@ #include "raul/SharedPtr.hpp" -#include "ingen/GraphObject.hpp" +#include "ingen/Node.hpp" namespace Ingen { @@ -53,7 +53,7 @@ public: void present(SharedPtr graph, bool import, - GraphObject::Properties data); + Node::Properties data); protected: void on_show(); @@ -71,7 +71,7 @@ private: App* _app; - GraphObject::Properties _initial_data; + Node::Properties _initial_data; SharedPtr _graph; diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index c3e5b580..bc41352c 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -116,7 +116,7 @@ LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, void LoadPluginWindow::present(SharedPtr graph, - GraphObject::Properties data) + Node::Properties data) { set_graph(graph); _initial_data = data; @@ -350,7 +350,7 @@ LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter) _app->forge().alloc_uri(plugin->uri()))); props.insert(make_pair(uris.ingen_polyphonic, _app->forge().make(polyphonic))); - _app->interface()->put(GraphObject::path_to_uri(path), props); + _app->interface()->put(Node::path_to_uri(path), props); if (_selection->get_selected_rows().size() == 1) { _name_offset = (_name_offset == 0) ? 2 : _name_offset + 1; diff --git a/src/gui/LoadPluginWindow.hpp b/src/gui/LoadPluginWindow.hpp index ba574f12..7ed00cb5 100644 --- a/src/gui/LoadPluginWindow.hpp +++ b/src/gui/LoadPluginWindow.hpp @@ -28,7 +28,7 @@ #include "raul/SharedPtr.hpp" -#include "ingen/GraphObject.hpp" +#include "ingen/Node.hpp" #include "ingen/client/ClientStore.hpp" #include "ingen_config.h" @@ -61,7 +61,7 @@ public: void add_plugin(SharedPtr plugin); void present(SharedPtr graph, - GraphObject::Properties data); + Node::Properties data); protected: void on_show(); @@ -126,7 +126,7 @@ private: void load_plugin(const Gtk::TreeModel::iterator& iter); - GraphObject::Properties _initial_data; + Node::Properties _initial_data; SharedPtr _graph; diff --git a/src/gui/NewSubgraphWindow.cpp b/src/gui/NewSubgraphWindow.cpp index 0cc8da7a..ef24be89 100644 --- a/src/gui/NewSubgraphWindow.cpp +++ b/src/gui/NewSubgraphWindow.cpp @@ -50,7 +50,7 @@ NewSubgraphWindow::NewSubgraphWindow(BaseObjectType* cobject, void NewSubgraphWindow::present(SharedPtr graph, - GraphObject::Properties data) + Node::Properties data) { set_graph(graph); _initial_data = data; @@ -98,12 +98,12 @@ NewSubgraphWindow::ok_clicked() props.insert(make_pair(_app->uris().rdf_type, _app->uris().ingen_Graph)); props.insert(make_pair(_app->uris().ingen_polyphony, _app->forge().make(int32_t(poly)))); props.insert(make_pair(_app->uris().ingen_enabled, _app->forge().make(bool(true)))); - _app->interface()->put(GraphObject::path_to_uri(path), props, Resource::INTERNAL); + _app->interface()->put(Node::path_to_uri(path), props, Resource::INTERNAL); // Set external (block perspective) properties props = _initial_data; props.insert(make_pair(_app->uris().rdf_type, _app->uris().ingen_Graph)); - _app->interface()->put(GraphObject::path_to_uri(path), _initial_data, Resource::EXTERNAL); + _app->interface()->put(Node::path_to_uri(path), _initial_data, Resource::EXTERNAL); hide(); } diff --git a/src/gui/NewSubgraphWindow.hpp b/src/gui/NewSubgraphWindow.hpp index 721a0916..4fef4831 100644 --- a/src/gui/NewSubgraphWindow.hpp +++ b/src/gui/NewSubgraphWindow.hpp @@ -25,7 +25,7 @@ #include "raul/SharedPtr.hpp" -#include "ingen/GraphObject.hpp" +#include "ingen/Node.hpp" #include "Window.hpp" @@ -50,14 +50,14 @@ public: void set_graph(SharedPtr graph); void present(SharedPtr graph, - GraphObject::Properties data); + Node::Properties data); private: void name_changed(); void ok_clicked(); void cancel_clicked(); - GraphObject::Properties _initial_data; + Node::Properties _initial_data; SharedPtr _graph; Gtk::Entry* _name_entry; diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp index fe01c713..484a8af7 100644 --- a/src/gui/NodeMenu.cpp +++ b/src/gui/NodeMenu.cpp @@ -201,7 +201,7 @@ NodeMenu::on_preset_activated(const std::string& uri) const LilvNode* val = lilv_nodes_get_first(values); const LilvNode* sym = lilv_nodes_get_first(symbols); _app->interface()->set_property( - GraphObject::path_to_uri( + Node::path_to_uri( block->path().child(Raul::Symbol(lilv_node_as_string(sym)))), _app->uris().ingen_value, _app->forge().make(lilv_node_as_float(val))); diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 5be945ce..462ac94b 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -108,7 +108,7 @@ NodeModule::create(GraphCanvas& canvas, ? new SubgraphModule(canvas, graph) : new NodeModule(canvas, block); - for (GraphObject::Properties::const_iterator m = block->properties().begin(); + for (Resource::Properties::const_iterator m = block->properties().begin(); m != block->properties().end(); ++m) ret->property_changed(m->first, m->second); diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index 3b51976f..18e16aa3 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -162,7 +162,7 @@ PortMenu::on_menu_expose() r.set_property(uris.ingen_canvasX, _app->forge().make(block_x + x_off)); r.set_property(uris.ingen_canvasY, _app->forge().make(block_y + y_off)); - _app->interface()->put(GraphObject::path_to_uri(path), r.properties()); + _app->interface()->put(Node::path_to_uri(path), r.properties()); if (port->is_input()) { _app->interface()->connect(path, _object->path()); diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp index 25528df1..da9fb2c6 100644 --- a/src/gui/RenameWindow.cpp +++ b/src/gui/RenameWindow.cpp @@ -125,7 +125,7 @@ RenameWindow::ok_clicked() } if (!label.empty() && (!name_atom.is_valid() || label != name_atom.get_string())) { - _app->interface()->set_property(GraphObject::path_to_uri(path), + _app->interface()->set_property(Node::path_to_uri(path), uris.lv2_name, _app->forge().alloc(label)); } diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp index cec9a4c9..9575734b 100644 --- a/src/gui/ThreadedLoader.cpp +++ b/src/gui/ThreadedLoader.cpp @@ -74,11 +74,11 @@ ThreadedLoader::_run() } void -ThreadedLoader::load_graph(bool merge, - const Glib::ustring& document_uri, - optional engine_parent, - optional engine_symbol, - optional engine_data) +ThreadedLoader::load_graph(bool merge, + const Glib::ustring& document_uri, + optional engine_parent, + optional engine_symbol, + optional engine_data) { _mutex.lock(); diff --git a/src/gui/ThreadedLoader.hpp b/src/gui/ThreadedLoader.hpp index 162e7cc7..afca29a9 100644 --- a/src/gui/ThreadedLoader.hpp +++ b/src/gui/ThreadedLoader.hpp @@ -52,11 +52,11 @@ public: ~ThreadedLoader(); - void load_graph(bool merge, - const Glib::ustring& document_uri, - boost::optional engine_parent, - boost::optional engine_symbol, - boost::optional engine_data); + void load_graph(bool merge, + const Glib::ustring& document_uri, + boost::optional engine_parent, + boost::optional engine_symbol, + boost::optional engine_data); void save_graph(SharedPtr model, const std::string& filename); diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp index 884313fd..717f1f63 100644 --- a/src/gui/WindowFactory.cpp +++ b/src/gui/WindowFactory.cpp @@ -189,7 +189,7 @@ WindowFactory::remove_graph_window(GraphWindow* win, GdkEventAny* ignored) void WindowFactory::present_load_plugin(SharedPtr graph, - GraphObject::Properties data) + Node::Properties data) { GraphWindowMap::iterator w = _graph_windows.find(graph->path()); @@ -210,7 +210,7 @@ WindowFactory::present_load_plugin(SharedPtr graph, void WindowFactory::present_load_graph(SharedPtr graph, - GraphObject::Properties data) + Node::Properties data) { GraphWindowMap::iterator w = _graph_windows.find(graph->path()); @@ -222,7 +222,7 @@ WindowFactory::present_load_graph(SharedPtr graph, void WindowFactory::present_load_subgraph(SharedPtr graph, - GraphObject::Properties data) + Node::Properties data) { GraphWindowMap::iterator w = _graph_windows.find(graph->path()); @@ -234,7 +234,7 @@ WindowFactory::present_load_subgraph(SharedPtr graph, void WindowFactory::present_new_subgraph(SharedPtr graph, - GraphObject::Properties data) + Node::Properties data) { GraphWindowMap::iterator w = _graph_windows.find(graph->path()); diff --git a/src/gui/WindowFactory.hpp b/src/gui/WindowFactory.hpp index 46c8b39a..bdeac89d 100644 --- a/src/gui/WindowFactory.hpp +++ b/src/gui/WindowFactory.hpp @@ -19,7 +19,7 @@ #include -#include "ingen/GraphObject.hpp" +#include "ingen/Node.hpp" #include "raul/SharedPtr.hpp" namespace Ingen { @@ -64,7 +64,7 @@ public: GraphWindow* preferred = NULL, SharedPtr view = SharedPtr()); - typedef GraphObject::Properties Properties; + typedef Node::Properties Properties; void present_load_plugin(SharedPtr graph, Properties data=Properties()); void present_load_graph(SharedPtr graph, Properties data=Properties()); diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp index d66405fb..49795a83 100644 --- a/src/gui/ingen_gui_lv2.cpp +++ b/src/gui/ingen_gui_lv2.cpp @@ -139,7 +139,7 @@ instantiate(const LV2UI_Descriptor* descriptor, Ingen::Resource::Properties props; props.insert(std::make_pair(ui->app->uris().rdf_type, ui->app->uris().ingen_Graph)); - ui->app->store()->put(Ingen::GraphObject::root_uri(), props); + ui->app->store()->put(Ingen::Node::root_uri(), props); // Create a GraphBox for the root and set as the UI widget SharedPtr root = PtrCast( @@ -149,7 +149,7 @@ instantiate(const LV2UI_Descriptor* descriptor, *widget = ui->view->gobj(); // Request the actual root graph - ui->world->interface()->get(Ingen::GraphObject::root_uri()); + ui->world->interface()->get(Ingen::Node::root_uri()); return ui; } diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp index a0b0dbbe..670cd514 100644 --- a/src/ingen/main.cpp +++ b/src/ingen/main.cpp @@ -177,7 +177,7 @@ main(int argc, char** argv) conf.files().front(); engine_interface->get(Raul::URI("ingen:plugins")); - engine_interface->get(GraphObject::root_uri()); + engine_interface->get(Node::root_uri()); world->parser()->parse_file( world, engine_interface.get(), path, parent, symbol); } diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index 9a5c52ed..e54cb9f2 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -215,12 +215,12 @@ parse_edges( const Raul::Path& graph); static boost::optional -parse_block(Ingen::World* world, - Ingen::Interface* target, - Sord::Model& model, - const Sord::Node& subject, - const Raul::Path& path, - boost::optional data) +parse_block(Ingen::World* world, + Ingen::Interface* target, + Sord::Model& model, + const Sord::Node& subject, + const Raul::Path& path, + boost::optional data) { const URIs& uris = world->uris(); @@ -272,19 +272,19 @@ parse_block(Ingen::World* world, Resource::Properties props = get_properties(world, model, subject); props.insert(make_pair(uris.rdf_type, uris.forge.alloc_uri(uris.ingen_Block))); - target->put(GraphObject::path_to_uri(path), props); + target->put(Node::path_to_uri(path), props); } return path; } static boost::optional -parse_graph(Ingen::World* world, - Ingen::Interface* target, - Sord::Model& model, - const Sord::Node& subject_node, - boost::optional parent, - boost::optional a_symbol, - boost::optional data) +parse_graph(Ingen::World* world, + Ingen::Interface* target, + Sord::Model& model, + const Sord::Node& subject_node, + boost::optional parent, + boost::optional a_symbol, + boost::optional data) { URIs& uris = world->uris(); @@ -317,7 +317,7 @@ parse_graph(Ingen::World* world, // Create graph Raul::Path graph_path(graph_path_str); Resource::Properties props = get_properties(world, model, subject_node); - target->put(GraphObject::path_to_uri(graph_path), props); + target->put(Node::path_to_uri(graph_path), props); // For each block in this graph for (Sord::Iter n = model.find(subject_node, ingen_block, nil); !n.end(); ++n) { @@ -327,7 +327,7 @@ parse_graph(Ingen::World* world, // Parse and create block parse_block(world, target, model, node, block_path, - boost::optional()); + boost::optional()); // For each port on this block for (Sord::Iter p = model.find(node, lv2_port, nil); !p.end(); ++p) { @@ -343,7 +343,7 @@ parse_graph(Ingen::World* world, } // Create port and/or set all port properties - target->put(GraphObject::path_to_uri(port_record->first), + target->put(Node::path_to_uri(port_record->first), port_record->second); } } @@ -369,7 +369,7 @@ parse_graph(Ingen::World* world, // Create ports in order by index for (PortRecords::const_iterator i = ports.begin(); i != ports.end(); ++i) { - target->put(GraphObject::path_to_uri(i->second.first), + target->put(Node::path_to_uri(i->second.first), i->second.second); } @@ -449,12 +449,12 @@ parse_edges(Ingen::World* world, } static bool -parse_properties(Ingen::World* world, - Ingen::Interface* target, - Sord::Model& model, - const Sord::Node& subject, - const Raul::URI& uri, - boost::optional data) +parse_properties(Ingen::World* world, + Ingen::Interface* target, + Sord::Model& model, + const Sord::Node& subject, + const Raul::URI& uri, + boost::optional data) { Resource::Properties properties = get_properties(world, model, subject); @@ -468,14 +468,14 @@ parse_properties(Ingen::World* world, } static boost::optional -parse(Ingen::World* world, - Ingen::Interface* target, - Sord::Model& model, - Glib::ustring document_uri, - Sord::Node& subject, - boost::optional parent, - boost::optional symbol, - boost::optional data) +parse(Ingen::World* world, + Ingen::Interface* target, + Sord::Model& model, + Glib::ustring document_uri, + Sord::Node& subject, + boost::optional parent, + boost::optional symbol, + boost::optional data) { URIs& uris = world->uris(); @@ -526,7 +526,7 @@ parse(Ingen::World* world, } else if (types.find(in_port_class) != types.end() || types.find(out_port_class) != types.end()) { parse_properties( - world, target, model, s, GraphObject::path_to_uri(path), data); + world, target, model, s, Node::path_to_uri(path), data); ret = path; } else if (types.find(edge_class) != types.end()) { Raul::Path parent_path(parent ? parent.get() : Raul::Path("/")); @@ -543,12 +543,12 @@ parse(Ingen::World* world, * @return whether or not load was successful. */ bool -Parser::parse_file(Ingen::World* world, - Ingen::Interface* target, - Glib::ustring path, - boost::optional parent, - boost::optional symbol, - boost::optional data) +Parser::parse_file(Ingen::World* world, + Ingen::Interface* target, + Glib::ustring path, + boost::optional parent, + boost::optional symbol, + boost::optional data) { if (Glib::file_test(path, Glib::FILE_TEST_IS_DIR)) { // This is a bundle, append "/name.ttl" to get graph file path @@ -589,7 +589,7 @@ Parser::parse_file(Ingen::World* world, = parse(world, target, model, path, subject, parent, symbol, data); if (parsed_path) { - target->set_property(GraphObject::path_to_uri(*parsed_path), + target->set_property(Node::path_to_uri(*parsed_path), Raul::URI("http://drobilla.net/ns/ingen#document"), world->forge().alloc_uri(uri)); } else { @@ -600,13 +600,13 @@ Parser::parse_file(Ingen::World* world, } bool -Parser::parse_string(Ingen::World* world, - Ingen::Interface* target, - const Glib::ustring& str, - const Glib::ustring& base_uri, - boost::optional parent, - boost::optional symbol, - boost::optional data) +Parser::parse_string(Ingen::World* world, + Ingen::Interface* target, + const Glib::ustring& str, + const Glib::ustring& base_uri, + boost::optional parent, + boost::optional symbol, + boost::optional data) { // Load string into model Sord::Model model(*world->rdf_world(), base_uri, SORD_SPO|SORD_PSO, false); diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index e1b1548d..ec8ca9d2 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -27,9 +27,9 @@ #include #include "ingen/Edge.hpp" -#include "ingen/GraphObject.hpp" #include "ingen/Interface.hpp" #include "ingen/Log.hpp" +#include "ingen/Node.hpp" #include "ingen/Plugin.hpp" #include "ingen/Resource.hpp" #include "ingen/Store.hpp" @@ -66,30 +66,30 @@ struct Serialiser::Impl { void start_to_filename(const std::string& filename); - void serialise_graph(SharedPtr p, - const Sord::Node& id); + void serialise_graph(SharedPtr p, + const Sord::Node& id); - void serialise_block(SharedPtr n, - const Sord::Node& class_id, - const Sord::Node& id); + void serialise_block(SharedPtr n, + const Sord::Node& class_id, + const Sord::Node& id); - void serialise_port(const GraphObject* p, - Resource::Graph context, - const Sord::Node& id); + void serialise_port(const Node* p, + Resource::Graph context, + const Sord::Node& id); void serialise_properties(Sord::Node id, const Resource::Properties& props); - void write_bundle(SharedPtr graph, - const std::string& uri); + void write_bundle(SharedPtr graph, + const std::string& uri); Sord::Node path_rdf_node(const Raul::Path& path); - void write_manifest(const std::string& bundle_path, - SharedPtr graph, - const std::string& graph_symbol); + void write_manifest(const std::string& bundle_path, + SharedPtr graph, + const std::string& graph_symbol); - void serialise_edge(const Sord::Node& parent, + void serialise_edge(const Sord::Node& parent, SharedPtr c) throw (std::logic_error); @@ -113,8 +113,8 @@ Serialiser::~Serialiser() } void -Serialiser::to_file(SharedPtr object, - const std::string& filename) +Serialiser::to_file(SharedPtr object, + const std::string& filename) { me->_root_path = object->path(); me->start_to_filename(filename); @@ -123,9 +123,9 @@ Serialiser::to_file(SharedPtr object, } void -Serialiser::Impl::write_manifest(const std::string& bundle_path, - SharedPtr graph, - const std::string& graph_symbol) +Serialiser::Impl::write_manifest(const std::string& bundle_path, + SharedPtr graph, + const std::string& graph_symbol) { const string manifest_path(Glib::build_filename(bundle_path, "manifest.ttl")); const string binary_path(Glib::Module::build_path("", "ingen_lv2")); @@ -158,15 +158,15 @@ Serialiser::Impl::write_manifest(const std::string& bundle_path, } void -Serialiser::write_bundle(SharedPtr graph, - const std::string& path) +Serialiser::write_bundle(SharedPtr graph, + const std::string& path) { me->write_bundle(graph, path); } void -Serialiser::Impl::write_bundle(SharedPtr graph, - const std::string& a_path) +Serialiser::Impl::write_bundle(SharedPtr graph, + const std::string& a_path) { std::string path = Glib::filename_from_uri(a_path); if (Glib::file_test(path, Glib::FILE_TEST_EXISTS) @@ -195,8 +195,8 @@ Serialiser::Impl::write_bundle(SharedPtr graph, } string -Serialiser::to_string(SharedPtr object, - const string& base_uri) +Serialiser::to_string(SharedPtr object, + const string& base_uri) { start_to_string(object->path(), base_uri); serialise(object); @@ -279,17 +279,17 @@ Serialiser::Impl::path_rdf_node(const Raul::Path& path) } void -Serialiser::serialise(SharedPtr object) throw (std::logic_error) +Serialiser::serialise(SharedPtr object) throw (std::logic_error) { if (!me->_model) throw std::logic_error("serialise called without serialisation in progress"); - if (object->graph_type() == GraphObject::GRAPH) { + if (object->graph_type() == Node::GRAPH) { me->serialise_graph(object, me->path_rdf_node(object->path())); - } else if (object->graph_type() == GraphObject::BLOCK) { + } else if (object->graph_type() == Node::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() == GraphObject::PORT) { + } else if (object->graph_type() == Node::PORT) { me->serialise_port(object.get(), Resource::DEFAULT, me->path_rdf_node(object->path())); @@ -300,8 +300,8 @@ Serialiser::serialise(SharedPtr object) throw (std::logic_err } void -Serialiser::Impl::serialise_graph(SharedPtr graph, - const Sord::Node& graph_id) +Serialiser::Impl::serialise_graph(SharedPtr graph, + const Sord::Node& graph_id) { Sord::World& world = _model->world(); const URIs& uris = _world.uris(); @@ -324,7 +324,7 @@ Serialiser::Impl::serialise_graph(SharedPtr graph, // Always write a symbol (required by Ingen) Raul::Symbol symbol("_"); - GraphObject::Properties::const_iterator s = graph->properties().find(uris.lv2_symbol); + Node::Properties::const_iterator s = graph->properties().find(uris.lv2_symbol); if (s == graph->properties().end() || !s->second.type() == _world.forge().String || !Raul::Symbol::is_valid(s->second.get_string())) { @@ -345,7 +345,7 @@ Serialiser::Impl::serialise_graph(SharedPtr graph, Sord::URI(world, uris.doap_name), Sord::Literal(world, symbol.c_str())); - const GraphObject::Properties props = graph->properties(Resource::INTERNAL); + const Node::Properties props = graph->properties(Resource::INTERNAL); serialise_properties(graph_id, props); const Store::const_range kids = _world.store()->children_range(graph); @@ -353,8 +353,8 @@ Serialiser::Impl::serialise_graph(SharedPtr graph, if (n->first.parent() != graph->path()) continue; - if (n->second->graph_type() == GraphObject::GRAPH) { - SharedPtr subgraph = n->second; + if (n->second->graph_type() == Node::GRAPH) { + SharedPtr subgraph = n->second; SerdURI base_uri; serd_uri_parse((const uint8_t*)_base_uri.c_str(), &base_uri); @@ -386,8 +386,8 @@ Serialiser::Impl::serialise_graph(SharedPtr graph, Sord::URI(world, uris.ingen_block), block_id); serialise_block(subgraph, subgraph_id, block_id); - } else if (n->second->graph_type() == GraphObject::BLOCK) { - SharedPtr block = n->second; + } else if (n->second->graph_type() == Node::BLOCK) { + SharedPtr block = n->second; const Sord::URI class_id(world, block->plugin()->uri()); const Sord::Node block_id(path_rdf_node(n->second->path())); @@ -399,7 +399,7 @@ Serialiser::Impl::serialise_graph(SharedPtr graph, } for (uint32_t i = 0; i < graph->num_ports(); ++i) { - GraphObject* p = graph->port(i); + Node* p = graph->port(i); const Sord::Node port_id = path_rdf_node(p->path()); // Ensure lv2:name always exists so Graph is a valid LV2 plugin @@ -413,16 +413,16 @@ Serialiser::Impl::serialise_graph(SharedPtr graph, serialise_port(p, Resource::INTERNAL, port_id); } - for (GraphObject::Edges::const_iterator c = graph->edges().begin(); + for (Node::Edges::const_iterator c = graph->edges().begin(); c != graph->edges().end(); ++c) { serialise_edge(graph_id, c->second); } } void -Serialiser::Impl::serialise_block(SharedPtr block, - const Sord::Node& class_id, - const Sord::Node& block_id) +Serialiser::Impl::serialise_block(SharedPtr block, + const Sord::Node& class_id, + const Sord::Node& block_id) { const URIs& uris = _world.uris(); @@ -436,11 +436,11 @@ Serialiser::Impl::serialise_block(SharedPtr block, Sord::URI(_model->world(), uris.lv2_symbol), Sord::Literal(_model->world(), block->path().symbol())); - const GraphObject::Properties props = block->properties(Resource::EXTERNAL); + const Node::Properties props = block->properties(Resource::EXTERNAL); serialise_properties(block_id, props); for (uint32_t i = 0; i < block->num_ports(); ++i) { - GraphObject* const p = block->port(i); + Node* const p = block->port(i); const Sord::Node port_id = path_rdf_node(p->path()); serialise_port(p, Resource::EXTERNAL, port_id); _model->add_statement(block_id, @@ -450,9 +450,9 @@ Serialiser::Impl::serialise_block(SharedPtr block, } void -Serialiser::Impl::serialise_port(const GraphObject* port, - Resource::Graph context, - const Sord::Node& port_id) +Serialiser::Impl::serialise_port(const Node* port, + Resource::Graph context, + const Sord::Node& port_id) { URIs& uris = _world.uris(); Sord::World& world = _model->world(); @@ -461,7 +461,7 @@ Serialiser::Impl::serialise_port(const GraphObject* port, Sord::URI(world, uris.lv2_symbol), Sord::Literal(world, port->path().symbol())); - GraphObject::Properties props = port->properties(context); + Node::Properties props = port->properties(context); if (context == Resource::INTERNAL && port->has_property(uris.rdf_type, uris.lv2_ControlPort) && port->has_property(uris.rdf_type, uris.lv2_InputPort)) @@ -525,8 +525,8 @@ skip_property(const Sord::Node& predicate) } void -Serialiser::Impl::serialise_properties(Sord::Node id, - const GraphObject::Properties& props) +Serialiser::Impl::serialise_properties(Sord::Node id, + const Node::Properties& props) { LV2_URID_Unmap* unmap = &_world.uri_map().urid_unmap_feature()->urid_unmap; SerdNode base = serd_node_from_string(SERD_URI, @@ -540,7 +540,7 @@ Serialiser::Impl::serialise_properties(Sord::Node id, sratom_set_pretty_numbers(_sratom, true); - typedef GraphObject::Properties::const_iterator iterator; + typedef Node::Properties::const_iterator iterator; for (iterator v = props.begin(); v != props.end(); ++v) { const Sord::URI key(_model->world(), v->first); if (!skip_property(key)) { diff --git a/src/server/BlockImpl.cpp b/src/server/BlockImpl.cpp index 2ccb0e2f..6c09e9b7 100644 --- a/src/server/BlockImpl.cpp +++ b/src/server/BlockImpl.cpp @@ -38,7 +38,7 @@ BlockImpl::BlockImpl(PluginImpl* plugin, bool polyphonic, GraphImpl* parent, SampleRate srate) - : GraphObjectImpl(plugin->uris(), parent, symbol) + : NodeImpl(plugin->uris(), parent, symbol) , _plugin(plugin) , _ports(NULL) , _context(Context::AUDIO) @@ -64,7 +64,7 @@ BlockImpl::~BlockImpl() delete _ports; } -GraphObject* +Node* BlockImpl::port(uint32_t index) const { return (*_ports)[index]; diff --git a/src/server/BlockImpl.hpp b/src/server/BlockImpl.hpp index 12318d60..bb4fb8e9 100644 --- a/src/server/BlockImpl.hpp +++ b/src/server/BlockImpl.hpp @@ -26,7 +26,7 @@ #include "BufferRef.hpp" #include "Context.hpp" -#include "GraphObjectImpl.hpp" +#include "NodeImpl.hpp" #include "PortType.hpp" #include "types.hpp" @@ -55,7 +55,7 @@ class ProcessContext; * * \ingroup engine */ -class BlockImpl : public GraphObjectImpl +class BlockImpl : public NodeImpl , public boost::intrusive::slist_base_hook<> // In GraphImpl { public: @@ -108,8 +108,8 @@ public: uint32_t port_num, BufferRef buf); - virtual GraphObject* port(uint32_t index) const; - virtual PortImpl* port_impl(uint32_t index) const { return (*_ports)[index]; } + virtual Node* port(uint32_t index) const; + virtual PortImpl* port_impl(uint32_t index) const { return (*_ports)[index]; } /** Blocks that are connected to this Block's inputs. */ std::list& providers() { return _providers; } diff --git a/src/server/Context.hpp b/src/server/Context.hpp index b5941dfc..cabfcc89 100644 --- a/src/server/Context.hpp +++ b/src/server/Context.hpp @@ -31,8 +31,8 @@ class PortImpl; /** Graph execution context. * - * This is used to pass whatever information a GraphObject might need to - * process; such as the current time, a sink for generated events, etc. + * This is used to pass whatever information a Node might need to process; such + * as the current time, a sink for generated events, etc. * * Note the logical distinction between nframes (jack relative) and start/end * (timeline relative). If transport speed != 1.0, then end-start != nframes diff --git a/src/server/Driver.hpp b/src/server/Driver.hpp index e5c62623..a34fc6f5 100644 --- a/src/server/Driver.hpp +++ b/src/server/Driver.hpp @@ -34,10 +34,8 @@ class EnginePort; /** Engine driver base class. * - * A Driver is, from the perspective of GraphObjects (blocks, graphs, ports) - * an interface for managing system ports. An implementation of Driver - * basically needs to manage EnginePorts, and handle writing/reading data - * to/from them. + * A Driver is responsible for managing system ports, and possibly running the + * audio graph. * * \ingroup engine */ diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index 7c053884..deb1ff50 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -81,7 +81,7 @@ Engine::~Engine() const SharedPtr s = this->store(); if (s) { for (Store::iterator i = s->begin(); i != s->end(); ++i) { - if (!PtrCast(i->second)->parent()) { + if (!PtrCast(i->second)->parent()) { i->second.reset(); } } diff --git a/src/server/Event.hpp b/src/server/Event.hpp index d627b5dc..7e4a1cc1 100644 --- a/src/server/Event.hpp +++ b/src/server/Event.hpp @@ -23,8 +23,8 @@ #include "raul/Path.hpp" #include "raul/SharedPtr.hpp" -#include "ingen/GraphObject.hpp" #include "ingen/Interface.hpp" +#include "ingen/Node.hpp" #include "ingen/Status.hpp" #include "types.hpp" @@ -108,7 +108,7 @@ protected: } inline bool pre_process_done(Status st, const Raul::Path& subject) { - return pre_process_done(st, GraphObject::path_to_uri(subject)); + return pre_process_done(st, Node::path_to_uri(subject)); } /** Respond to the originating client. */ diff --git a/src/server/GraphObjectImpl.cpp b/src/server/GraphObjectImpl.cpp deleted file mode 100644 index 2df7943f..00000000 --- a/src/server/GraphObjectImpl.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#include "GraphImpl.hpp" -#include "GraphObjectImpl.hpp" -#include "ThreadManager.hpp" - -using namespace std; - -namespace Ingen { -namespace Server { - -GraphObjectImpl::GraphObjectImpl(Ingen::URIs& uris, - GraphObjectImpl* parent, - const Raul::Symbol& symbol) - : GraphObject(uris, parent ? parent->path().child(symbol) : Raul::Path("/")) - , _parent(parent) - , _path(parent ? parent->path().child(symbol) : Raul::Path("/")) - , _symbol(symbol) -{ -} - -const Raul::Atom& -GraphObjectImpl::get_property(const Raul::URI& key) const -{ - ThreadManager::assert_not_thread(THREAD_PROCESS); - static const Raul::Atom null_atom; - Resource::Properties::const_iterator i = properties().find(key); - return (i != properties().end()) ? i->second : null_atom; -} - -GraphImpl* -GraphObjectImpl::parent_graph() const -{ - return dynamic_cast((BlockImpl*)_parent); -} - -} // namespace Server -} // namespace Ingen diff --git a/src/server/GraphObjectImpl.hpp b/src/server/GraphObjectImpl.hpp deleted file mode 100644 index 07a59727..00000000 --- a/src/server/GraphObjectImpl.hpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_ENGINE_GRAPHOBJECTIMPL_HPP -#define INGEN_ENGINE_GRAPHOBJECTIMPL_HPP - -#include -#include -#include - -#include "ingen/GraphObject.hpp" -#include "ingen/Resource.hpp" -#include "raul/Deletable.hpp" -#include "raul/Path.hpp" -#include "raul/SharedPtr.hpp" - -namespace Raul { class Maid; } - -namespace Ingen { - -namespace Shared { class URIs; } - -namespace Server { - -class BufferFactory; -class Context; -class GraphImpl; -class ProcessContext; - -/** An object on the audio graph (a Graph, Block, or Port). - * - * Each of these is a Raul::Deletable and so can be deleted in a realtime safe - * way from anywhere, and they all have a map of variable for clients to store - * arbitrary values in (which the engine puts no significance to whatsoever). - * - * \ingroup engine - */ -class GraphObjectImpl : public GraphObject -{ -public: - virtual ~GraphObjectImpl() {} - - const Raul::Symbol& symbol() const { return _symbol; } - - GraphObject* graph_parent() const { return _parent; } - GraphObjectImpl* parent() const { return _parent; } - - /** Rename */ - virtual void set_path(const Raul::Path& new_path) { - _path = new_path; - const char* const new_sym = new_path.symbol(); - if (new_sym[0] != '\0') { - _symbol = Raul::Symbol(new_sym); - } - set_uri(GraphObject::path_to_uri(new_path)); - } - - const Raul::Atom& get_property(const Raul::URI& key) const; - - /** The Graph this object is a child of. */ - virtual GraphImpl* parent_graph() const; - - const Raul::Path& path() const { return _path; } - - /** Prepare for a new (external) polyphony value. - * - * Preprocessor thread, poly is actually applied by apply_poly. - * \return true on success. - */ - virtual bool prepare_poly(BufferFactory& bufs, uint32_t poly) = 0; - - /** Apply a new (external) polyphony value. - * - * Audio thread. - * - * \param poly Must be <= the most recent value passed to prepare_poly. - * \param maid Any objects no longer needed will be pushed to this - */ - virtual bool apply_poly( - ProcessContext& context, Raul::Maid& maid, uint32_t poly) = 0; - -protected: - GraphObjectImpl(Ingen::URIs& uris, - GraphObjectImpl* parent, - const Raul::Symbol& symbol); - - GraphObjectImpl* _parent; - Raul::Path _path; - Raul::Symbol _symbol; -}; - -} // namespace Server -} // namespace Ingen - -#endif // INGEN_ENGINE_GRAPHOBJECTIMPL_HPP diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp index e2f97896..49ffaf2d 100644 --- a/src/server/InputPort.cpp +++ b/src/server/InputPort.cpp @@ -50,7 +50,7 @@ InputPort::InputPort(BufferFactory& bufs, { const Ingen::URIs& uris = bufs.uris(); - if (parent->graph_type() != GraphObject::GRAPH) { + if (parent->graph_type() != Node::GRAPH) { add_property(uris.rdf_type, uris.lv2_InputPort); } diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index 5f1ba1d3..6da4e279 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -409,7 +409,7 @@ JackDriver::_session_cb(jack_session_event_t* event) SharedPtr serialiser = _engine.world()->serialiser(); if (serialiser) { - SharedPtr root(_engine.root_graph(), NullDeleter); + SharedPtr root(_engine.root_graph(), NullDeleter); serialiser->write_bundle(root, string("file://") + event->session_dir); } diff --git a/src/server/LV2ResizeFeature.hpp b/src/server/LV2ResizeFeature.hpp index 5b385a2f..47f30e41 100644 --- a/src/server/LV2ResizeFeature.hpp +++ b/src/server/LV2ResizeFeature.hpp @@ -47,7 +47,7 @@ struct ResizeFeature : public Ingen::LV2Features::Feature { free(feature); } - SharedPtr feature(World* w, GraphObject* n) { + SharedPtr feature(World* w, Node* n) { BlockImpl* block = dynamic_cast(n); if (!block) return SharedPtr(); diff --git a/src/server/NodeImpl.cpp b/src/server/NodeImpl.cpp new file mode 100644 index 00000000..3fe7a2a4 --- /dev/null +++ b/src/server/NodeImpl.cpp @@ -0,0 +1,52 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#include "GraphImpl.hpp" +#include "NodeImpl.hpp" +#include "ThreadManager.hpp" + +using namespace std; + +namespace Ingen { +namespace Server { + +NodeImpl::NodeImpl(Ingen::URIs& uris, + NodeImpl* parent, + const Raul::Symbol& symbol) + : Node(uris, parent ? parent->path().child(symbol) : Raul::Path("/")) + , _parent(parent) + , _path(parent ? parent->path().child(symbol) : Raul::Path("/")) + , _symbol(symbol) +{ +} + +const Raul::Atom& +NodeImpl::get_property(const Raul::URI& key) const +{ + ThreadManager::assert_not_thread(THREAD_PROCESS); + static const Raul::Atom null_atom; + Resource::Properties::const_iterator i = properties().find(key); + return (i != properties().end()) ? i->second : null_atom; +} + +GraphImpl* +NodeImpl::parent_graph() const +{ + return dynamic_cast((BlockImpl*)_parent); +} + +} // namespace Server +} // namespace Ingen diff --git a/src/server/NodeImpl.hpp b/src/server/NodeImpl.hpp new file mode 100644 index 00000000..937d4dea --- /dev/null +++ b/src/server/NodeImpl.hpp @@ -0,0 +1,108 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_ENGINE_NODEIMPLIMPL_HPP +#define INGEN_ENGINE_NODEIMPLIMPL_HPP + +#include +#include +#include + +#include "ingen/Node.hpp" +#include "ingen/Resource.hpp" +#include "raul/Deletable.hpp" +#include "raul/Path.hpp" +#include "raul/SharedPtr.hpp" + +namespace Raul { class Maid; } + +namespace Ingen { + +namespace Shared { class URIs; } + +namespace Server { + +class BufferFactory; +class Context; +class GraphImpl; +class ProcessContext; + +/** An object on the audio graph (a Graph, Block, or Port). + * + * Each of these is a Raul::Deletable and so can be deleted in a realtime safe + * way from anywhere, and they all have a map of variable for clients to store + * arbitrary values in (which the engine puts no significance to whatsoever). + * + * \ingroup engine + */ +class NodeImpl : public Node +{ +public: + virtual ~NodeImpl() {} + + const Raul::Symbol& symbol() const { return _symbol; } + + Node* graph_parent() const { return _parent; } + NodeImpl* parent() const { return _parent; } + + /** Rename */ + virtual void set_path(const Raul::Path& new_path) { + _path = new_path; + const char* const new_sym = new_path.symbol(); + if (new_sym[0] != '\0') { + _symbol = Raul::Symbol(new_sym); + } + set_uri(Node::path_to_uri(new_path)); + } + + const Raul::Atom& get_property(const Raul::URI& key) const; + + /** The Graph this object is a child of. */ + virtual GraphImpl* parent_graph() const; + + const Raul::Path& path() const { return _path; } + + /** Prepare for a new (external) polyphony value. + * + * Preprocessor thread, poly is actually applied by apply_poly. + * \return true on success. + */ + virtual bool prepare_poly(BufferFactory& bufs, uint32_t poly) = 0; + + /** Apply a new (external) polyphony value. + * + * Audio thread. + * + * \param poly Must be <= the most recent value passed to prepare_poly. + * \param maid Any objects no longer needed will be pushed to this + */ + virtual bool apply_poly( + ProcessContext& context, Raul::Maid& maid, uint32_t poly) = 0; + +protected: + NodeImpl(Ingen::URIs& uris, + NodeImpl* parent, + const Raul::Symbol& symbol); + + NodeImpl* _parent; + Raul::Path _path; + Raul::Symbol _symbol; +}; + +} // namespace Server +} // namespace Ingen + +#endif // INGEN_ENGINE_NODEIMPLIMPL_HPP diff --git a/src/server/OutputPort.cpp b/src/server/OutputPort.cpp index 48f7eb22..4596c68f 100644 --- a/src/server/OutputPort.cpp +++ b/src/server/OutputPort.cpp @@ -38,7 +38,7 @@ OutputPort::OutputPort(BufferFactory& bufs, size_t buffer_size) : PortImpl(bufs, parent, symbol, index, poly, type, buffer_type, value, buffer_size) { - if (parent->graph_type() != GraphObject::GRAPH) { + if (parent->graph_type() != Node::GRAPH) { add_property(bufs.uris().rdf_type, bufs.uris().lv2_OutputPort); } diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index bd088913..a5fe8fe6 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -41,7 +41,7 @@ PortImpl::PortImpl(BufferFactory& bufs, LV2_URID buffer_type, const Raul::Atom& value, size_t buffer_size) - : GraphObjectImpl(bufs.uris(), block, name) + : NodeImpl(bufs.uris(), block, name) , _bufs(bufs) , _index(index) , _poly(poly) diff --git a/src/server/PortImpl.hpp b/src/server/PortImpl.hpp index d7aed3ff..428a628b 100644 --- a/src/server/PortImpl.hpp +++ b/src/server/PortImpl.hpp @@ -23,7 +23,7 @@ #include "raul/Atom.hpp" #include "BufferRef.hpp" -#include "GraphObjectImpl.hpp" +#include "NodeImpl.hpp" #include "PortType.hpp" #include "ProcessContext.hpp" #include "types.hpp" @@ -40,7 +40,7 @@ class BufferFactory; * * \ingroup engine */ -class PortImpl : public GraphObjectImpl +class PortImpl : public NodeImpl { public: ~PortImpl(); diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp index 9fbc4825..68300a16 100644 --- a/src/server/Worker.cpp +++ b/src/server/Worker.cpp @@ -80,7 +80,7 @@ delete_feature(LV2_Feature* feature) } SharedPtr -Worker::Schedule::feature(World* world, GraphObject* n) +Worker::Schedule::feature(World* world, Node* n) { LV2Block* block = dynamic_cast(n); if (!block) { diff --git a/src/server/Worker.hpp b/src/server/Worker.hpp index f8c9216e..9b69edb2 100644 --- a/src/server/Worker.hpp +++ b/src/server/Worker.hpp @@ -38,7 +38,7 @@ public: ~Worker(); struct Schedule : public LV2Features::Feature { - SharedPtr feature(World* world, GraphObject* n); + SharedPtr feature(World* world, Node* n); }; LV2_Worker_Status request(LV2Block* block, diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index eeaa1904..5e749628 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -54,12 +54,12 @@ Connect::pre_process() { Glib::RWLock::ReaderLock rlock(_engine.store()->lock()); - GraphObject* tail = _engine.store()->get(_tail_path); + Node* tail = _engine.store()->get(_tail_path); if (!tail) { return Event::pre_process_done(NOT_FOUND, _tail_path); } - GraphObject* head = _engine.store()->get(_head_path); + Node* head = _engine.store()->get(_head_path); if (!head) { return Event::pre_process_done(NOT_FOUND, _head_path); } diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp index bfe08043..5be9d19e 100644 --- a/src/server/events/CreateGraph.cpp +++ b/src/server/events/CreateGraph.cpp @@ -114,7 +114,7 @@ void CreateGraph::post_process() { if (!respond()) { - _engine.broadcaster()->put(GraphObject::path_to_uri(_path), _update); + _engine.broadcaster()->put(Node::path_to_uri(_path), _update); } } diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index a32faaee..58402014 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -97,7 +97,7 @@ CreatePort::pre_process() return Event::pre_process_done(_status, _path); } - GraphObject* parent = _engine.store()->get(_path.parent()); + Node* parent = _engine.store()->get(_path.parent()); if (!parent) { return Event::pre_process_done(PARENT_NOT_FOUND, _path.parent()); } @@ -185,7 +185,7 @@ void CreatePort::post_process() { if (!respond()) { - _engine.broadcaster()->put(GraphObject::path_to_uri(_path), _update); + _engine.broadcaster()->put(Node::path_to_uri(_path), _update); } delete _old_ports_array; diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index a6207ba1..e4878f4e 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -47,8 +47,8 @@ Delete::Delete(Engine& engine, , _disconnect_event(NULL) , _lock(engine.store()->lock(), Glib::NOT_LOCK) { - if (GraphObject::uri_is_path(uri)) { - _path = GraphObject::uri_to_path(uri); + if (Node::uri_is_path(uri)) { + _path = Node::uri_to_path(uri); } } diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 06bd150c..6c935ce2 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -105,13 +105,13 @@ Delta::pre_process() { typedef Properties::const_iterator iterator; - const bool is_graph_object = GraphObject::uri_is_path(_subject); + const bool is_graph_object = Node::uri_is_path(_subject); // Take a writer lock while we modify the store Glib::RWLock::WriterLock lock(_engine.store()->lock()); _object = is_graph_object - ? static_cast(_engine.store()->get(GraphObject::uri_to_path(_subject))) + ? static_cast(_engine.store()->get(Node::uri_to_path(_subject))) : static_cast(_engine.block_factory()->plugin(_subject)); if (!_object && (!is_graph_object || !_create)) { @@ -121,7 +121,7 @@ Delta::pre_process() const Ingen::URIs& uris = _engine.world()->uris(); if (is_graph_object && !_object) { - Raul::Path path(GraphObject::uri_to_path(_subject)); + Raul::Path path(Node::uri_to_path(_subject)); bool is_graph = false, is_block = false, is_port = false, is_output = false; Ingen::Resource::type(uris, _properties, is_graph, is_block, is_port, is_output); @@ -147,7 +147,7 @@ Delta::pre_process() _types.reserve(_properties.size()); - GraphObjectImpl* obj = dynamic_cast(_object); + NodeImpl* obj = dynamic_cast(_object); for (Properties::const_iterator p = _remove.begin(); p != _remove.end(); ++p) { const Raul::URI& key = p->first; @@ -270,9 +270,9 @@ Delta::execute(ProcessContext& context) (*i)->execute(context); } - GraphObjectImpl* const object = dynamic_cast(_object); - BlockImpl* const block = dynamic_cast(_object); - PortImpl* const port = dynamic_cast(_object); + NodeImpl* const object = dynamic_cast(_object); + BlockImpl* const block = dynamic_cast(_object); + PortImpl* const port = dynamic_cast(_object); std::vector::const_iterator t = _types.begin(); for (Properties::const_iterator p = _properties.begin(); p != _properties.end(); ++p, ++t) { diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index dbff2ab3..019193e6 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -59,9 +59,9 @@ DisconnectAll::DisconnectAll(Engine& engine, /** Internal version for use by other events. */ -DisconnectAll::DisconnectAll(Engine& engine, - GraphImpl* parent, - GraphObject* object) +DisconnectAll::DisconnectAll(Engine& engine, + GraphImpl* parent, + Node* object) : Event(engine) , _parent_path(parent->path()) , _path(object->path()) @@ -92,7 +92,7 @@ DisconnectAll::pre_process() return Event::pre_process_done(PARENT_NOT_FOUND, _parent_path); } - GraphObjectImpl* const object = dynamic_cast( + NodeImpl* const object = dynamic_cast( _engine.store()->get(_path)); if (!object) { return Event::pre_process_done(NOT_FOUND, _path); @@ -112,7 +112,7 @@ DisconnectAll::pre_process() // Find set of edges to remove std::set to_remove; - for (GraphObject::Edges::const_iterator i = _parent->edges().begin(); + for (Node::Edges::const_iterator i = _parent->edges().begin(); i != _parent->edges().end(); ++i) { EdgeImpl* const c = (EdgeImpl*)i->second.get(); if (_block) { diff --git a/src/server/events/DisconnectAll.hpp b/src/server/events/DisconnectAll.hpp index 8a785722..7db53bfa 100644 --- a/src/server/events/DisconnectAll.hpp +++ b/src/server/events/DisconnectAll.hpp @@ -50,9 +50,9 @@ public: const Raul::Path& parent, const Raul::Path& object); - DisconnectAll(Engine& engine, - GraphImpl* parent, - GraphObject* object); + DisconnectAll(Engine& engine, + GraphImpl* parent, + Node* object); ~DisconnectAll(); diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index c452328e..1493f161 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -16,8 +16,8 @@ #include -#include "ingen/GraphObject.hpp" #include "ingen/Interface.hpp" +#include "ingen/Node.hpp" #include "ingen/Store.hpp" #include "BlockImpl.hpp" @@ -60,8 +60,8 @@ Get::pre_process() return Event::pre_process_done(SUCCESS); } else if (_uri == "ingen:engine") { return Event::pre_process_done(SUCCESS); - } else if (GraphObject::uri_is_path(_uri)) { - _object = _engine.store()->get(GraphObject::uri_to_path(_uri)); + } else if (Node::uri_is_path(_uri)) { + _object = _engine.store()->get(Node::uri_to_path(_uri)); return Event::pre_process_done(_object ? SUCCESS : NOT_FOUND, _uri); } else { _plugin = _engine.block_factory()->plugin(_uri); diff --git a/src/server/events/Get.hpp b/src/server/events/Get.hpp index 7b33304e..12f48b09 100644 --- a/src/server/events/Get.hpp +++ b/src/server/events/Get.hpp @@ -49,7 +49,7 @@ public: private: const Raul::URI _uri; - const GraphObject* _object; + const Node* _object; const PluginImpl* _plugin; BlockFactory::Plugins _plugins; Glib::RWLock::ReaderLock _lock; diff --git a/src/server/wscript b/src/server/wscript index b6ec6e98..d548a77c 100644 --- a/src/server/wscript +++ b/src/server/wscript @@ -15,12 +15,12 @@ def build(bld): Engine.cpp EventWriter.cpp GraphImpl.cpp - GraphObjectImpl.cpp InputPort.cpp InternalPlugin.cpp LV2Block.cpp LV2Info.cpp LV2Plugin.cpp + NodeImpl.cpp OutputPort.cpp PortImpl.cpp PostProcessor.cpp -- cgit v1.2.1