From 79275fc579c0dbe1ce4ca109edb95f2c1e0802a5 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 29 Dec 2012 20:34:32 +0000 Subject: "edge" => "arc". git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4897 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/ArcImpl.cpp | 107 ++++++++++++++++++++++++++++++++++++ src/server/ArcImpl.hpp | 86 +++++++++++++++++++++++++++++ src/server/EdgeImpl.cpp | 107 ------------------------------------ src/server/EdgeImpl.hpp | 86 ----------------------------- src/server/GraphImpl.cpp | 30 +++++----- src/server/GraphImpl.hpp | 12 ++-- src/server/InputPort.cpp | 82 +++++++++++++-------------- src/server/InputPort.hpp | 28 +++++----- src/server/events/Connect.cpp | 22 ++++---- src/server/events/Connect.hpp | 8 +-- src/server/events/Disconnect.cpp | 22 ++++---- src/server/events/Disconnect.hpp | 4 +- src/server/events/DisconnectAll.cpp | 16 +++--- src/server/events/Get.cpp | 6 +- src/server/wscript | 2 +- 15 files changed, 309 insertions(+), 309 deletions(-) create mode 100644 src/server/ArcImpl.cpp create mode 100644 src/server/ArcImpl.hpp delete mode 100644 src/server/EdgeImpl.cpp delete mode 100644 src/server/EdgeImpl.hpp (limited to 'src/server') diff --git a/src/server/ArcImpl.cpp b/src/server/ArcImpl.cpp new file mode 100644 index 00000000..debd2c1e --- /dev/null +++ b/src/server/ArcImpl.cpp @@ -0,0 +1,107 @@ +/* + 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 "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 "Engine.hpp" +#include "InputPort.hpp" +#include "OutputPort.hpp" +#include "PortImpl.hpp" + +namespace Ingen { +namespace Server { + +/** Constructor for an arc from a block's output port. + * + * This handles both polyphonic and monophonic blocks, transparently to the + * user (InputPort). + */ +ArcImpl::ArcImpl(PortImpl* tail, PortImpl* head) + : _tail(tail) + , _head(head) +{ + assert(tail != head); + assert(tail->path() != head->path()); +} + +const Raul::Path& +ArcImpl::tail_path() const +{ + return _tail->path(); +} + +const Raul::Path& +ArcImpl::head_path() const +{ + return _head->path(); +} + +BufferRef +ArcImpl::buffer(uint32_t voice) const +{ + assert(!must_mix()); + assert(_tail->poly() == 1 || _tail->poly() > voice); + if (_tail->poly() == 1) { + return _tail->buffer(0); + } else { + return _tail->buffer(voice); + } +} + +bool +ArcImpl::must_mix() const +{ + return _tail->poly() > _head->poly(); +} + +bool +ArcImpl::can_connect(const OutputPort* src, const InputPort* dst) +{ + const Ingen::URIs& uris = src->bufs().uris(); + return ( + // (Audio | Control | CV) => (Audio | Control | CV) + ( (src->is_a(PortType::CONTROL) || + src->is_a(PortType::AUDIO) || + src->is_a(PortType::CV)) + && (dst->is_a(PortType::CONTROL) + || dst->is_a(PortType::AUDIO) + || dst->is_a(PortType::CV))) + + // Equal types + || (src->type() == dst->type() && + src->buffer_type() == dst->buffer_type()) + + // Control => atom:Float Value + || (src->is_a(PortType::CONTROL) && dst->supports(uris.atom_Float)) + + // Audio => atom:Sound Value + || (src->is_a(PortType::AUDIO) && dst->supports(uris.atom_Sound)) + + // atom:Float Value => Control + || (src->supports(uris.atom_Float) && dst->is_a(PortType::CONTROL)) + + // atom:Sound Value => Audio + || (src->supports(uris.atom_Sound) && dst->is_a(PortType::AUDIO))); +} + +} // namespace Server +} // namespace Ingen + diff --git a/src/server/ArcImpl.hpp b/src/server/ArcImpl.hpp new file mode 100644 index 00000000..a28616da --- /dev/null +++ b/src/server/ArcImpl.hpp @@ -0,0 +1,86 @@ +/* + 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_ARC_IMPL_HPP +#define INGEN_ENGINE_ARC_IMPL_HPP + +#include + +#include +#include + +#include "ingen/Arc.hpp" +#include "lv2/lv2plug.in/ns/ext/atom/atom.h" +#include "raul/Deletable.hpp" + +#include "BufferRef.hpp" +#include "Context.hpp" + +namespace Ingen { +namespace Server { + +class PortImpl; +class OutputPort; +class InputPort; + +/** Represents a single inbound connection for an InputPort. + * + * This can be a group of ports (coming from a polyphonic Block) or + * a single Port. This class exists basically as an abstraction of mixing + * down polyphonic inputs, so InputPort can just deal with mixing down + * multiple connections (oblivious to the polyphonic situation of the + * connection itself). + * + * This is stored in an intrusive slist in InputPort. + * + * \ingroup engine + */ +class ArcImpl + : private Raul::Noncopyable + , public Arc + , public boost::intrusive::slist_base_hook< + boost::intrusive::link_mode > +{ +public: + ArcImpl(PortImpl* tail, PortImpl* head); + + inline PortImpl* tail() const { return _tail; } + inline PortImpl* head() const { return _head; } + + const Raul::Path& tail_path() const; + const Raul::Path& head_path() const; + + /** Get the buffer for a particular voice. + * 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 arc). + */ + BufferRef buffer(uint32_t voice) const; + + /** 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); + +protected: + PortImpl* const _tail; + PortImpl* const _head; +}; + +} // namespace Server +} // namespace Ingen + +#endif // INGEN_ENGINE_ARC_IMPL_HPP diff --git a/src/server/EdgeImpl.cpp b/src/server/EdgeImpl.cpp deleted file mode 100644 index 08096d45..00000000 --- a/src/server/EdgeImpl.cpp +++ /dev/null @@ -1,107 +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 "ingen/URIs.hpp" -#include "lv2/lv2plug.in/ns/ext/atom/util.h" - -#include "BlockImpl.hpp" -#include "Buffer.hpp" -#include "BufferFactory.hpp" -#include "EdgeImpl.hpp" -#include "Engine.hpp" -#include "InputPort.hpp" -#include "OutputPort.hpp" -#include "PortImpl.hpp" - -namespace Ingen { -namespace Server { - -/** Constructor for a edge from a block's output port. - * - * This handles both polyphonic and monophonic blocks, transparently to the - * user (InputPort). - */ -EdgeImpl::EdgeImpl(PortImpl* tail, PortImpl* head) - : _tail(tail) - , _head(head) -{ - assert(tail != head); - assert(tail->path() != head->path()); -} - -const Raul::Path& -EdgeImpl::tail_path() const -{ - return _tail->path(); -} - -const Raul::Path& -EdgeImpl::head_path() const -{ - return _head->path(); -} - -BufferRef -EdgeImpl::buffer(uint32_t voice) const -{ - assert(!must_mix()); - assert(_tail->poly() == 1 || _tail->poly() > voice); - if (_tail->poly() == 1) { - return _tail->buffer(0); - } else { - return _tail->buffer(voice); - } -} - -bool -EdgeImpl::must_mix() const -{ - return _tail->poly() > _head->poly(); -} - -bool -EdgeImpl::can_connect(const OutputPort* src, const InputPort* dst) -{ - const Ingen::URIs& uris = src->bufs().uris(); - return ( - // (Audio | Control | CV) => (Audio | Control | CV) - ( (src->is_a(PortType::CONTROL) || - src->is_a(PortType::AUDIO) || - src->is_a(PortType::CV)) - && (dst->is_a(PortType::CONTROL) - || dst->is_a(PortType::AUDIO) - || dst->is_a(PortType::CV))) - - // Equal types - || (src->type() == dst->type() && - src->buffer_type() == dst->buffer_type()) - - // Control => atom:Float Value - || (src->is_a(PortType::CONTROL) && dst->supports(uris.atom_Float)) - - // Audio => atom:Sound Value - || (src->is_a(PortType::AUDIO) && dst->supports(uris.atom_Sound)) - - // atom:Float Value => Control - || (src->supports(uris.atom_Float) && dst->is_a(PortType::CONTROL)) - - // atom:Sound Value => Audio - || (src->supports(uris.atom_Sound) && dst->is_a(PortType::AUDIO))); -} - -} // namespace Server -} // namespace Ingen - diff --git a/src/server/EdgeImpl.hpp b/src/server/EdgeImpl.hpp deleted file mode 100644 index 0627a7ba..00000000 --- a/src/server/EdgeImpl.hpp +++ /dev/null @@ -1,86 +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_EDGE_IMPL_HPP -#define INGEN_ENGINE_EDGE_IMPL_HPP - -#include - -#include -#include - -#include "ingen/Edge.hpp" -#include "lv2/lv2plug.in/ns/ext/atom/atom.h" -#include "raul/Deletable.hpp" - -#include "BufferRef.hpp" -#include "Context.hpp" - -namespace Ingen { -namespace Server { - -class PortImpl; -class OutputPort; -class InputPort; - -/** Represents a single inbound connection for an InputPort. - * - * This can be a group of ports (coming from a polyphonic Block) or - * a single Port. This class exists basically as an abstraction of mixing - * down polyphonic inputs, so InputPort can just deal with mixing down - * multiple connections (oblivious to the polyphonic situation of the - * connection itself). - * - * This is stored in an intrusive slist in InputPort. - * - * \ingroup engine - */ -class EdgeImpl - : private Raul::Noncopyable - , public Edge - , public boost::intrusive::slist_base_hook< - boost::intrusive::link_mode > -{ -public: - EdgeImpl(PortImpl* tail, PortImpl* head); - - inline PortImpl* tail() const { return _tail; } - inline PortImpl* head() const { return _head; } - - const Raul::Path& tail_path() const; - const Raul::Path& head_path() const; - - /** Get the buffer for a particular voice. - * An Edge 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). - */ - BufferRef buffer(uint32_t voice) const; - - /** Whether this edge must mix down voices into a local buffer */ - bool must_mix() const; - - static bool can_connect(const OutputPort* src, const InputPort* dst); - -protected: - PortImpl* const _tail; - PortImpl* const _head; -}; - -} // namespace Server -} // namespace Ingen - -#endif // INGEN_ENGINE_EDGEIMPL_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 c) +GraphImpl::add_arc(SharedPtr 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 -GraphImpl::remove_edge(const PortImpl* tail, const PortImpl* dst_port) +SharedPtr +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 c = PtrCast(i->second); - _edges.erase(i); - return c; + Arcs::iterator i = _arcs.find(make_pair(tail, dst_port)); + if (i != _arcs.end()) { + SharedPtr arc = PtrCast(i->second); + _arcs.erase(i); + return arc; } else { - return SharedPtr(); + return SharedPtr(); } } 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 c); + void add_arc(SharedPtr arc); - SharedPtr remove_edge(const PortImpl* tail, - const PortImpl* head); + SharedPtr 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 - > 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(head_block); @@ -95,25 +95,25 @@ Connect::pre_process() _graph = dynamic_cast(tail_block); } } else if (tail_block == head_block && dynamic_cast(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(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(new EdgeImpl(tail_output, _head)); + _arc = SharedPtr(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(_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 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 _edge; + SharedPtr _arc; Raul::Array* _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(_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(dst_block); @@ -142,16 +142,16 @@ Disconnect::pre_process() _graph = dynamic_cast(src_block); } } else if (src_block == dst_block && dynamic_cast(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(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 _edge; + SharedPtr _arc; Raul::Array* _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 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 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::const_iterator i = to_remove.begin(); + // Create disconnect events (which erases from _parent->arcs()) + for (std::set::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 -- cgit v1.2.1