diff options
41 files changed, 375 insertions, 368 deletions
diff --git a/bundles/StereoInOut.ingen/StereoInOut.ttl b/bundles/StereoInOut.ingen/StereoInOut.ttl index 6052ce0f..3a01992f 100644 --- a/bundles/StereoInOut.ingen/StereoInOut.ttl +++ b/bundles/StereoInOut.ingen/StereoInOut.ttl @@ -10,7 +10,7 @@ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . <> - ingen:edge [ + ingen:arc [ ingen:head <audio_out_1> ; ingen:tail <audio_in_1> ] , [ diff --git a/bundles/ingen.lv2/ingen.ttl b/bundles/ingen.lv2/ingen.ttl index d4de601a..6613d122 100644 --- a/bundles/ingen.lv2/ingen.ttl +++ b/bundles/ingen.lv2/ingen.ttl @@ -134,40 +134,40 @@ ingen:prototype The object which this block is an instance of, or derived from. """ . -ingen:Edge +ingen:Arc a owl:Class ; - rdfs:label "Edge" ; + rdfs:label "Arc" ; rdfs:comment """ -A connection between two ports. Graphs have a set of edges which -define how its component blocks and ports are connected. An Edge MUST +A connection between two ports. Graphs have a set of arcs which +define how its component blocks and ports are connected. An Arc MUST have exactly one ingen:tail and exactly one ingen:head property. """ . -ingen:edge +ingen:arc a owl:ObjectProperty ; rdfs:domain ingen:Graph ; - rdfs:range ingen:Edge ; - rdfs:comment "An edge contained in this graph." . + rdfs:range ingen:Arc ; + rdfs:comment "An arc contained in this graph." . ingen:tail a owl:ObjectProperty , owl:FunctionalProperty ; - rdfs:domain ingen:Edge ; + rdfs:domain ingen:Arc ; rdfs:range lv2:Port ; rdfs:label "tail" ; - rdfs:comment "The source/sending port of this edge" . + rdfs:comment "The source/sending port of this arc" . ingen:head a owl:ObjectProperty , owl:FunctionalProperty ; - rdfs:domain ingen:Edge ; + rdfs:domain ingen:Arc ; rdfs:range lv2:Port ; rdfs:label "head" ; - rdfs:comment "The destination/receiving/sink port of this edge" . + rdfs:comment "The destination/receiving/sink port of this arc" . ingen:incidentTo a owl:ObjectProperty , owl:FunctionalProperty ; - rdfs:domain ingen:Edge ; + rdfs:domain ingen:Arc ; rdfs:label "incident to" ; - rdfs:comment "A special property used to describe any edge incident to a port or block. This is never saved in graph files, but is used in the control protocol to completely disconnect a Block or Port." . + rdfs:comment "A special property used to describe any arc incident to a port or block. This is never saved in graph files, but is used in the control protocol to completely disconnect a Block or Port." . diff --git a/ingen/Edge.hpp b/ingen/Arc.hpp index a586783b..69c65586 100644 --- a/ingen/Edge.hpp +++ b/ingen/Arc.hpp @@ -14,8 +14,8 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef INGEN_EDGE_HPP -#define INGEN_EDGE_HPP +#ifndef INGEN_ARC_HPP +#define INGEN_ARC_HPP #include "raul/Deletable.hpp" @@ -27,7 +27,7 @@ namespace Ingen { * * @ingroup Ingen */ -class Edge : public Raul::Deletable +class Arc : public Raul::Deletable { public: virtual const Raul::Path& tail_path() const = 0; @@ -36,4 +36,4 @@ public: } // namespace Ingen -#endif // INGEN_EDGE_HPP +#endif // INGEN_ARC_HPP diff --git a/ingen/AtomWriter.hpp b/ingen/AtomWriter.hpp index 00b64b54..4e3e489a 100644 --- a/ingen/AtomWriter.hpp +++ b/ingen/AtomWriter.hpp @@ -81,7 +81,7 @@ public: private: void forge_uri(const Raul::URI& uri); void forge_properties(const Resource::Properties& properties); - void forge_edge(const Raul::Path& tail, const Raul::Path& head); + void forge_arc(const Raul::Path& tail, const Raul::Path& head); void finish_msg(); int32_t next_id(); diff --git a/ingen/Node.hpp b/ingen/Node.hpp index db796ef7..42e21ee3 100644 --- a/ingen/Node.hpp +++ b/ingen/Node.hpp @@ -29,7 +29,7 @@ class Symbol; namespace Ingen { -class Edge; +class Arc; class Plugin; class Store; @@ -54,12 +54,12 @@ public: PORT }; - typedef std::pair<const Node*, const Node*> EdgesKey; - typedef std::map< EdgesKey, SharedPtr<Edge> > Edges; + typedef std::pair<const Node*, const Node*> ArcsKey; + typedef std::map< ArcsKey, SharedPtr<Arc> > Arcs; // Graphs only - Edges& edges() { return _edges; } - const Edges& edges() const { return _edges; } + Arcs& arcs() { return _arcs; } + const Arcs& arcs() const { return _arcs; } // Blocks and graphs only virtual uint32_t num_ports() const { return 0; } @@ -97,7 +97,7 @@ protected: : Resource(uris, path_to_uri(path)) {} - Edges _edges; ///< Graphs only + Arcs _arcs; ///< Graphs only }; } // namespace Ingen diff --git a/ingen/URIs.hpp b/ingen/URIs.hpp index 9cea37a8..3e6427e6 100644 --- a/ingen/URIs.hpp +++ b/ingen/URIs.hpp @@ -73,18 +73,18 @@ public: const Quark bufsz_minBlockLength; const Quark bufsz_sequenceSize; const Quark doap_name; + const Quark ingen_Arc; const Quark ingen_Block; - const Quark ingen_Edge; const Quark ingen_Graph; const Quark ingen_Internal; const Quark ingen_activity; + const Quark ingen_arc; const Quark ingen_block; const Quark ingen_broadcast; const Quark ingen_canvasX; const Quark ingen_canvasY; const Quark ingen_controlBinding; const Quark ingen_document; - const Quark ingen_edge; const Quark ingen_enabled; const Quark ingen_engine; const Quark ingen_head; diff --git a/ingen/client/EdgeModel.hpp b/ingen/client/ArcModel.hpp index 9006dd80..99d5afa0 100644 --- a/ingen/client/EdgeModel.hpp +++ b/ingen/client/ArcModel.hpp @@ -14,15 +14,15 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef INGEN_CLIENT_EDGEMODEL_HPP -#define INGEN_CLIENT_EDGEMODEL_HPP +#ifndef INGEN_CLIENT_ARCMODEL_HPP +#define INGEN_CLIENT_ARCMODEL_HPP #include <cassert> #include "raul/Path.hpp" #include "raul/SharedPtr.hpp" -#include "ingen/Edge.hpp" +#include "ingen/Arc.hpp" #include "ingen/client/PortModel.hpp" namespace Ingen { @@ -34,7 +34,7 @@ class ClientStore; * * @ingroup IngenClient */ -class EdgeModel : public Edge +class ArcModel : public Arc { public: SharedPtr<PortModel> tail() const { return _tail; } @@ -46,7 +46,7 @@ public: private: friend class ClientStore; - EdgeModel(SharedPtr<PortModel> tail, SharedPtr<PortModel> head) + ArcModel(SharedPtr<PortModel> tail, SharedPtr<PortModel> head) : _tail(tail) , _head(head) { @@ -64,4 +64,4 @@ private: } // namespace Client } // namespace Ingen -#endif // INGEN_CLIENT_EDGEMODEL_HPP +#endif // INGEN_CLIENT_ARCMODEL_HPP diff --git a/ingen/client/GraphModel.hpp b/ingen/client/GraphModel.hpp index d527eb82..a721dc37 100644 --- a/ingen/client/GraphModel.hpp +++ b/ingen/client/GraphModel.hpp @@ -23,8 +23,8 @@ namespace Ingen { namespace Client { +class ArcModel; class ClientStore; -class EdgeModel; /** Client's model of a graph. * @@ -37,8 +37,8 @@ public: GraphType graph_type() const { return Node::GRAPH; } - SharedPtr<EdgeModel> get_edge(const Ingen::Node* tail, - const Ingen::Node* head); + SharedPtr<ArcModel> get_arc(const Ingen::Node* tail, + const Ingen::Node* head); bool enabled() const; bool polyphonic() const; @@ -47,8 +47,8 @@ public: // Signals INGEN_SIGNAL(new_block, void, SharedPtr<BlockModel>); INGEN_SIGNAL(removed_block, void, SharedPtr<BlockModel>); - INGEN_SIGNAL(new_edge, void, SharedPtr<EdgeModel>); - INGEN_SIGNAL(removed_edge, void, SharedPtr<EdgeModel>); + INGEN_SIGNAL(new_arc, void, SharedPtr<ArcModel>); + INGEN_SIGNAL(removed_arc, void, SharedPtr<ArcModel>); private: friend class ClientStore; @@ -61,9 +61,9 @@ private: void add_child(SharedPtr<ObjectModel> c); bool remove_child(SharedPtr<ObjectModel> c); - void add_edge(SharedPtr<EdgeModel> cm); - void remove_edge(const Ingen::Node* tail, - const Ingen::Node* head); + void add_arc(SharedPtr<ArcModel> arc); + void remove_arc(const Ingen::Node* tail, + const Ingen::Node* head); }; } // namespace Client diff --git a/ingen/serialisation/Serialiser.hpp b/ingen/serialisation/Serialiser.hpp index a694e800..979fee62 100644 --- a/ingen/serialisation/Serialiser.hpp +++ b/ingen/serialisation/Serialiser.hpp @@ -29,7 +29,7 @@ namespace Ingen { -class Edge; +class Arc; class Node; class Store; class World; @@ -64,8 +64,8 @@ public: virtual void serialise(SharedPtr<const Node> object) throw (std::logic_error); - virtual void serialise_edge(const Sord::Node& parent, - SharedPtr<const Edge> c) + virtual void serialise_arc(const Sord::Node& parent, + SharedPtr<const Arc> arc) throw (std::logic_error); virtual std::string finish(); diff --git a/scripts/ingen.py b/scripts/ingen.py index 041a7de6..c66b0293 100644 --- a/scripts/ingen.py +++ b/scripts/ingen.py @@ -239,7 +239,7 @@ class Remote(Interface): a patch:Put ; patch:subject <ingen:/root%s> ; patch:body [ - a ingen:Edge ; + a ingen:Arc ; ingen:tail <ingen:/root%s> ; ingen:head <ingen:/root%s> ; ] . @@ -250,7 +250,7 @@ class Remote(Interface): [] a patch:Delete ; patch:body [ - a ingen:Edge ; + a ingen:Arc ; ingen:tail <ingen:/root%s> ; ingen:head <ingen:/root%s> ; ] . diff --git a/src/AtomReader.cpp b/src/AtomReader.cpp index c12ce3d7..63f493a7 100644 --- a/src/AtomReader.cpp +++ b/src/AtomReader.cpp @@ -138,7 +138,7 @@ AtomReader::write(const LV2_Atom* msg) if (subject_uri && !body) { _iface.del(Raul::URI(subject_uri)); return true; - } else if (body && body->body.otype == _uris.ingen_Edge) { + } else if (body && body->body.otype == _uris.ingen_Arc) { const LV2_Atom* tail = NULL; const LV2_Atom* head = NULL; const LV2_Atom* incidentTo = NULL; @@ -172,7 +172,7 @@ AtomReader::write(const LV2_Atom* msg) return false; } - if (body->body.otype == _uris.ingen_Edge) { + if (body->body.otype == _uris.ingen_Arc) { LV2_Atom* tail = NULL; LV2_Atom* head = NULL; lv2_atom_object_get(body, @@ -180,7 +180,7 @@ AtomReader::write(const LV2_Atom* msg) (LV2_URID)_uris.ingen_head, &head, NULL); if (!tail || !head) { - _log.warn("Edge has no tail or head\n"); + _log.warn("Arc has no tail or head\n"); return false; } @@ -189,7 +189,7 @@ AtomReader::write(const LV2_Atom* msg) if (tail_path && head_path) { _iface.connect(*tail_path, *head_path); } else { - _log.warn(Raul::fmt("Edge %1% => %2% has non-path tail or head\n") + _log.warn(Raul::fmt("Arc %1% => %2% has non-path tail or head\n") % atom_to_uri(tail) % atom_to_uri(head)); } } else { diff --git a/src/AtomWriter.cpp b/src/AtomWriter.cpp index f102c8a8..05e5d64d 100644 --- a/src/AtomWriter.cpp +++ b/src/AtomWriter.cpp @@ -108,15 +108,15 @@ AtomWriter::forge_properties(const Resource::Properties& properties) } void -AtomWriter::forge_edge(const Raul::Path& tail, const Raul::Path& head) +AtomWriter::forge_arc(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_Frame arc; + lv2_atom_forge_blank(&_forge, &arc, 0, _uris.ingen_Arc); lv2_atom_forge_property_head(&_forge, _uris.ingen_tail, 0); forge_uri(Node::path_to_uri(tail)); lv2_atom_forge_property_head(&_forge, _uris.ingen_head, 0); forge_uri(Node::path_to_uri(head)); - lv2_atom_forge_pop(&_forge, &edge); + lv2_atom_forge_pop(&_forge, &arc); } void @@ -195,7 +195,7 @@ AtomWriter::connect(const Raul::Path& tail, lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); 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); + forge_arc(tail, head); lv2_atom_forge_pop(&_forge, &msg); finish_msg(); } @@ -207,7 +207,7 @@ AtomWriter::disconnect(const Raul::Path& tail, LV2_Atom_Forge_Frame msg; lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Delete); lv2_atom_forge_property_head(&_forge, _uris.patch_body, 0); - forge_edge(tail, head); + forge_arc(tail, head); lv2_atom_forge_pop(&_forge, &msg); finish_msg(); } @@ -223,11 +223,11 @@ AtomWriter::disconnect_all(const Raul::Path& 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_Frame arc; + lv2_atom_forge_blank(&_forge, &arc, 0, _uris.ingen_Arc); lv2_atom_forge_property_head(&_forge, _uris.ingen_incidentTo, 0); forge_uri(Node::path_to_uri(path)); - lv2_atom_forge_pop(&_forge, &edge); + lv2_atom_forge_pop(&_forge, &arc); lv2_atom_forge_pop(&_forge, &msg); finish_msg(); diff --git a/src/Builder.cpp b/src/Builder.cpp index 023f22cd..fc7d855d 100644 --- a/src/Builder.cpp +++ b/src/Builder.cpp @@ -14,8 +14,8 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ +#include "ingen/Arc.hpp" #include "ingen/Builder.hpp" -#include "ingen/Edge.hpp" #include "ingen/Interface.hpp" #include "ingen/Node.hpp" #include "ingen/URIs.hpp" @@ -42,8 +42,8 @@ void Builder::connect(SharedPtr<const Node> object) { if (object->graph_type() == Node::GRAPH) { - for (Node::Edges::const_iterator i = object->edges().begin(); - i != object->edges().end(); ++i) { + for (Node::Arcs::const_iterator i = object->arcs().begin(); + i != object->arcs().end(); ++i) { _interface.connect(i->second->tail_path(), i->second->head_path()); } return; diff --git a/src/URIs.cpp b/src/URIs.cpp index 0fd39849..8dbf87a6 100644 --- a/src/URIs.cpp +++ b/src/URIs.cpp @@ -61,18 +61,18 @@ URIs::URIs(Forge& f, URIMap* map) , bufsz_minBlockLength (forge, map, LV2_BUF_SIZE__minBlockLength) , bufsz_sequenceSize (forge, map, LV2_BUF_SIZE__sequenceSize) , doap_name (forge, map, "http://usefulinc.com/ns/doap#name") + , ingen_Arc (forge, map, NS_INGEN "Arc") , ingen_Block (forge, map, NS_INGEN "Block") - , ingen_Edge (forge, map, NS_INGEN "Edge") , ingen_Graph (forge, map, NS_INGEN "Graph") , ingen_Internal (forge, map, NS_INGEN "Internal") , ingen_activity (forge, map, NS_INGEN "activity") + , ingen_arc (forge, map, NS_INGEN "arc") , ingen_block (forge, map, NS_INGEN "block") , ingen_broadcast (forge, map, NS_INGEN "broadcast") , ingen_canvasX (forge, map, NS_INGEN "canvasX") , ingen_canvasY (forge, map, NS_INGEN "canvasY") , ingen_controlBinding (forge, map, NS_INGEN "controlBinding") , ingen_document (forge, map, NS_INGEN "document") - , ingen_edge (forge, map, NS_INGEN "edge") , ingen_enabled (forge, map, NS_INGEN "enabled") , ingen_engine (forge, map, NS_INGEN "engine") , ingen_head (forge, map, NS_INGEN "head") diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index fe79336b..6b2c1540 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -15,11 +15,11 @@ */ #include "ingen/Log.hpp" -#include "ingen/client/ClientStore.hpp" -#include "ingen/client/EdgeModel.hpp" +#include "ingen/client/ArcModel.hpp" #include "ingen/client/BlockModel.hpp" -#include "ingen/client/ObjectModel.hpp" +#include "ingen/client/ClientStore.hpp" #include "ingen/client/GraphModel.hpp" +#include "ingen/client/ObjectModel.hpp" #include "ingen/client/PluginModel.hpp" #include "ingen/client/PortModel.hpp" #include "ingen/client/SigClientInterface.hpp" @@ -391,7 +391,7 @@ ClientStore::connection_graph(const Raul::Path& tail_path, graph = PtrCast<GraphModel>(_object(tail_path.parent().parent())); if (!graph) - _log.error(Raul::fmt("Unable to find graph for edge %1% => %2%\n") + _log.error(Raul::fmt("Unable to find graph for arc %1% => %2%\n") % tail_path % head_path); return graph; @@ -406,12 +406,12 @@ ClientStore::attempt_connection(const Raul::Path& tail_path, if (tail && head) { SharedPtr<GraphModel> graph = connection_graph(tail_path, head_path); - SharedPtr<EdgeModel> cm(new EdgeModel(tail, head)); + SharedPtr<ArcModel> arc(new ArcModel(tail, head)); tail->connected_to(head); head->connected_to(tail); - graph->add_edge(cm); + graph->add_arc(arc); return true; } else { _log.warn(Raul::fmt("Failed to connect %1% => %2%\n") @@ -442,7 +442,7 @@ ClientStore::disconnect(const Raul::Path& src_path, SharedPtr<GraphModel> graph = connection_graph(src_path, dst_path); if (graph) - graph->remove_edge(tail.get(), head.get()); + graph->remove_arc(tail.get(), head.get()); } void @@ -458,17 +458,17 @@ ClientStore::disconnect_all(const Raul::Path& parent_graph, return; } - const GraphModel::Edges edges = graph->edges(); - for (GraphModel::Edges::const_iterator i = edges.begin(); - i != edges.end(); ++i) { - SharedPtr<EdgeModel> c = PtrCast<EdgeModel>(i->second); - if (c->tail()->parent() == object - || c->head()->parent() == object - || c->tail()->path() == path - || c->head()->path() == path) { - c->tail()->disconnected_from(c->head()); - c->head()->disconnected_from(c->tail()); - graph->remove_edge(c->tail().get(), c->head().get()); + const GraphModel::Arcs arcs = graph->arcs(); + for (GraphModel::Arcs::const_iterator i = arcs.begin(); + i != arcs.end(); ++i) { + SharedPtr<ArcModel> arc = PtrCast<ArcModel>(i->second); + if (arc->tail()->parent() == object + || arc->head()->parent() == object + || arc->tail()->path() == path + || arc->head()->path() == path) { + arc->tail()->disconnected_from(arc->head()); + arc->head()->disconnected_from(arc->tail()); + graph->remove_arc(arc->tail().get(), arc->head().get()); } } } diff --git a/src/client/GraphModel.cpp b/src/client/GraphModel.cpp index fe838725..98155138 100644 --- a/src/client/GraphModel.cpp +++ b/src/client/GraphModel.cpp @@ -17,9 +17,9 @@ #include <cassert> #include "ingen/URIs.hpp" +#include "ingen/client/ArcModel.hpp" #include "ingen/client/BlockModel.hpp" #include "ingen/client/ClientStore.hpp" -#include "ingen/client/EdgeModel.hpp" #include "ingen/client/GraphModel.hpp" using namespace std; @@ -52,19 +52,17 @@ GraphModel::remove_child(SharedPtr<ObjectModel> o) // Remove any connections which referred to this object, // since they can't possibly exist anymore - for (Edges::iterator j = _edges.begin(); j != _edges.end();) { - Edges::iterator next = j; + for (Arcs::iterator j = _arcs.begin(); j != _arcs.end();) { + Arcs::iterator next = j; ++next; - SharedPtr<EdgeModel> cm = PtrCast<EdgeModel>(j->second); - assert(cm); - - if (cm->tail_path().parent() == o->path() - || cm->tail_path() == o->path() - || cm->head_path().parent() == o->path() - || cm->head_path() == o->path()) { - _signal_removed_edge.emit(cm); - _edges.erase(j); // cuts our reference + SharedPtr<ArcModel> arc = PtrCast<ArcModel>(j->second); + if (arc->tail_path().parent() == o->path() + || arc->tail_path() == o->path() + || arc->head_path().parent() == o->path() + || arc->head_path() == o->path()) { + _signal_removed_arc.emit(arc); + _arcs.erase(j); // cuts our reference } j = next; } @@ -84,67 +82,68 @@ GraphModel::remove_child(SharedPtr<ObjectModel> o) void GraphModel::clear() { - _edges.clear(); + _arcs.clear(); BlockModel::clear(); - assert(_edges.empty()); + assert(_arcs.empty()); assert(_ports.empty()); } -SharedPtr<EdgeModel> -GraphModel::get_edge(const Node* tail, const Node* head) +SharedPtr<ArcModel> +GraphModel::get_arc(const Node* tail, const Node* head) { - Edges::iterator i = _edges.find(make_pair(tail, head)); - if (i != _edges.end()) - return PtrCast<EdgeModel>(i->second); + Arcs::iterator i = _arcs.find(make_pair(tail, head)); + if (i != _arcs.end()) + return PtrCast<ArcModel>(i->second); else - return SharedPtr<EdgeModel>(); + return SharedPtr<ArcModel>(); } /** Add a connection to this graph. * - * A reference to @a cm is taken, released on deletion or removal. - * If @a cm only contains paths (not pointers to the actual ports), the ports + * A reference to @p arc is taken, released on deletion or removal. + * If @p arc only contains paths (not pointers to the actual ports), the ports * will be found and set. The ports referred to not existing as children of * this graph is a fatal error. */ void -GraphModel::add_edge(SharedPtr<EdgeModel> cm) +GraphModel::add_arc(SharedPtr<ArcModel> arc) { // Store should have 'resolved' the connection already - assert(cm); - assert(cm->tail()); - assert(cm->head()); - assert(cm->tail()->parent()); - assert(cm->head()->parent()); - assert(cm->tail_path() != cm->head_path()); - assert(cm->tail()->parent().get() == this - || cm->tail()->parent()->parent().get() == this); - assert(cm->head()->parent().get() == this - || cm->head()->parent()->parent().get() == this); - - SharedPtr<EdgeModel> existing = get_edge( - cm->tail().get(), cm->head().get()); + assert(arc); + assert(arc->tail()); + assert(arc->head()); + assert(arc->tail()->parent()); + assert(arc->head()->parent()); + assert(arc->tail_path() != arc->head_path()); + assert(arc->tail()->parent().get() == this + || arc->tail()->parent()->parent().get() == this); + assert(arc->head()->parent().get() == this + || arc->head()->parent()->parent().get() == this); + + SharedPtr<ArcModel> existing = get_arc( + arc->tail().get(), arc->head().get()); if (existing) { - assert(cm->tail() == existing->tail()); - assert(cm->head() == existing->head()); + assert(arc->tail() == existing->tail()); + assert(arc->head() == existing->head()); } else { - _edges.insert(make_pair(make_pair(cm->tail().get(), - cm->head().get()), cm)); - _signal_new_edge.emit(cm); + _arcs.insert(make_pair(make_pair(arc->tail().get(), + arc->head().get()), + arc)); + _signal_new_arc.emit(arc); } } void -GraphModel::remove_edge(const Node* tail, const Node* head) +GraphModel::remove_arc(const Node* tail, const Node* head) { - Edges::iterator i = _edges.find(make_pair(tail, head)); - if (i != _edges.end()) { - SharedPtr<EdgeModel> c = PtrCast<EdgeModel>(i->second); - _signal_removed_edge.emit(c); - _edges.erase(i); + Arcs::iterator i = _arcs.find(make_pair(tail, head)); + if (i != _arcs.end()) { + SharedPtr<ArcModel> arc = PtrCast<ArcModel>(i->second); + _signal_removed_arc.emit(arc); + _arcs.erase(i); } } diff --git a/src/gui/Edge.cpp b/src/gui/Arc.cpp index 9916959e..b75f30ae 100644 --- a/src/gui/Edge.cpp +++ b/src/gui/Arc.cpp @@ -14,18 +14,18 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "Edge.hpp" +#include "Arc.hpp" namespace Ingen { namespace GUI { -Edge::Edge(Ganv::Canvas& canvas, - boost::shared_ptr<const Client::EdgeModel> model, - Ganv::Node* src, - Ganv::Node* dst, - uint32_t color) +Arc::Arc(Ganv::Canvas& canvas, + boost::shared_ptr<const Client::ArcModel> model, + Ganv::Node* src, + Ganv::Node* dst, + uint32_t color) : Ganv::Edge(canvas, src, dst, color) - , _edge_model(model) + , _arc_model(model) { } diff --git a/src/gui/Edge.hpp b/src/gui/Arc.hpp index cf1dafe8..df6dfbfb 100644 --- a/src/gui/Edge.hpp +++ b/src/gui/Arc.hpp @@ -14,8 +14,8 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef INGEN_GUI_EDGE_HPP -#define INGEN_GUI_EDGE_HPP +#ifndef INGEN_GUI_ARC_HPP +#define INGEN_GUI_ARC_HPP #include <cassert> @@ -24,27 +24,27 @@ namespace Ingen { -namespace Client { class EdgeModel; } +namespace Client { class ArcModel; } namespace GUI { -/** An Edge in a Graph. +/** An Arc (directed edge) in a Graph. * * \ingroup GUI */ -class Edge : public Ganv::Edge +class Arc : public Ganv::Edge { public: - Edge(Ganv::Canvas& canvas, - boost::shared_ptr<const Client::EdgeModel> model, - Ganv::Node* src, - Ganv::Node* dst, - uint32_t color); + Arc(Ganv::Canvas& canvas, + boost::shared_ptr<const Client::ArcModel> model, + Ganv::Node* src, + Ganv::Node* dst, + uint32_t color); - SharedPtr<const Client::EdgeModel> model() const { return _edge_model; } + SharedPtr<const Client::ArcModel> model() const { return _arc_model; } private: - SharedPtr<const Client::EdgeModel> _edge_model; + SharedPtr<const Client::ArcModel> _arc_model; }; } // namespace GUI diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 86b21cc2..d35e678f 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -38,7 +38,7 @@ #include "lv2/lv2plug.in/ns/ext/atom/atom.h" #include "App.hpp" -#include "Edge.hpp" +#include "Arc.hpp" #include "GraphCanvas.hpp" #include "GraphPortModule.hpp" #include "GraphWindow.hpp" @@ -142,9 +142,9 @@ GraphCanvas::GraphCanvas(App& app, sigc::mem_fun(this, &GraphCanvas::add_port)); _graph->signal_removed_port().connect( sigc::mem_fun(this, &GraphCanvas::remove_port)); - _graph->signal_new_edge().connect( + _graph->signal_new_arc().connect( sigc::mem_fun(this, &GraphCanvas::connection)); - _graph->signal_removed_edge().connect( + _graph->signal_removed_arc().connect( sigc::mem_fun(this, &GraphCanvas::disconnection)); _app.store()->signal_new_plugin().connect( @@ -321,10 +321,10 @@ GraphCanvas::build() add_port(*i); } - // Create edges - for (GraphModel::Edges::const_iterator i = _graph->edges().begin(); - i != _graph->edges().end(); ++i) { - connection(PtrCast<EdgeModel>(i->second)); + // Create arcs + for (GraphModel::Arcs::const_iterator i = _graph->arcs().begin(); + i != _graph->arcs().end(); ++i) { + connection(PtrCast<ArcModel>(i->second)); } } @@ -500,30 +500,30 @@ GraphCanvas::get_port_view(SharedPtr<PortModel> port) } void -GraphCanvas::connection(SharedPtr<const EdgeModel> cm) +GraphCanvas::connection(SharedPtr<const ArcModel> arc) { - Ganv::Port* const tail = get_port_view(cm->tail()); - Ganv::Port* const head = get_port_view(cm->head()); + Ganv::Port* const tail = get_port_view(arc->tail()); + Ganv::Port* const head = get_port_view(arc->head()); if (tail && head) { - new GUI::Edge(*this, cm, tail, head, tail->get_fill_color()); + new GUI::Arc(*this, arc, tail, head, tail->get_fill_color()); } else { _app.log().error(Raul::fmt("Unable to find ports to connect %1% => %2%\n") - % cm->tail_path() % cm->head_path()); + % arc->tail_path() % arc->head_path()); } } void -GraphCanvas::disconnection(SharedPtr<const EdgeModel> cm) +GraphCanvas::disconnection(SharedPtr<const ArcModel> arc) { - Ganv::Port* const src = get_port_view(cm->tail()); - Ganv::Port* const dst = get_port_view(cm->head()); + Ganv::Port* const src = get_port_view(arc->tail()); + Ganv::Port* const dst = get_port_view(arc->head()); if (src && dst) { remove_edge(src, dst); } else { _app.log().error(Raul::fmt("Unable to find ports to disconnect %1% => %2%\n") - % cm->tail_path() % cm->head_path()); + % arc->tail_path() % arc->head_path()); } } @@ -647,13 +647,13 @@ destroy_node(GanvNode* node, void* data) } static void -destroy_edge(GanvEdge* edge, void* data) +destroy_arc(GanvEdge* arc, void* data) { - App* app = (App*)data; - Ganv::Edge* edgemm = Glib::wrap(edge); + App* app = (App*)data; + Ganv::Edge* arcmm = Glib::wrap(arc); - Port* tail = dynamic_cast<Port*>(edgemm->get_tail()); - Port* head = dynamic_cast<Port*>(edgemm->get_head()); + Port* tail = dynamic_cast<Port*>(arcmm->get_tail()); + Port* head = dynamic_cast<Port*>(arcmm->get_head()); app->interface()->disconnect(tail->model()->path(), head->model()->path()); } @@ -661,7 +661,7 @@ void GraphCanvas::destroy_selection() { for_each_selected_node(destroy_node, &_app); - for_each_selected_edge(destroy_edge, &_app); + for_each_selected_edge(destroy_arc, &_app); } static void @@ -686,16 +686,16 @@ serialise_node(GanvNode* node, void* data) } static void -serialise_edge(GanvEdge* edge, void* data) +serialise_arc(GanvEdge* arc, void* data) { Serialisation::Serialiser* serialiser = (Serialisation::Serialiser*)data; - if (!GANV_IS_EDGE(edge)) { + if (!GANV_IS_EDGE(arc)) { return; } - GUI::Edge* gedge = dynamic_cast<GUI::Edge*>(Glib::wrap(GANV_EDGE(edge))); - if (gedge) { - serialiser->serialise_edge(Sord::Node(), gedge->model()); + GUI::Arc* garc = dynamic_cast<GUI::Arc*>(Glib::wrap(GANV_EDGE(arc))); + if (garc) { + serialiser->serialise_arc(Sord::Node(), garc->model()); } } @@ -707,7 +707,7 @@ GraphCanvas::copy_selection() serialiser.start_to_string(_graph->path(), base_uri); for_each_selected_node(serialise_node, &serialiser); - for_each_selected_edge(serialise_edge, &serialiser); + for_each_selected_edge(serialise_arc, &serialiser); const std::string result = serialiser.finish(); _paste_count = 0; diff --git a/src/gui/GraphCanvas.hpp b/src/gui/GraphCanvas.hpp index 3fb00619..1d04e582 100644 --- a/src/gui/GraphCanvas.hpp +++ b/src/gui/GraphCanvas.hpp @@ -32,7 +32,7 @@ #include "NodeModule.hpp" #include "ingen/Node.hpp" -#include "ingen/client/EdgeModel.hpp" +#include "ingen/client/ArcModel.hpp" namespace Ingen { @@ -68,8 +68,8 @@ public: void remove_block(SharedPtr<const Client::BlockModel> bm); void add_port(SharedPtr<const Client::PortModel> pm); void remove_port(SharedPtr<const Client::PortModel> pm); - void connection(SharedPtr<const Client::EdgeModel> cm); - void disconnection(SharedPtr<const Client::EdgeModel> cm); + void connection(SharedPtr<const Client::ArcModel> am); + void disconnection(SharedPtr<const Client::ArcModel> am); void get_new_module_location(double& x, double& y); diff --git a/src/gui/wscript b/src/gui/wscript index 4732e56f..1f0a567f 100644 --- a/src/gui/wscript +++ b/src/gui/wscript @@ -28,9 +28,9 @@ def build(bld): obj.source = ''' App.cpp + Arc.cpp BreadCrumbs.cpp ConnectWindow.cpp - Edge.cpp GraphBox.cpp GraphCanvas.cpp GraphPortModule.cpp diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index 0c15b0b4..3a283641 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -87,6 +87,7 @@ skip_property(const Sord::Node& predicate) { return (predicate.to_string() == "http://drobilla.net/ns/ingen#node" || predicate.to_string() == "http://drobilla.net/ns/ingen#edge" + || predicate.to_string() == "http://drobilla.net/ns/ingen#arc" || predicate.to_string() == LV2_CORE__port); } @@ -207,7 +208,7 @@ parse_properties( boost::optional<Resource::Properties> data = boost::optional<Resource::Properties>()); static bool -parse_edges( +parse_arcs( World* world, Interface* target, Sord::Model& model, @@ -378,17 +379,17 @@ parse_graph(Ingen::World* world, i->second.second); } - parse_edges(world, target, model, subject_node, graph_path); + parse_arcs(world, target, model, subject_node, graph_path); return graph_path; } static bool -parse_edge(Ingen::World* world, - Ingen::Interface* target, - Sord::Model& model, - const Sord::Node& subject, - const Raul::Path& graph) +parse_arc(Ingen::World* world, + Ingen::Interface* target, + Sord::Model& model, + const Sord::Node& subject, + const Raul::Path& graph) { URIs& uris = world->uris(); @@ -402,32 +403,32 @@ parse_edge(Ingen::World* world, const Glib::ustring& base_uri = model.base_uri().to_string(); if (t.end()) { - world->log().error("Edge has no tail"); + world->log().error("Arc has no tail"); return false; } else if (h.end()) { - world->log().error("Edge has no head"); + world->log().error("Arc has no head"); return false; } const std::string tail_str = relative_uri( base_uri, t.get_object().to_string(), true); if (!Raul::Path::is_valid(tail_str)) { - world->log().error("Edge tail has invalid URI"); + world->log().error("Arc tail has invalid URI"); return false; } const std::string head_str = relative_uri( base_uri, h.get_object().to_string(), true); if (!Raul::Path::is_valid(head_str)) { - world->log().error("Edge head has invalid URI"); + world->log().error("Arc head has invalid URI"); return false; } if (!(++t).end()) { - world->log().error("Edge has multiple tails"); + world->log().error("Arc has multiple tails"); return false; } else if (!(++h).end()) { - world->log().error("Edge has multiple heads"); + world->log().error("Arc has multiple heads"); return false; } @@ -438,17 +439,24 @@ parse_edge(Ingen::World* world, } static bool -parse_edges(Ingen::World* world, - Ingen::Interface* target, - Sord::Model& model, - const Sord::Node& subject, - const Raul::Path& graph) +parse_arcs(Ingen::World* world, + Ingen::Interface* target, + Sord::Model& model, + const Sord::Node& subject, + const Raul::Path& graph) { - const Sord::URI ingen_edge(*world->rdf_world(), world->uris().ingen_edge); + const Sord::URI ingen_arc(*world->rdf_world(), world->uris().ingen_arc); const Sord::Node nil; + for (Sord::Iter i = model.find(subject, ingen_arc, nil); !i.end(); ++i) { + parse_arc(world, target, model, i.get_object(), graph); + } + + // Backwards compatibility, support ingen:edge predicate + const Sord::URI ingen_edge(*world->rdf_world(), + "http://drobilla.net/ns/ingen#edge"); for (Sord::Iter i = model.find(subject, ingen_edge, nil); !i.end(); ++i) { - parse_edge(world, target, model, i.get_object(), graph); + parse_arc(world, target, model, i.get_object(), graph); } return true; @@ -487,7 +495,7 @@ parse(Ingen::World* world, const Sord::URI graph_class (*world->rdf_world(), uris.ingen_Graph); const Sord::URI block_class (*world->rdf_world(), uris.ingen_Block); - const Sord::URI edge_class (*world->rdf_world(), uris.ingen_Edge); + const Sord::URI arc_class (*world->rdf_world(), uris.ingen_Arc); const Sord::URI internal_class(*world->rdf_world(), uris.ingen_Internal); const Sord::URI in_port_class (*world->rdf_world(), LV2_CORE__InputPort); const Sord::URI out_port_class(*world->rdf_world(), LV2_CORE__OutputPort); @@ -534,9 +542,9 @@ parse(Ingen::World* world, parse_properties( world, target, model, s, Node::path_to_uri(path), data); ret = path; - } else if (types.find(edge_class) != types.end()) { + } else if (types.find(arc_class) != types.end()) { Raul::Path parent_path(parent ? parent.get() : Raul::Path("/")); - parse_edge(world, target, model, s, parent_path); + parse_arc(world, target, model, s, parent_path); } else { world->log().error("Subject has no known types\n"); } diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index e3781a01..85ecbfb4 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -26,7 +26,7 @@ #include <glibmm/miscutils.h> #include <glibmm/module.h> -#include "ingen/Edge.hpp" +#include "ingen/Arc.hpp" #include "ingen/Interface.hpp" #include "ingen/Log.hpp" #include "ingen/Node.hpp" @@ -89,8 +89,8 @@ struct Serialiser::Impl { SharedPtr<const Node> graph, const std::string& graph_symbol); - void serialise_edge(const Sord::Node& parent, - SharedPtr<const Edge> c) + void serialise_arc(const Sord::Node& parent, + SharedPtr<const Arc> a) throw (std::logic_error); std::string finish(); @@ -413,9 +413,9 @@ Serialiser::Impl::serialise_graph(SharedPtr<const Node> graph, serialise_port(p, Resource::INTERNAL, port_id); } - for (Node::Edges::const_iterator c = graph->edges().begin(); - c != graph->edges().end(); ++c) { - serialise_edge(graph_id, c->second); + for (Node::Arcs::const_iterator a = graph->arcs().begin(); + a != graph->arcs().end(); ++a) { + serialise_arc(graph_id, a->second); } } @@ -481,43 +481,43 @@ Serialiser::Impl::serialise_port(const Node* port, } void -Serialiser::serialise_edge(const Sord::Node& parent, - SharedPtr<const Edge> edge) +Serialiser::serialise_arc(const Sord::Node& parent, + SharedPtr<const Arc> arc) throw (std::logic_error) { - return me->serialise_edge(parent, edge); + return me->serialise_arc(parent, arc); } void -Serialiser::Impl::serialise_edge(const Sord::Node& parent, - SharedPtr<const Edge> edge) +Serialiser::Impl::serialise_arc(const Sord::Node& parent, + SharedPtr<const Arc> arc) throw (std::logic_error) { if (!_model) throw std::logic_error( - "serialise_edge called without serialisation in progress"); + "serialise_arc called without serialisation in progress"); Sord::World& world = _model->world(); const URIs& uris = _world.uris(); - const Sord::Node src = path_rdf_node(edge->tail_path()); - const Sord::Node dst = path_rdf_node(edge->head_path()); - const Sord::Node edge_id = Sord::Node::blank_id(*_world.rdf_world()); - _model->add_statement(edge_id, + const Sord::Node src = path_rdf_node(arc->tail_path()); + const Sord::Node dst = path_rdf_node(arc->head_path()); + const Sord::Node arc_id = Sord::Node::blank_id(*_world.rdf_world()); + _model->add_statement(arc_id, Sord::URI(world, uris.ingen_tail), src); - _model->add_statement(edge_id, + _model->add_statement(arc_id, Sord::URI(world, uris.ingen_head), dst); if (parent.is_valid()) { _model->add_statement(parent, - Sord::URI(world, uris.ingen_edge), - edge_id); + Sord::URI(world, uris.ingen_arc), + arc_id); } else { - _model->add_statement(edge_id, + _model->add_statement(arc_id, Sord::URI(world, uris.rdf_type), - Sord::URI(world, uris.ingen_Edge)); + Sord::URI(world, uris.ingen_Arc)); } } diff --git a/src/server/EdgeImpl.cpp b/src/server/ArcImpl.cpp index 08096d45..debd2c1e 100644 --- a/src/server/EdgeImpl.cpp +++ b/src/server/ArcImpl.cpp @@ -17,10 +17,10 @@ #include "ingen/URIs.hpp" #include "lv2/lv2plug.in/ns/ext/atom/util.h" +#include "ArcImpl.hpp" #include "BlockImpl.hpp" #include "Buffer.hpp" #include "BufferFactory.hpp" -#include "EdgeImpl.hpp" #include "Engine.hpp" #include "InputPort.hpp" #include "OutputPort.hpp" @@ -29,12 +29,12 @@ namespace Ingen { namespace Server { -/** Constructor for a edge from a block's output port. +/** Constructor for an arc from a block's output port. * * This handles both polyphonic and monophonic blocks, transparently to the * user (InputPort). */ -EdgeImpl::EdgeImpl(PortImpl* tail, PortImpl* head) +ArcImpl::ArcImpl(PortImpl* tail, PortImpl* head) : _tail(tail) , _head(head) { @@ -43,19 +43,19 @@ EdgeImpl::EdgeImpl(PortImpl* tail, PortImpl* head) } const Raul::Path& -EdgeImpl::tail_path() const +ArcImpl::tail_path() const { return _tail->path(); } const Raul::Path& -EdgeImpl::head_path() const +ArcImpl::head_path() const { return _head->path(); } BufferRef -EdgeImpl::buffer(uint32_t voice) const +ArcImpl::buffer(uint32_t voice) const { assert(!must_mix()); assert(_tail->poly() == 1 || _tail->poly() > voice); @@ -67,13 +67,13 @@ EdgeImpl::buffer(uint32_t voice) const } bool -EdgeImpl::must_mix() const +ArcImpl::must_mix() const { return _tail->poly() > _head->poly(); } bool -EdgeImpl::can_connect(const OutputPort* src, const InputPort* dst) +ArcImpl::can_connect(const OutputPort* src, const InputPort* dst) { const Ingen::URIs& uris = src->bufs().uris(); return ( diff --git a/src/server/EdgeImpl.hpp b/src/server/ArcImpl.hpp index 0627a7ba..a28616da 100644 --- a/src/server/EdgeImpl.hpp +++ b/src/server/ArcImpl.hpp @@ -14,15 +14,15 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef INGEN_ENGINE_EDGE_IMPL_HPP -#define INGEN_ENGINE_EDGE_IMPL_HPP +#ifndef INGEN_ENGINE_ARC_IMPL_HPP +#define INGEN_ENGINE_ARC_IMPL_HPP #include <cstdlib> #include <boost/intrusive/slist.hpp> #include <boost/utility.hpp> -#include "ingen/Edge.hpp" +#include "ingen/Arc.hpp" #include "lv2/lv2plug.in/ns/ext/atom/atom.h" #include "raul/Deletable.hpp" @@ -48,14 +48,14 @@ class InputPort; * * \ingroup engine */ -class EdgeImpl +class ArcImpl : private Raul::Noncopyable - , public Edge + , public Arc , public boost::intrusive::slist_base_hook< boost::intrusive::link_mode<boost::intrusive::auto_unlink> > { public: - EdgeImpl(PortImpl* tail, PortImpl* head); + ArcImpl(PortImpl* tail, PortImpl* head); inline PortImpl* tail() const { return _tail; } inline PortImpl* head() const { return _head; } @@ -64,13 +64,13 @@ public: const Raul::Path& head_path() const; /** Get the buffer for a particular voice. - * An Edge is smart - it knows the destination port requesting the + * An Arc is smart - it knows the destination port requesting the * buffer, and will return accordingly (e.g. the same buffer for every - * voice in a mono->poly edge). + * voice in a mono->poly arc). */ BufferRef buffer(uint32_t voice) const; - /** Whether this edge must mix down voices into a local buffer */ + /** Whether this arc must mix down voices into a local buffer */ bool must_mix() const; static bool can_connect(const OutputPort* src, const InputPort* dst); @@ -83,4 +83,4 @@ protected: } // namespace Server } // namespace Ingen -#endif // INGEN_ENGINE_EDGEIMPL_HPP +#endif // INGEN_ENGINE_ARC_IMPL_HPP diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp index 2353b977..5859d071 100644 --- a/src/server/GraphImpl.cpp +++ b/src/server/GraphImpl.cpp @@ -21,10 +21,10 @@ #include "ingen/World.hpp" #include "raul/Maid.hpp" +#include "ArcImpl.hpp" #include "BlockImpl.hpp" #include "BufferFactory.hpp" #include "DuplexPort.hpp" -#include "EdgeImpl.hpp" #include "Engine.hpp" #include "GraphImpl.hpp" #include "GraphPlugin.hpp" @@ -198,35 +198,35 @@ GraphImpl::remove_block(BlockImpl& block) } void -GraphImpl::add_edge(SharedPtr<EdgeImpl> c) +GraphImpl::add_arc(SharedPtr<ArcImpl> a) { ThreadManager::assert_thread(THREAD_PRE_PROCESS); - _edges.insert(make_pair(make_pair(c->tail(), c->head()), c)); + _arcs.insert(make_pair(make_pair(a->tail(), a->head()), a)); } -/** Remove a edge. +/** Remove an arc. * Preprocessing thread only. */ -SharedPtr<EdgeImpl> -GraphImpl::remove_edge(const PortImpl* tail, const PortImpl* dst_port) +SharedPtr<ArcImpl> +GraphImpl::remove_arc(const PortImpl* tail, const PortImpl* dst_port) { ThreadManager::assert_thread(THREAD_PRE_PROCESS); - Edges::iterator i = _edges.find(make_pair(tail, dst_port)); - if (i != _edges.end()) { - SharedPtr<EdgeImpl> c = PtrCast<EdgeImpl>(i->second); - _edges.erase(i); - return c; + Arcs::iterator i = _arcs.find(make_pair(tail, dst_port)); + if (i != _arcs.end()) { + SharedPtr<ArcImpl> arc = PtrCast<ArcImpl>(i->second); + _arcs.erase(i); + return arc; } else { - return SharedPtr<EdgeImpl>(); + return SharedPtr<ArcImpl>(); } } bool -GraphImpl::has_edge(const PortImpl* tail, const PortImpl* dst_port) const +GraphImpl::has_arc(const PortImpl* tail, const PortImpl* dst_port) const { ThreadManager::assert_thread(THREAD_PRE_PROCESS); - Edges::const_iterator i = _edges.find(make_pair(tail, dst_port)); - return (i != _edges.end()); + Arcs::const_iterator i = _arcs.find(make_pair(tail, dst_port)); + return (i != _arcs.end()); } void diff --git a/src/server/GraphImpl.hpp b/src/server/GraphImpl.hpp index 9ef707fc..2e534ca7 100644 --- a/src/server/GraphImpl.hpp +++ b/src/server/GraphImpl.hpp @@ -28,13 +28,13 @@ namespace Ingen { -class Edge; +class Arc; namespace Server { +class ArcImpl; class CompiledGraph; class Context; -class EdgeImpl; class Engine; class ProcessContext; @@ -128,12 +128,12 @@ public: void remove_port(DuplexPort& port); void clear_ports(); - void add_edge(SharedPtr<EdgeImpl> c); + void add_arc(SharedPtr<ArcImpl> arc); - SharedPtr<EdgeImpl> remove_edge(const PortImpl* tail, - const PortImpl* head); + SharedPtr<ArcImpl> remove_arc(const PortImpl* tail, + const PortImpl* head); - bool has_edge(const PortImpl* tail, const PortImpl* head) const; + bool has_arc(const PortImpl* tail, const PortImpl* head) const; void set_compiled_graph(CompiledGraph* cp); diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp index a272b305..9ab3cbfe 100644 --- a/src/server/InputPort.cpp +++ b/src/server/InputPort.cpp @@ -20,10 +20,10 @@ #include "ingen/Log.hpp" #include "ingen/URIs.hpp" +#include "ArcImpl.hpp" #include "BlockImpl.hpp" #include "Buffer.hpp" #include "BufferFactory.hpp" -#include "EdgeImpl.hpp" #include "Engine.hpp" #include "GraphImpl.hpp" #include "InputPort.hpp" @@ -46,7 +46,7 @@ InputPort::InputPort(BufferFactory& bufs, const Raul::Atom& value, size_t buffer_size) : PortImpl(bufs, parent, symbol, index, poly, type, buffer_type, value, buffer_size) - , _num_edges(0) + , _num_arcs(0) { const Ingen::URIs& uris = bufs.uris(); @@ -82,21 +82,21 @@ InputPort::get_buffers(BufferFactory& bufs, uint32_t poly, bool real_time) const { - const size_t num_edges = real_time ? _edges.size() : _num_edges; + const size_t num_arcs = real_time ? _arcs.size() : _num_arcs; - if (is_a(PortType::AUDIO) && num_edges == 0) { - // Audio input with no edges, use shared zero buffer + if (is_a(PortType::AUDIO) && num_arcs == 0) { + // Audio input with no arcs, use shared zero buffer for (uint32_t v = 0; v < poly; ++v) { buffers->at(v) = bufs.silent_buffer(); } return false; - } else if (num_edges == 1) { + } else if (num_arcs == 1) { if (real_time) { - if (!_edges.front().must_mix()) { + if (!_arcs.front().must_mix()) { // Single non-mixing connection, use buffers directly for (uint32_t v = 0; v < poly; ++v) { - buffers->at(v) = _edges.front().buffer(v); + buffers->at(v) = _arcs.front().buffer(v); } return false; } @@ -112,50 +112,50 @@ InputPort::get_buffers(BufferFactory& bufs, return true; } -/** Add a edge. Realtime safe. +/** Add an arc. Realtime safe. * - * The buffer of this port will be set directly to the edge's buffer - * if there is only one edge, since no copying/mixing needs to take place. + * The buffer of this port will be set directly to the arc's buffer + * if there is only one arc, since no copying/mixing needs to take place. * * Note that setup_buffers must be called after this before the change * will audibly take effect. */ void -InputPort::add_edge(ProcessContext& context, EdgeImpl* c) +InputPort::add_arc(ProcessContext& context, ArcImpl* c) { - _edges.push_front(*c); + _arcs.push_front(*c); if (_type != PortType::CV) { _broadcast = true; // Broadcast value/activity of connected input } } -/** Remove a edge. Realtime safe. +/** Remove a arc. Realtime safe. * * Note that setup_buffers must be called after this before the change * will audibly take effect. */ -EdgeImpl* -InputPort::remove_edge(ProcessContext& context, const OutputPort* tail) +ArcImpl* +InputPort::remove_arc(ProcessContext& context, const OutputPort* tail) { - EdgeImpl* edge = NULL; - for (Edges::iterator i = _edges.begin(); i != _edges.end(); ++i) { + ArcImpl* arc = NULL; + for (Arcs::iterator i = _arcs.begin(); i != _arcs.end(); ++i) { if (i->tail() == tail) { - edge = &*i; - _edges.erase(i); + arc = &*i; + _arcs.erase(i); break; } } - if (!edge) { - context.engine().log().error("Attempt to remove non-existent edge\n"); + if (!arc) { + context.engine().log().error("Attempt to remove non-existent arc\n"); return NULL; } - if (_edges.empty()) { + if (_arcs.empty()) { _broadcast = false; // Turn off broadcasting if no longer connected } - return edge; + return arc; } uint32_t @@ -165,24 +165,24 @@ InputPort::max_tail_poly(Context& context) const } static void -get_sources(const Context& context, - const EdgeImpl& edge, - uint32_t voice, - const Buffer** srcs, - uint32_t max_num_srcs, - uint32_t& num_srcs) +get_sources(const Context& context, + const ArcImpl& arc, + uint32_t voice, + const Buffer** srcs, + uint32_t max_num_srcs, + uint32_t& num_srcs) { - if (edge.must_mix()) { + if (arc.must_mix()) { // Mixing down voices: all tail voices => one head voice - for (uint32_t v = 0; v < edge.tail()->poly(); ++v) { + for (uint32_t v = 0; v < arc.tail()->poly(); ++v) { assert(num_srcs < max_num_srcs); - srcs[num_srcs++] = edge.tail()->buffer(v).get(); + srcs[num_srcs++] = arc.tail()->buffer(v).get(); } } else { // Matching polyphony: each tail voice => corresponding head voice - assert(edge.tail()->poly() == edge.head()->poly()); + assert(arc.tail()->poly() == arc.head()->poly()); assert(num_srcs < max_num_srcs); - srcs[num_srcs++] = edge.tail()->buffer(voice).get(); + srcs[num_srcs++] = arc.tail()->buffer(voice).get(); } } @@ -195,23 +195,23 @@ InputPort::pre_process(Context& context) if (_set_by_user) return; - if (_edges.empty()) { + if (_arcs.empty()) { for (uint32_t v = 0; v < _poly; ++v) { update_set_state(context, v); } } else if (direct_connect()) { for (uint32_t v = 0; v < _poly; ++v) { - _buffers->at(v) = _edges.front().buffer(v); + _buffers->at(v) = _arcs.front().buffer(v); } } else { const uint32_t src_poly = max_tail_poly(context); - const uint32_t max_num_srcs = _edges.size() * src_poly; + const uint32_t max_num_srcs = _arcs.size() * src_poly; const Buffer* srcs[max_num_srcs]; for (uint32_t v = 0; v < _poly; ++v) { // Get all the sources for this voice uint32_t num_srcs = 0; - for (Edges::iterator e = _edges.begin(); e != _edges.end(); ++e) { + for (Arcs::iterator e = _arcs.begin(); e != _arcs.end(); ++e) { get_sources(context, *e, v, srcs, max_num_srcs, num_srcs); } @@ -241,9 +241,9 @@ InputPort::post_process(Context& context) bool InputPort::direct_connect() const { - return _edges.size() == 1 + return _arcs.size() == 1 && !_parent->path().is_root() - && !_edges.front().must_mix(); + && !_arcs.front().must_mix(); } } // namespace Server diff --git a/src/server/InputPort.hpp b/src/server/InputPort.hpp index 7a4c7669..faf323f0 100644 --- a/src/server/InputPort.hpp +++ b/src/server/InputPort.hpp @@ -24,13 +24,13 @@ #include "raul/SharedPtr.hpp" +#include "ArcImpl.hpp" #include "PortImpl.hpp" -#include "EdgeImpl.hpp" namespace Ingen { namespace Server { -class EdgeImpl; +class ArcImpl; class Context; class BlockImpl; class OutputPort; @@ -39,10 +39,10 @@ class ProcessContext; /** An input port on a Block or Graph. * * All ports have a Buffer, but the actual contents (data) of that buffer may be - * set directly to the incoming edge's buffer if there's only one inbound - * edge, to eliminate the need to copy/mix. + * set directly to the incoming arc's buffer if there's only one inbound + * arc, to eliminate the need to copy/mix. * - * If a port has multiple edges, they will be mixed down into the local + * If a port has multiple arcs, they will be mixed down into the local * buffer and it will be used. * * \ingroup engine @@ -62,15 +62,15 @@ public: virtual ~InputPort() {} - typedef boost::intrusive::slist<EdgeImpl, + typedef boost::intrusive::slist<ArcImpl, boost::intrusive::constant_time_size<false> - > Edges; + > Arcs; /** Return the maximum polyphony of an output connected to this input. */ virtual uint32_t max_tail_poly(Context& context) const; - void add_edge(ProcessContext& context, EdgeImpl* c); - EdgeImpl* remove_edge(ProcessContext& context, + void add_arc(ProcessContext& context, ArcImpl* c); + ArcImpl* remove_arc(ProcessContext& context, const OutputPort* tail); bool apply_poly(ProcessContext& context, Raul::Maid& maid, uint32_t poly); @@ -83,9 +83,9 @@ public: void pre_process(Context& context); void post_process(Context& context); - size_t num_edges() const { return _num_edges; } ///< Pre-process thread - void increment_num_edges() { ++_num_edges; } - void decrement_num_edges() { --_num_edges; } + size_t num_arcs() const { return _num_arcs; } ///< Pre-process thread + void increment_num_arcs() { ++_num_arcs; } + void decrement_num_arcs() { --_num_arcs; } bool is_input() const { return true; } bool is_output() const { return false; } @@ -93,8 +93,8 @@ public: bool direct_connect() const; protected: - size_t _num_edges; ///< Pre-process thread - Edges _edges; ///< Audio thread + size_t _num_arcs; ///< Pre-process thread + Arcs _arcs; ///< Audio thread }; } // namespace Server diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index a496bbb4..0559ec39 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -20,9 +20,9 @@ #include "raul/Maid.hpp" #include "raul/Path.hpp" +#include "ArcImpl.hpp" #include "Broadcaster.hpp" #include "Connect.hpp" -#include "EdgeImpl.hpp" #include "Engine.hpp" #include "GraphImpl.hpp" #include "InputPort.hpp" @@ -82,12 +82,12 @@ Connect::pre_process() return Event::pre_process_done(PARENT_DIFFERS, _head_path); } - if (!EdgeImpl::can_connect(tail_output, _head)) { + if (!ArcImpl::can_connect(tail_output, _head)) { return Event::pre_process_done(TYPE_MISMATCH, _head_path); } if (tail_block->parent_graph() != head_block->parent_graph()) { - // Edge to a graph port from inside the graph + // Arc to a graph port from inside the graph assert(tail_block->parent() == head_block || head_block->parent() == tail_block); if (tail_block->parent() == head_block) { _graph = dynamic_cast<GraphImpl*>(head_block); @@ -95,25 +95,25 @@ Connect::pre_process() _graph = dynamic_cast<GraphImpl*>(tail_block); } } else if (tail_block == head_block && dynamic_cast<GraphImpl*>(tail_block)) { - // Edge from a graph input to a graph output (pass through) + // Arc from a graph input to a graph output (pass through) _graph = dynamic_cast<GraphImpl*>(tail_block); } else { - // Normal edge between blocks with the same parent + // Normal arc between blocks with the same parent _graph = tail_block->parent_graph(); } - if (_graph->has_edge(tail_output, _head)) { + if (_graph->has_arc(tail_output, _head)) { return Event::pre_process_done(EXISTS, _head_path); } - _edge = SharedPtr<EdgeImpl>(new EdgeImpl(tail_output, _head)); + _arc = SharedPtr<ArcImpl>(new ArcImpl(tail_output, _head)); rlock.release(); { Glib::RWLock::ReaderLock wlock(_engine.store()->lock()); - /* Need to be careful about graph port edges here and adding a + /* Need to be careful about graph port arcs here and adding a block's parent as a dependant/provider, or adding a graph as its own provider... */ @@ -122,8 +122,8 @@ Connect::pre_process() tail_block->dependants().push_back(head_block); } - _graph->add_edge(_edge); - _head->increment_num_edges(); + _graph->add_arc(_arc); + _head->increment_num_arcs(); } _buffers = new Raul::Array<BufferRef>(_head->poly()); @@ -143,7 +143,7 @@ void Connect::execute(ProcessContext& context) { if (!_status) { - _head->add_edge(context, _edge.get()); + _head->add_arc(context, _arc.get()); _engine.maid()->dispose(_head->set_buffers(context, _buffers)); _head->connect_buffers(); _graph->set_compiled_graph(_compiled_graph); diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp index 445ee80e..a84b9fcf 100644 --- a/src/server/events/Connect.hpp +++ b/src/server/events/Connect.hpp @@ -30,15 +30,15 @@ template <typename T> class Array; namespace Ingen { namespace Server { +class ArcImpl; class CompiledGraph; -class EdgeImpl; +class GraphImpl; class InputPort; class OutputPort; -class GraphImpl; namespace Events { -/** Make an Edge between two Ports. +/** Make an Arc between two Ports. * * \ingroup engine */ @@ -62,7 +62,7 @@ private: GraphImpl* _graph; InputPort* _head; CompiledGraph* _compiled_graph; - SharedPtr<EdgeImpl> _edge; + SharedPtr<ArcImpl> _arc; Raul::Array<BufferRef>* _buffers; }; diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index 645d89c5..829500f5 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -22,10 +22,10 @@ #include "raul/Maid.hpp" #include "raul/Path.hpp" +#include "ArcImpl.hpp" #include "Broadcaster.hpp" #include "Buffer.hpp" #include "DuplexPort.hpp" -#include "EdgeImpl.hpp" #include "Engine.hpp" #include "GraphImpl.hpp" #include "InputPort.hpp" @@ -62,7 +62,7 @@ Disconnect::Impl::Impl(Engine& e, , _src_output_port(s) , _dst_input_port(d) , _graph(graph) - , _edge(graph->remove_edge(_src_output_port, _dst_input_port)) + , _arc(graph->remove_arc(_src_output_port, _dst_input_port)) , _buffers(NULL) { ThreadManager::assert_thread(THREAD_PRE_PROCESS); @@ -86,9 +86,9 @@ Disconnect::Impl::Impl(Engine& e, } } - _dst_input_port->decrement_num_edges(); + _dst_input_port->decrement_num_arcs(); - if (_dst_input_port->num_edges() == 0) { + if (_dst_input_port->num_arcs() == 0) { _buffers = new Raul::Array<BufferRef>(_dst_input_port->poly()); _dst_input_port->get_buffers(*_engine.buffer_factory(), _buffers, @@ -134,7 +134,7 @@ Disconnect::pre_process() BlockImpl* const dst_block = head->parent_block(); if (src_block->parent_graph() != dst_block->parent_graph()) { - // Edge to a graph port from inside the graph + // Arc to a graph port from inside the graph assert(src_block->parent() == dst_block || dst_block->parent() == src_block); if (src_block->parent() == dst_block) { _graph = dynamic_cast<GraphImpl*>(dst_block); @@ -142,16 +142,16 @@ Disconnect::pre_process() _graph = dynamic_cast<GraphImpl*>(src_block); } } else if (src_block == dst_block && dynamic_cast<GraphImpl*>(src_block)) { - // Edge from a graph input to a graph output (pass through) + // Arc from a graph input to a graph output (pass through) _graph = dynamic_cast<GraphImpl*>(src_block); } else { - // Normal edge between blocks with the same parent + // Normal arc between blocks with the same parent _graph = src_block->parent_graph(); } if (!_graph) { return Event::pre_process_done(INTERNAL_ERROR, _head_path); - } else if (!_graph->has_edge(tail, head)) { + } else if (!_graph->has_arc(tail, head)) { return Event::pre_process_done(NOT_FOUND, _head_path); } @@ -173,9 +173,9 @@ Disconnect::pre_process() bool Disconnect::Impl::execute(ProcessContext& context, bool set_dst_buffers) { - EdgeImpl* const port_edge = - _dst_input_port->remove_edge(context, _src_output_port); - if (!port_edge) { + ArcImpl* const port_arc = + _dst_input_port->remove_arc(context, _src_output_port); + if (!port_arc) { return false; } diff --git a/src/server/events/Disconnect.hpp b/src/server/events/Disconnect.hpp index feb1d17f..b0c9408c 100644 --- a/src/server/events/Disconnect.hpp +++ b/src/server/events/Disconnect.hpp @@ -38,7 +38,7 @@ class PortImpl; namespace Events { -/** Remove an Edge between two Ports. +/** Remove an Arc between two Ports. * * \ingroup engine */ @@ -72,7 +72,7 @@ public: OutputPort* _src_output_port; InputPort* _dst_input_port; GraphImpl* _graph; - SharedPtr<EdgeImpl> _edge; + SharedPtr<ArcImpl> _arc; Raul::Array<BufferRef>* _buffers; }; diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index b3e24e3f..c2475b45 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -24,9 +24,9 @@ #include "raul/Maid.hpp" #include "raul/Path.hpp" +#include "ArcImpl.hpp" #include "BlockImpl.hpp" #include "Broadcaster.hpp" -#include "EdgeImpl.hpp" #include "Engine.hpp" #include "GraphImpl.hpp" #include "InputPort.hpp" @@ -112,11 +112,11 @@ DisconnectAll::pre_process() } } - // Find set of edges to remove - std::set<EdgeImpl*> to_remove; - for (Node::Edges::const_iterator i = _parent->edges().begin(); - i != _parent->edges().end(); ++i) { - EdgeImpl* const c = (EdgeImpl*)i->second.get(); + // Find set of arcs to remove + std::set<ArcImpl*> to_remove; + for (Node::Arcs::const_iterator i = _parent->arcs().begin(); + i != _parent->arcs().end(); ++i) { + ArcImpl* const c = (ArcImpl*)i->second.get(); if (_block) { if (c->tail()->parent_block() == _block || c->head()->parent_block() == _block) { @@ -129,8 +129,8 @@ DisconnectAll::pre_process() } } - // Create disconnect events (which erases from _parent->edges()) - for (std::set<EdgeImpl*>::const_iterator i = to_remove.begin(); + // Create disconnect events (which erases from _parent->arcs()) + for (std::set<ArcImpl*>::const_iterator i = to_remove.begin(); i != to_remove.end(); ++i) { _impls.push_back(new Disconnect::Impl( _engine, _parent, diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index b65b47bf..93af8bf2 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -119,9 +119,9 @@ send_graph(Interface* client, const GraphImpl* graph) send_port(client, graph->port_impl(i)); } - // Send edges - for (GraphImpl::Edges::const_iterator j = graph->edges().begin(); - j != graph->edges().end(); ++j) { + // Send arcs + for (GraphImpl::Arcs::const_iterator j = graph->arcs().begin(); + j != graph->arcs().end(); ++j) { client->connect(j->second->tail_path(), j->second->head_path()); } } diff --git a/src/server/wscript b/src/server/wscript index 107db69d..47090d90 100644 --- a/src/server/wscript +++ b/src/server/wscript @@ -3,6 +3,7 @@ from waflib.extras import autowaf as autowaf def build(bld): core_source = ''' + ArcImpl.cpp BlockFactory.cpp BlockImpl.cpp Broadcaster.cpp @@ -11,7 +12,6 @@ def build(bld): Context.cpp ControlBindings.cpp DuplexPort.cpp - EdgeImpl.cpp Engine.cpp EventWriter.cpp GraphImpl.cpp diff --git a/tests/connect_disconnect_node_node.ttl b/tests/connect_disconnect_node_node.ttl index 7ea9c3c8..a230f40e 100644 --- a/tests/connect_disconnect_node_node.ttl +++ b/tests/connect_disconnect_node_node.ttl @@ -22,7 +22,7 @@ a patch:Put ; patch:subject <ingen:root/> ; patch:body [ - a ingen:Edge ; + a ingen:Arc ; ingen:tail <ingen:root/node1/left_out> ; ingen:head <ingen:root/node2/left_in> ] . @@ -30,7 +30,7 @@ <msg3> a patch:Delete ; patch:body [ - a ingen:Edge ; + a ingen:Arc ; ingen:tail <ingen:root/node1/left_out> ; ingen:head <ingen:root/node2/left_in> ] . diff --git a/tests/connect_disconnect_node_patch.ttl b/tests/connect_disconnect_node_patch.ttl index e6403354..b13e4685 100644 --- a/tests/connect_disconnect_node_patch.ttl +++ b/tests/connect_disconnect_node_patch.ttl @@ -22,7 +22,7 @@ a patch:Put ; patch:subject <ingen:root/> ; patch:body [ - a ingen:Edge ; + a ingen:Arc ; ingen:tail <ingen:root/node/left_out> ; ingen:head <ingen:root/out> ] . @@ -30,7 +30,7 @@ <msg3> a patch:Delete ; patch:body [ - a ingen:Edge ; + a ingen:Arc ; ingen:tail <ingen:root/node/left_out> ; ingen:head <ingen:root/out> ] . diff --git a/tests/connect_disconnect_patch_patch.ttl b/tests/connect_disconnect_patch_patch.ttl index 8df85a2b..0ac0402a 100644 --- a/tests/connect_disconnect_patch_patch.ttl +++ b/tests/connect_disconnect_patch_patch.ttl @@ -22,7 +22,7 @@ a patch:Put ; patch:subject <ingen:root/> ; patch:body [ - a ingen:Edge ; + a ingen:Arc ; ingen:tail <ingen:root/in> ; ingen:head <ingen:root/out> ] . @@ -30,7 +30,7 @@ <msg3> a patch:Delete ; patch:body [ - a ingen:Edge ; + a ingen:Arc ; ingen:tail <ingen:root/in> ; ingen:head <ingen:root/out> ] . diff --git a/tests/disconnect_all_node.ttl b/tests/disconnect_all_node.ttl index 7d71705c..26e264d1 100644 --- a/tests/disconnect_all_node.ttl +++ b/tests/disconnect_all_node.ttl @@ -22,7 +22,7 @@ a patch:Put ; patch:subject <ingen:root/> ; patch:body [ - a ingen:Edge ; + a ingen:Arc ; ingen:tail <ingen:root/node1/left_out> ; ingen:head <ingen:root/node2/left_in> ] . @@ -31,7 +31,7 @@ a patch:Put ; patch:subject <ingen:root/> ; patch:body [ - a ingen:Edge ; + a ingen:Arc ; ingen:tail <ingen:root/node1/right_out> ; ingen:head <ingen:root/node2/right_in> ] . @@ -40,6 +40,6 @@ a patch:Delete ; patch:subject <ingen:root/> ; patch:body [ - a ingen:Edge ; + a ingen:Arc ; ingen:incidentTo <ingen:root/node1> ] . diff --git a/tests/get_patch.ttl b/tests/get_patch.ttl index 5d2eb737..4652777d 100644 --- a/tests/get_patch.ttl +++ b/tests/get_patch.ttl @@ -29,7 +29,7 @@ a patch:Put ; patch:subject <ingen:root/> ; patch:body [ - a ingen:Edge ; + a ingen:Arc ; ingen:tail <ingen:root/sub/node1/left_out> ; ingen:head <ingen:root/sub/node2/left_in> ] . |