summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-10-06 14:48:26 +0000
committerDavid Robillard <d@drobilla.net>2011-10-06 14:48:26 +0000
commit5994178571afa3483d2a52ce78646d4161153ea5 (patch)
tree10c2943cc754807833aad6a1f9a19fb94c4d22f5 /src
parent37e686ac346bdb77386dc3f7307ff956d40f2643 (diff)
downloadingen-5994178571afa3483d2a52ce78646d4161153ea5.tar.gz
ingen-5994178571afa3483d2a52ce78646d4161153ea5.tar.bz2
ingen-5994178571afa3483d2a52ce78646d4161153ea5.zip
Simpler providers/dependants implementation.
Raul::List is no longer necessary here since these lists are only accessed in the pre-processing thread. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3531 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/server/CompiledPatch.hpp7
-rw-r--r--src/server/NodeImpl.cpp4
-rw-r--r--src/server/NodeImpl.hpp19
-rw-r--r--src/server/PatchImpl.cpp2
-rw-r--r--src/server/PatchImpl.hpp9
-rw-r--r--src/server/events/Connect.cpp4
-rw-r--r--src/server/events/CreatePort.cpp1
-rw-r--r--src/server/events/Disconnect.cpp12
8 files changed, 25 insertions, 33 deletions
diff --git a/src/server/CompiledPatch.hpp b/src/server/CompiledPatch.hpp
index 519b5a2a..2fe701c0 100644
--- a/src/server/CompiledPatch.hpp
+++ b/src/server/CompiledPatch.hpp
@@ -19,6 +19,7 @@
#define INGEN_ENGINE_COMPILEDPATCH_HPP
#include <vector>
+#include <list>
#include <boost/utility.hpp>
@@ -34,14 +35,14 @@ class NodeImpl;
/** All information required about a node to execute it in an audio thread.
*/
struct CompiledNode {
- CompiledNode(NodeImpl* n, size_t np, Raul::List<NodeImpl*>* d)
+ CompiledNode(NodeImpl* n, size_t np, const std::list<NodeImpl*>& d)
: _node(n), _n_providers(np)
{
// Copy to a vector for maximum iteration speed and cache optimization
// (Need to take a copy anyway)
- _dependants.reserve(d->size());
- for (Raul::List<NodeImpl*>::iterator i = d->begin(); i != d->end(); ++i)
+ _dependants.reserve(d.size());
+ for (std::list<NodeImpl*>::const_iterator i = d.begin(); i != d.end(); ++i)
_dependants.push_back(*i);
}
diff --git a/src/server/NodeImpl.cpp b/src/server/NodeImpl.cpp
index eab31716..4b52fd6b 100644
--- a/src/server/NodeImpl.cpp
+++ b/src/server/NodeImpl.cpp
@@ -46,8 +46,6 @@ NodeImpl::NodeImpl(PluginImpl* plugin, const Raul::Symbol& symbol, bool polyphon
, _process_lock(0)
, _n_inputs_ready(0)
, _ports(NULL)
- , _providers(new Raul::List<NodeImpl*>())
- , _dependants(new Raul::List<NodeImpl*>())
, _activated(false)
, _traversed(false)
{
@@ -61,8 +59,6 @@ NodeImpl::~NodeImpl()
if (_activated)
deactivate();
- delete _providers;
- delete _dependants;
delete _ports;
free(_valid_ports);
diff --git a/src/server/NodeImpl.hpp b/src/server/NodeImpl.hpp
index 3fc4a5d6..6d9ef14b 100644
--- a/src/server/NodeImpl.hpp
+++ b/src/server/NodeImpl.hpp
@@ -18,6 +18,7 @@
#ifndef INGEN_ENGINE_NODEIMPL_HPP
#define INGEN_ENGINE_NODEIMPL_HPP
+#include <list>
#include <string>
#include <boost/intrusive_ptr.hpp>
@@ -152,17 +153,11 @@ public:
virtual Port* port(uint32_t index) const;
virtual PortImpl* port_impl(uint32_t index) const { return (*_ports)[index]; }
- /** Nodes that are connected to this Node's inputs.
- * (This Node depends on them)
- */
- Raul::List<NodeImpl*>* providers() { return _providers; }
- void providers(Raul::List<NodeImpl*>* l) { _providers = l; }
+ /** Nodes that are connected to this Node's inputs. */
+ std::list<NodeImpl*>& providers() { return _providers; }
- /** Nodes are are connected to this Node's outputs.
- * (They depend on this Node)
- */
- Raul::List<NodeImpl*>* dependants() { return _dependants; }
- void dependants(Raul::List<NodeImpl*>* l) { _dependants = l; }
+ /** Nodes are are connected to this Node's outputs. */
+ std::list<NodeImpl*>& dependants() { return _dependants; }
/** Flag node as polyphonic.
*
@@ -216,8 +211,8 @@ protected:
Raul::AtomicInt _process_lock; ///< Parallelism: Waiting on inputs 'lock'
Raul::AtomicInt _n_inputs_ready; ///< Parallelism: # input ready signals this cycle
Raul::Array<PortImpl*>* _ports; ///< Access in audio thread only
- Raul::List<NodeImpl*>* _providers; ///< Nodes connected to this one's input ports
- Raul::List<NodeImpl*>* _dependants; ///< Nodes this one's output ports are connected to
+ std::list<NodeImpl*> _providers; ///< Nodes connected to this one's input ports
+ std::list<NodeImpl*> _dependants; ///< Nodes this one's output ports are connected to
bool _activated;
bool _traversed; ///< Flag for process order algorithm
diff --git a/src/server/PatchImpl.cpp b/src/server/PatchImpl.cpp
index fb24faf7..c99b0bb1 100644
--- a/src/server/PatchImpl.cpp
+++ b/src/server/PatchImpl.cpp
@@ -444,7 +444,7 @@ PatchImpl::compile() const
for (Nodes::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i) {
NodeImpl* const node = (*i);
// Either a sink or connected to our output ports:
- if ( ( ! node->traversed()) && node->dependants()->size() == 0)
+ if (!node->traversed() && node->dependants().size() == 0)
compile_recursive(node, compiled_patch);
}
diff --git a/src/server/PatchImpl.hpp b/src/server/PatchImpl.hpp
index 5795a066..095a04b7 100644
--- a/src/server/PatchImpl.hpp
+++ b/src/server/PatchImpl.hpp
@@ -154,11 +154,12 @@ PatchImpl::compile_recursive(NodeImpl* n, CompiledPatch* output) const
n->traversed(true);
assert(output != NULL);
- for (Raul::List<NodeImpl*>::iterator i = n->providers()->begin(); i != n->providers()->end(); ++i)
- if ( ! (*i)->traversed() )
- compile_recursive((*i), output);
+ for (std::list<NodeImpl*>::iterator i = n->providers().begin();
+ i != n->providers().end(); ++i)
+ if (!(*i)->traversed())
+ compile_recursive(*i, output);
- output->push_back(CompiledNode(n, n->providers()->size(), n->dependants()));
+ output->push_back(CompiledNode(n, n->providers().size(), n->dependants()));
}
} // namespace Server
diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp
index da7aa593..39438d43 100644
--- a/src/server/events/Connect.cpp
+++ b/src/server/events/Connect.cpp
@@ -141,8 +141,8 @@ Connect::pre_process()
provider...
*/
if (src_node != dst_node && src_node->parent() == dst_node->parent()) {
- dst_node->providers()->push_back(new Raul::List<NodeImpl*>::Node(src_node));
- src_node->dependants()->push_back(new Raul::List<NodeImpl*>::Node(dst_node));
+ dst_node->providers().push_back(src_node);
+ src_node->dependants().push_back(dst_node);
}
_patch->add_connection(_connection);
diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp
index c6d7c296..84a8e2d3 100644
--- a/src/server/events/CreatePort.cpp
+++ b/src/server/events/CreatePort.cpp
@@ -17,7 +17,6 @@
#include "raul/Array.hpp"
#include "raul/Atom.hpp"
-#include "raul/List.hpp"
#include "raul/Maid.hpp"
#include "raul/Path.hpp"
#include "shared/LV2URIMap.hpp"
diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp
index de078c3f..c55ae1ae 100644
--- a/src/server/events/Disconnect.cpp
+++ b/src/server/events/Disconnect.cpp
@@ -75,18 +75,18 @@ Disconnect::Impl::Impl(Engine& e,
NodeImpl* const src_node = _src_output_port->parent_node();
NodeImpl* const dst_node = _dst_input_port->parent_node();
- for (Raul::List<NodeImpl*>::iterator i = dst_node->providers()->begin();
- i != dst_node->providers()->end(); ++i) {
+ for (std::list<NodeImpl*>::iterator i = dst_node->providers().begin();
+ i != dst_node->providers().end(); ++i) {
if ((*i) == src_node) {
- delete dst_node->providers()->erase(i);
+ dst_node->providers().erase(i);
break;
}
}
- for (Raul::List<NodeImpl*>::iterator i = src_node->dependants()->begin();
- i != src_node->dependants()->end(); ++i) {
+ for (std::list<NodeImpl*>::iterator i = src_node->dependants().begin();
+ i != src_node->dependants().end(); ++i) {
if ((*i) == dst_node) {
- delete src_node->dependants()->erase(i);
+ src_node->dependants().erase(i);
break;
}
}