summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-10-08 04:21:18 +0000
committerDavid Robillard <d@drobilla.net>2007-10-08 04:21:18 +0000
commitfae7e7519afae5f42836eaaf5e317151ea9c4378 (patch)
treec935a96d005d51517052aa95a8eb42def47b09d2
parent4675e82dae45a70ee27bf11d10aa6872485c8847 (diff)
downloadingen-fae7e7519afae5f42836eaaf5e317151ea9c4378.tar.gz
ingen-fae7e7519afae5f42836eaaf5e317151ea9c4378.tar.bz2
ingen-fae7e7519afae5f42836eaaf5e317151ea9c4378.zip
Fixed missing symbol in Raul.
Made Raul::List interface and uses thereof less fugly. git-svn-id: http://svn.drobilla.net/lad/ingen@845 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/libs/engine/ClientBroadcaster.cpp2
-rw-r--r--src/libs/engine/ClientBroadcaster.hpp3
-rw-r--r--src/libs/engine/InputPort.cpp8
-rw-r--r--src/libs/engine/InputPort.hpp8
-rw-r--r--src/libs/engine/JackAudioDriver.cpp2
-rw-r--r--src/libs/engine/JackAudioDriver.hpp2
-rw-r--r--src/libs/engine/JackMidiDriver.cpp2
-rw-r--r--src/libs/engine/JackMidiDriver.hpp6
-rw-r--r--src/libs/engine/ObjectSender.cpp4
-rw-r--r--src/libs/engine/Patch.cpp52
-rw-r--r--src/libs/engine/Patch.hpp45
-rw-r--r--src/libs/engine/events/ClearPatchEvent.cpp11
-rw-r--r--src/libs/engine/events/ConnectionEvent.cpp11
-rw-r--r--src/libs/engine/events/ConnectionEvent.hpp9
-rw-r--r--src/libs/engine/events/CreateNodeEvent.cpp2
-rw-r--r--src/libs/engine/events/CreatePatchEvent.cpp2
-rw-r--r--src/libs/engine/events/CreatePortEvent.cpp4
-rw-r--r--src/libs/engine/events/DestroyEvent.hpp6
-rw-r--r--src/libs/engine/events/DisconnectNodeEvent.cpp9
-rw-r--r--src/libs/engine/events/DisconnectPortEvent.cpp8
-rw-r--r--src/libs/engine/events/DisconnectionEvent.cpp9
21 files changed, 105 insertions, 100 deletions
diff --git a/src/libs/engine/ClientBroadcaster.cpp b/src/libs/engine/ClientBroadcaster.cpp
index 97a78b4e..18025939 100644
--- a/src/libs/engine/ClientBroadcaster.cpp
+++ b/src/libs/engine/ClientBroadcaster.cpp
@@ -162,7 +162,7 @@ ClientBroadcaster::send_patch_cleared(const string& patch_path)
}
void
-ClientBroadcaster::send_connection(const ConnectionImpl* const c)
+ClientBroadcaster::send_connection(const SharedPtr<const ConnectionImpl> c)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->connection(c->src_port()->path(), c->dst_port()->path());
diff --git a/src/libs/engine/ClientBroadcaster.hpp b/src/libs/engine/ClientBroadcaster.hpp
index 79669999..f4a97397 100644
--- a/src/libs/engine/ClientBroadcaster.hpp
+++ b/src/libs/engine/ClientBroadcaster.hpp
@@ -23,6 +23,7 @@
#include <map>
#include <lo/lo.h>
#include <pthread.h>
+#include <raul/SharedPtr.hpp>
#include "interface/ClientInterface.hpp"
#include "types.hpp"
@@ -68,7 +69,7 @@ public:
void send_destroyed(const string& path);
void send_polyphonic(const string& path, bool polyphonic);
void send_patch_cleared(const string& patch_path);
- void send_connection(const ConnectionImpl* const connection);
+ void send_connection(const SharedPtr<const ConnectionImpl> connection);
void send_disconnection(const string& src_port_path, const string& dst_port_path);
void send_rename(const string& old_path, const string& new_path);
void send_patch_enable(const string& patch_path);
diff --git a/src/libs/engine/InputPort.cpp b/src/libs/engine/InputPort.cpp
index 05f2de9a..ed0a3c4c 100644
--- a/src/libs/engine/InputPort.cpp
+++ b/src/libs/engine/InputPort.cpp
@@ -43,7 +43,7 @@ InputPort::set_buffer_size(size_t size)
PortImpl::set_buffer_size(size);
assert(_buffer_size = size);
- for (Raul::List<ConnectionImpl*>::iterator c = _connections.begin(); c != _connections.end(); ++c)
+ for (Raul::List< SharedPtr<ConnectionImpl> >::iterator c = _connections.begin(); c != _connections.end(); ++c)
(*c)->set_buffer_size(size);
}
@@ -55,7 +55,7 @@ InputPort::set_buffer_size(size_t size)
* if there is only one connection, since no mixing needs to take place.
*/
void
-InputPort::add_connection(Raul::ListNode<ConnectionImpl*>* const c)
+InputPort::add_connection(Connections::Node* const c)
{
_connections.push_back(c);
@@ -85,13 +85,13 @@ InputPort::add_connection(Raul::ListNode<ConnectionImpl*>* const c)
/** Remove a connection. Realtime safe.
*/
-Raul::ListNode<ConnectionImpl*>*
+InputPort::Connections::Node*
InputPort::remove_connection(const OutputPort* src_port)
{
bool modify_buffers = !_fixed_buffers;
bool found = false;
- Raul::ListNode<ConnectionImpl*>* connection = NULL;
+ Connections::Node* connection = NULL;
for (Connections::iterator i = _connections.begin(); i != _connections.end(); ++i) {
if ((*i)->src_port()->path() == src_port->path()) {
connection = _connections.erase(i);
diff --git a/src/libs/engine/InputPort.hpp b/src/libs/engine/InputPort.hpp
index 1552642b..0b739f4b 100644
--- a/src/libs/engine/InputPort.hpp
+++ b/src/libs/engine/InputPort.hpp
@@ -22,6 +22,7 @@
#include <cstdlib>
#include <cassert>
#include <raul/List.hpp>
+#include <raul/SharedPtr.hpp>
#include "PortImpl.hpp"
#include "MidiBuffer.hpp"
using std::string;
@@ -50,10 +51,11 @@ public:
InputPort(NodeImpl* parent, const string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size);
virtual ~InputPort() {}
- void add_connection(Raul::ListNode<ConnectionImpl*>* c);
- Raul::ListNode<ConnectionImpl*>* remove_connection(const OutputPort* src_port);
+ typedef Raul::List< SharedPtr<ConnectionImpl> > Connections;
+
+ void add_connection(Connections::Node* c);
+ Connections::Node* remove_connection(const OutputPort* src_port);
- typedef Raul::List<ConnectionImpl*> Connections;
const Connections& connections() { return _connections; }
void pre_process(ProcessContext& context);
diff --git a/src/libs/engine/JackAudioDriver.cpp b/src/libs/engine/JackAudioDriver.cpp
index ce35ce9c..a99a6112 100644
--- a/src/libs/engine/JackAudioDriver.cpp
+++ b/src/libs/engine/JackAudioDriver.cpp
@@ -49,7 +49,7 @@ namespace Ingen {
JackAudioPort::JackAudioPort(JackAudioDriver* driver, DuplexPort* patch_port)
: DriverPort(patch_port),
- Raul::ListNode<JackAudioPort*>(this),
+ Raul::List<JackAudioPort*>::Node(this),
_driver(driver),
_jack_port(NULL),
_jack_buffer(NULL)
diff --git a/src/libs/engine/JackAudioDriver.hpp b/src/libs/engine/JackAudioDriver.hpp
index cc19a8e8..ea955d05 100644
--- a/src/libs/engine/JackAudioDriver.hpp
+++ b/src/libs/engine/JackAudioDriver.hpp
@@ -41,7 +41,7 @@ typedef jack_default_audio_sample_t jack_sample_t;
*
* A Jack port always has a one-to-one association with a Patch port.
*/
-class JackAudioPort : public DriverPort, public Raul::ListNode<JackAudioPort*>
+class JackAudioPort : public DriverPort, public Raul::List<JackAudioPort*>::Node
{
public:
JackAudioPort(JackAudioDriver* driver, DuplexPort* patch_port);
diff --git a/src/libs/engine/JackMidiDriver.cpp b/src/libs/engine/JackMidiDriver.cpp
index 448a84e6..ff052256 100644
--- a/src/libs/engine/JackMidiDriver.cpp
+++ b/src/libs/engine/JackMidiDriver.cpp
@@ -40,7 +40,7 @@ namespace Ingen {
JackMidiPort::JackMidiPort(JackMidiDriver* driver, DuplexPort* patch_port)
: DriverPort(patch_port),
- Raul::ListNode<JackMidiPort*>(this),
+ Raul::List<JackMidiPort*>::Node(this),
_driver(driver),
_jack_port(NULL)
{
diff --git a/src/libs/engine/JackMidiDriver.hpp b/src/libs/engine/JackMidiDriver.hpp
index 54d0cc1a..7889c4fa 100644
--- a/src/libs/engine/JackMidiDriver.hpp
+++ b/src/libs/engine/JackMidiDriver.hpp
@@ -36,7 +36,7 @@ class DuplexPort;
*
* \ingroup engine
*/
-class JackMidiPort : public DriverPort, public Raul::ListNode<JackMidiPort*>
+class JackMidiPort : public DriverPort, public Raul::List<JackMidiPort*>::Node
{
public:
JackMidiPort(JackMidiDriver* driver, DuplexPort* port);
@@ -93,8 +93,8 @@ private:
friend class JackMidiPort;
- void add_output(Raul::ListNode<JackMidiPort*>* port);
- Raul::ListNode<JackMidiPort*>* remove_output(JackMidiPort* port);
+ void add_output(Raul::List<JackMidiPort*>::Node* port);
+ Raul::List<JackMidiPort*>::Node* remove_output(JackMidiPort* port);
// MIDI thread
static void* process_midi_in(void* me);
diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp
index 61935207..4d0adb51 100644
--- a/src/libs/engine/ObjectSender.cpp
+++ b/src/libs/engine/ObjectSender.cpp
@@ -38,7 +38,7 @@ ObjectSender::send_patch(ClientInterface* client, const Patch* patch, bool recur
if (recursive) {
// Send nodes
- for (Raul::List<NodeImpl*>::const_iterator j = patch->nodes().begin();
+ for (List<NodeImpl*>::const_iterator j = patch->nodes().begin();
j != patch->nodes().end(); ++j) {
const NodeImpl* const node = (*j);
@@ -54,7 +54,7 @@ ObjectSender::send_patch(ClientInterface* client, const Patch* patch, bool recur
}
// Send connections
- for (Raul::List<ConnectionImpl*>::const_iterator j = patch->connections().begin();
+ for (List< SharedPtr<ConnectionImpl> >::const_iterator j = patch->connections().begin();
j != patch->connections().end(); ++j) {
client->connection((*j)->src_port()->path(), (*j)->dst_port()->path());
diff --git a/src/libs/engine/Patch.cpp b/src/libs/engine/Patch.cpp
index 83fcf3df..39348ce9 100644
--- a/src/libs/engine/Patch.cpp
+++ b/src/libs/engine/Patch.cpp
@@ -54,12 +54,12 @@ Patch::~Patch()
{
assert(!_activated);
- for (Raul::List<ConnectionImpl*>::iterator i = _connections.begin(); i != _connections.end(); ++i) {
- delete (*i);
+ for (List< SharedPtr<ConnectionImpl> >::iterator i = _connections.begin(); i != _connections.end(); ++i) {
+ (*i).reset();
delete _connections.erase(i);
}
- for (Raul::List<NodeImpl*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i) {
+ for (List<NodeImpl*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i) {
assert(!(*i)->activated());
delete (*i);
delete _nodes.erase(i);
@@ -74,7 +74,7 @@ Patch::activate()
{
NodeBase::activate();
- for (Raul::List<NodeImpl*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i)
+ for (List<NodeImpl*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i)
(*i)->activate();
assert(_activated);
@@ -88,7 +88,7 @@ Patch::deactivate()
NodeBase::deactivate();
- for (Raul::List<NodeImpl*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i) {
+ for (List<NodeImpl*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i) {
if ((*i)->activated())
(*i)->deactivate();
assert(!(*i)->activated());
@@ -103,7 +103,7 @@ Patch::disable()
{
_process = false;
- for (Raul::List<PortImpl*>::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i)
+ for (List<PortImpl*>::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i)
(*i)->clear_buffers();
}
@@ -113,10 +113,10 @@ Patch::prepare_internal_poly(uint32_t poly)
{
/* TODO: ports? internal/external poly? */
- for (Raul::List<NodeImpl*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i)
+ for (List<NodeImpl*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i)
(*i)->prepare_poly(poly);
- for (Raul::List<ConnectionImpl*>::iterator i = _connections.begin(); i != _connections.end(); ++i)
+ for (List< SharedPtr<ConnectionImpl> >::iterator i = _connections.begin(); i != _connections.end(); ++i)
(*i)->prepare_poly(poly);
/* FIXME: Deal with failure */
@@ -130,10 +130,10 @@ Patch::apply_internal_poly(Raul::Maid& maid, uint32_t poly)
{
/* TODO: ports? internal/external poly? */
- for (Raul::List<NodeImpl*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i)
+ for (List<NodeImpl*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i)
(*i)->apply_poly(maid, poly);
- for (Raul::List<ConnectionImpl*>::iterator i = _connections.begin(); i != _connections.end(); ++i)
+ for (List< SharedPtr<ConnectionImpl> >::iterator i = _connections.begin(); i != _connections.end(); ++i)
(*i)->apply_poly(maid, poly);
_internal_poly = poly;
@@ -248,7 +248,7 @@ Patch::set_buffer_size(size_t size)
NodeBase::set_buffer_size(size);
assert(_buffer_size == size);
- for (Raul::List<NodeImpl*>::iterator j = _nodes.begin(); j != _nodes.end(); ++j)
+ for (List<NodeImpl*>::iterator j = _nodes.begin(); j != _nodes.end(); ++j)
(*j)->set_buffer_size(size);
}
@@ -257,7 +257,7 @@ Patch::set_buffer_size(size_t size)
void
-Patch::add_node(Raul::ListNode<NodeImpl*>* ln)
+Patch::add_node(List<NodeImpl*>::Node* ln)
{
assert(ln != NULL);
assert(ln->elem() != NULL);
@@ -271,10 +271,10 @@ Patch::add_node(Raul::ListNode<NodeImpl*>* ln)
/** Remove a node.
* Realtime Safe. Preprocessing thread.
*/
-Raul::ListNode<NodeImpl*>*
+Patch::Nodes::Node*
Patch::remove_node(const string& name)
{
- for (Raul::List<NodeImpl*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i)
+ for (List<NodeImpl*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i)
if ((*i)->name() == name)
return _nodes.erase(i);
@@ -284,12 +284,12 @@ Patch::remove_node(const string& name)
/** Remove a connection. Realtime safe.
*/
-Raul::ListNode<ConnectionImpl*>*
+Patch::Connections::Node*
Patch::remove_connection(const PortImpl* src_port, const PortImpl* dst_port)
{
bool found = false;
- Raul::ListNode<ConnectionImpl*>* connection = NULL;
- for (Raul::List<ConnectionImpl*>::iterator i = _connections.begin(); i != _connections.end(); ++i) {
+ Connections::Node* connection = NULL;
+ for (Connections::iterator i = _connections.begin(); i != _connections.end(); ++i) {
if ((*i)->src_port() == src_port && (*i)->dst_port() == dst_port) {
connection = _connections.erase(i);
found = true;
@@ -338,14 +338,14 @@ Patch::create_port(const string& name, DataType type, size_t buffer_size, bool i
*
* Realtime safe. Preprocessing thread only.
*/
-Raul::ListNode<PortImpl*>*
+List<PortImpl*>::Node*
Patch::remove_port(const string& name)
{
assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS);
bool found = false;
- Raul::ListNode<PortImpl*>* ret = NULL;
- for (Raul::List<PortImpl*>::iterator i = _input_ports.begin(); i != _input_ports.end(); ++i) {
+ List<PortImpl*>::Node* ret = NULL;
+ for (List<PortImpl*>::iterator i = _input_ports.begin(); i != _input_ports.end(); ++i) {
if ((*i)->name() == name) {
ret = _input_ports.erase(i);
found = true;
@@ -353,7 +353,7 @@ Patch::remove_port(const string& name)
}
if (!found)
- for (Raul::List<PortImpl*>::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i) {
+ for (List<PortImpl*>::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i) {
if ((*i)->name() == name) {
ret = _output_ports.erase(i);
found = true;
@@ -376,10 +376,10 @@ Patch::build_ports_array() const
size_t i = 0;
- for (Raul::List<PortImpl*>::const_iterator p = _input_ports.begin(); p != _input_ports.end(); ++p,++i)
+ for (List<PortImpl*>::const_iterator p = _input_ports.begin(); p != _input_ports.end(); ++p,++i)
result->at(i) = *p;
- for (Raul::List<PortImpl*>::const_iterator p = _output_ports.begin(); p != _output_ports.end(); ++p,++i)
+ for (List<PortImpl*>::const_iterator p = _output_ports.begin(); p != _output_ports.end(); ++p,++i)
result->at(i) = *p;
return result;
@@ -405,10 +405,10 @@ Patch::compile() const
CompiledPatch* const compiled_patch = new CompiledPatch();//_nodes.size());
- for (Raul::List<NodeImpl*>::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i)
+ for (Nodes::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i)
(*i)->traversed(false);
- for (Raul::List<NodeImpl*>::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i) {
+ 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)
@@ -416,7 +416,7 @@ Patch::compile() const
}
// Traverse any nodes we didn't hit yet
- for (Raul::List<NodeImpl*>::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i) {
+ for (Nodes::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i) {
NodeImpl* const node = (*i);
if ( ! node->traversed())
compile_recursive(node, compiled_patch);
diff --git a/src/libs/engine/Patch.hpp b/src/libs/engine/Patch.hpp
index a39106a4..3097a87a 100644
--- a/src/libs/engine/Patch.hpp
+++ b/src/libs/engine/Patch.hpp
@@ -21,6 +21,7 @@
#include <cstdlib>
#include <string>
#include <raul/List.hpp>
+#include <raul/SharedPtr.hpp>
#include "NodeBase.hpp"
#include "PluginImpl.hpp"
#include "interface/DataType.hpp"
@@ -29,6 +30,7 @@
using std::string;
template <typename T> class Array;
+using Raul::List;
namespace Ingen {
@@ -83,24 +85,27 @@ public:
// Patch specific stuff not inherited from Node
- void add_node(Raul::ListNode<NodeImpl*>* tn);
- Raul::ListNode<NodeImpl*>* remove_node(const string& name);
+ typedef List< SharedPtr<ConnectionImpl> > Connections;
+ typedef List<NodeImpl*> Nodes;
+
+ void add_node(Nodes::Node* tn);
+ Nodes::Node* remove_node(const string& name);
- Raul::List<NodeImpl*>& nodes() { return _nodes; }
- Raul::List<ConnectionImpl*>& connections() { return _connections; }
+ Nodes& nodes() { return _nodes; }
+ Connections& connections() { return _connections; }
- const Raul::List<NodeImpl*>& nodes() const { return _nodes; }
- const Raul::List<ConnectionImpl*>& connections() const { return _connections; }
+ const Nodes& nodes() const { return _nodes; }
+ const Connections& connections() const { return _connections; }
uint32_t num_ports() const;
PortImpl* create_port(const string& name, DataType type, size_t buffer_size, bool is_output);
- void add_input(Raul::ListNode<PortImpl*>* port) { _input_ports.push_back(port); } ///< Preprocesser thread
- void add_output(Raul::ListNode<PortImpl*>* port) { _output_ports.push_back(port); } ///< Preprocessor thread
- Raul::ListNode<PortImpl*>* remove_port(const string& name);
+ void add_input(List<PortImpl*>::Node* port) { _input_ports.push_back(port); } ///< Preprocesser thread
+ void add_output(List<PortImpl*>::Node* port) { _output_ports.push_back(port); } ///< Preprocessor thread
+ List<PortImpl*>::Node* remove_port(const string& name);
- void add_connection(Raul::ListNode<ConnectionImpl*>* c) { _connections.push_back(c); }
- Raul::ListNode<ConnectionImpl*>* remove_connection(const PortImpl* src_port, const PortImpl* dst_port);
+ void add_connection(Connections::Node* c) { _connections.push_back(c); }
+ Connections::Node* remove_connection(const PortImpl* src_port, const PortImpl* dst_port);
CompiledPatch* compiled_patch() { return _compiled_patch; }
void compiled_patch(CompiledPatch* cp) { _compiled_patch = cp; }
@@ -123,14 +128,14 @@ private:
void process_parallel(ProcessContext& context);
void process_single(ProcessContext& context);
- Engine& _engine;
- uint32_t _internal_poly;
- CompiledPatch* _compiled_patch; ///< Accessed in audio thread only
- Raul::List<ConnectionImpl*> _connections; ///< Accessed in audio thread only
- Raul::List<PortImpl*> _input_ports; ///< Accessed in preprocessing thread only
- Raul::List<PortImpl*> _output_ports; ///< Accessed in preprocessing thread only
- Raul::List<NodeImpl*> _nodes; ///< Accessed in preprocessing thread only
- bool _process;
+ Engine& _engine;
+ uint32_t _internal_poly;
+ CompiledPatch* _compiled_patch; ///< Accessed in audio thread only
+ Connections _connections; ///< Accessed in audio thread only
+ List<PortImpl*> _input_ports; ///< Accessed in preprocessing thread only
+ List<PortImpl*> _output_ports; ///< Accessed in preprocessing thread only
+ Nodes _nodes; ///< Accessed in preprocessing thread only
+ bool _process;
};
@@ -145,7 +150,7 @@ Patch::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)
+ for (List<NodeImpl*>::iterator i = n->providers()->begin(); i != n->providers()->end(); ++i)
if ( ! (*i)->traversed() )
compile_recursive((*i), output);
diff --git a/src/libs/engine/events/ClearPatchEvent.cpp b/src/libs/engine/events/ClearPatchEvent.cpp
index ad35d162..84731d0a 100644
--- a/src/libs/engine/events/ClearPatchEvent.cpp
+++ b/src/libs/engine/events/ClearPatchEvent.cpp
@@ -51,7 +51,7 @@ ClearPatchEvent::pre_process()
_process = _patch->enabled();
- for (Raul::List<Node*>::const_iterator i = _patch->nodes().begin(); i != _patch->nodes().end(); ++i)
+ for (List<Node*>::const_iterator i = _patch->nodes().begin(); i != _patch->nodes().end(); ++i)
(*i)->remove_from_store();
}
#endif
@@ -69,7 +69,7 @@ ClearPatchEvent::execute(ProcessContext& context)
_patch->disable();
cerr << "FIXME: CLEAR PATCH\n";
- //for (Raul::List<Node*>::const_iterator i = _patch->nodes().begin(); i != _patch->nodes().end(); ++i)
+ //for (List<Node*>::const_iterator i = _patch->nodes().begin(); i != _patch->nodes().end(); ++i)
// (*i)->remove_from_patch();
if (_patch->compiled_patch() != NULL) {
@@ -85,15 +85,16 @@ ClearPatchEvent::post_process()
{
if (_patch != NULL) {
// Delete all nodes
- for (Raul::List<NodeImpl*>::iterator i = _patch->nodes().begin(); i != _patch->nodes().end(); ++i) {
+ for (List<NodeImpl*>::iterator i = _patch->nodes().begin(); i != _patch->nodes().end(); ++i) {
(*i)->deactivate();
delete *i;
}
_patch->nodes().clear();
// Delete all connections
- for (Raul::List<ConnectionImpl*>::iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i)
- delete *i;
+ for (List< SharedPtr<ConnectionImpl> >::iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i)
+ (*i).reset();
+
_patch->connections().clear();
// Restore patch's run state
diff --git a/src/libs/engine/events/ConnectionEvent.cpp b/src/libs/engine/events/ConnectionEvent.cpp
index 733a46d4..ce84c4bc 100644
--- a/src/libs/engine/events/ConnectionEvent.cpp
+++ b/src/libs/engine/events/ConnectionEvent.cpp
@@ -42,7 +42,6 @@ ConnectionEvent::ConnectionEvent(Engine& engine, SharedPtr<Responder> responder,
_src_port(NULL),
_dst_port(NULL),
_compiled_patch(NULL),
- _connection(NULL),
_patch_listnode(NULL),
_port_listnode(NULL),
_error(NO_ERROR)
@@ -126,15 +125,15 @@ ConnectionEvent::pre_process()
return;
}
- _connection = new ConnectionImpl(_src_port, _dst_port);
- _port_listnode = new Raul::ListNode<ConnectionImpl*>(_connection);
- _patch_listnode = new Raul::ListNode<ConnectionImpl*>(_connection);
+ _connection = SharedPtr<ConnectionImpl>(new ConnectionImpl(_src_port, _dst_port));
+ _port_listnode = new Patch::Connections::Node(_connection);
+ _patch_listnode = new Patch::Connections::Node(_connection);
// Need to be careful about patch port connections here and adding a node's
// parent as a dependant/provider, or adding a patch as it's own provider...
if (src_node != dst_node && src_node->parent() == dst_node->parent()) {
- dst_node->providers()->push_back(new Raul::ListNode<NodeImpl*>(src_node));
- src_node->dependants()->push_back(new Raul::ListNode<NodeImpl*>(dst_node));
+ dst_node->providers()->push_back(new Raul::List<NodeImpl*>::Node(src_node));
+ src_node->dependants()->push_back(new Raul::List<NodeImpl*>::Node(dst_node));
}
if (_patch->enabled())
diff --git a/src/libs/engine/events/ConnectionEvent.hpp b/src/libs/engine/events/ConnectionEvent.hpp
index d7465566..3c2f1f68 100644
--- a/src/libs/engine/events/ConnectionEvent.hpp
+++ b/src/libs/engine/events/ConnectionEvent.hpp
@@ -19,8 +19,9 @@
#define CONNECTIONEVENT_H
#include <string>
-#include "QueuedEvent.hpp"
#include <raul/Path.hpp>
+#include "QueuedEvent.hpp"
+#include "Patch.hpp"
#include "types.hpp"
using std::string;
@@ -77,9 +78,9 @@ private:
CompiledPatch* _compiled_patch; ///< New process order for Patch
- ConnectionImpl* _connection;
- Raul::ListNode<ConnectionImpl*>* _patch_listnode;
- Raul::ListNode<ConnectionImpl*>* _port_listnode;
+ SharedPtr<ConnectionImpl> _connection;
+ Patch::Connections::Node* _patch_listnode;
+ Patch::Connections::Node* _port_listnode;
ErrorType _error;
};
diff --git a/src/libs/engine/events/CreateNodeEvent.cpp b/src/libs/engine/events/CreateNodeEvent.cpp
index 3a2715e0..a863e008 100644
--- a/src/libs/engine/events/CreateNodeEvent.cpp
+++ b/src/libs/engine/events/CreateNodeEvent.cpp
@@ -91,7 +91,7 @@ CreateNodeEvent::pre_process()
// This can be done here because the audio thread doesn't touch the
// node tree - just the process order array
- _patch->add_node(new Raul::ListNode<NodeImpl*>(_node));
+ _patch->add_node(new Patch::Nodes::Node(_node));
//_node->add_to_store(_engine.object_store());
_engine.object_store()->add(_node);
diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp
index a5b907ab..3d08a44b 100644
--- a/src/libs/engine/events/CreatePatchEvent.cpp
+++ b/src/libs/engine/events/CreatePatchEvent.cpp
@@ -71,7 +71,7 @@ CreatePatchEvent::pre_process()
_patch = new Patch(_engine, _path.name(), poly, _parent, _engine.audio_driver()->sample_rate(), _engine.audio_driver()->buffer_size(), _poly);
if (_parent != NULL) {
- _parent->add_node(new Raul::ListNode<NodeImpl*>(_patch));
+ _parent->add_node(new Patch::Nodes::Node(_patch));
if (_parent->enabled())
_compiled_patch = _parent->compile();
diff --git a/src/libs/engine/events/CreatePortEvent.cpp b/src/libs/engine/events/CreatePortEvent.cpp
index 21875290..cba4dd77 100644
--- a/src/libs/engine/events/CreatePortEvent.cpp
+++ b/src/libs/engine/events/CreatePortEvent.cpp
@@ -95,9 +95,9 @@ CreatePortEvent::pre_process()
if (_patch_port) {
if (_is_output)
- _patch->add_output(new Raul::ListNode<PortImpl*>(_patch_port));
+ _patch->add_output(new Raul::List<PortImpl*>::Node(_patch_port));
else
- _patch->add_input(new Raul::ListNode<PortImpl*>(_patch_port));
+ _patch->add_input(new Raul::List<PortImpl*>::Node(_patch_port));
if (_patch->external_ports())
_ports_array = new Raul::Array<PortImpl*>(old_num_ports + 1, *_patch->external_ports());
diff --git a/src/libs/engine/events/DestroyEvent.hpp b/src/libs/engine/events/DestroyEvent.hpp
index 59a932b3..e253167f 100644
--- a/src/libs/engine/events/DestroyEvent.hpp
+++ b/src/libs/engine/events/DestroyEvent.hpp
@@ -22,6 +22,7 @@
#include <raul/Path.hpp>
#include "QueuedEvent.hpp"
#include "ObjectStore.hpp"
+#include "Patch.hpp"
using std::string;
@@ -34,7 +35,6 @@ template<typename T> class TreeNode;
namespace Ingen {
class GraphObjectImpl;
-class Patch;
class NodeImpl;
class PortImpl;
class DriverPort;
@@ -64,8 +64,8 @@ private:
NodeImpl* _node; ///< Same as _object if it is a Node, otherwise NULL
PortImpl* _port; ///< Same as _object if it is a Port, otherwise NULL
DriverPort* _driver_port;
- Raul::ListNode<NodeImpl*>* _patch_node_listnode;
- Raul::ListNode<PortImpl*>* _patch_port_listnode;
+ Patch::Nodes::Node* _patch_node_listnode;
+ Raul::List<PortImpl*>::Node* _patch_port_listnode;
Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports array for Patch
CompiledPatch* _compiled_patch; ///< Patch's new process order
DisconnectNodeEvent* _disconnect_node_event;
diff --git a/src/libs/engine/events/DisconnectNodeEvent.cpp b/src/libs/engine/events/DisconnectNodeEvent.cpp
index e0507b3a..723bd864 100644
--- a/src/libs/engine/events/DisconnectNodeEvent.cpp
+++ b/src/libs/engine/events/DisconnectNodeEvent.cpp
@@ -70,8 +70,6 @@ DisconnectNodeEvent::~DisconnectNodeEvent()
void
DisconnectNodeEvent::pre_process()
{
- typedef Raul::List<ConnectionImpl*>::const_iterator ConnectionListIterator;
-
if (_lookup) {
_patch = _engine.object_store()->find_patch(_node_path.parent());
@@ -90,14 +88,13 @@ DisconnectNodeEvent::pre_process()
}
}
- ConnectionImpl* c = NULL;
- for (ConnectionListIterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i) {
- c = (*i);
+ for (Patch::Connections::const_iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i) {
+ const SharedPtr<ConnectionImpl> c(*i);
if ((c->src_port()->parent_node() == _node || c->dst_port()->parent_node() == _node) && !c->pending_disconnection()) {
DisconnectionEvent* ev = new DisconnectionEvent(_engine, SharedPtr<Responder>(new Responder()), _time,
c->src_port(), c->dst_port());
ev->pre_process();
- _disconnection_events.push_back(new Raul::ListNode<DisconnectionEvent*>(ev));
+ _disconnection_events.push_back(new Raul::List<DisconnectionEvent*>::Node(ev));
c->pending_disconnection(true);
}
}
diff --git a/src/libs/engine/events/DisconnectPortEvent.cpp b/src/libs/engine/events/DisconnectPortEvent.cpp
index 76a4cbc4..5fa82b15 100644
--- a/src/libs/engine/events/DisconnectPortEvent.cpp
+++ b/src/libs/engine/events/DisconnectPortEvent.cpp
@@ -103,14 +103,14 @@ DisconnectPortEvent::pre_process()
return;
}
- ConnectionImpl* c = NULL;
- for (Raul::List<ConnectionImpl*>::const_iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i) {
- c = (*i);
+ for (Patch::Connections::const_iterator i = _patch->connections().begin();
+ i != _patch->connections().end(); ++i) {
+ const SharedPtr<ConnectionImpl> c(*i);
if ((c->src_port() == _port || c->dst_port() == _port) && !c->pending_disconnection()) {
DisconnectionEvent* ev = new DisconnectionEvent(_engine, SharedPtr<Responder>(new Responder()), _time,
c->src_port(), c->dst_port());
ev->pre_process();
- _disconnection_events.push_back(new Raul::ListNode<DisconnectionEvent*>(ev));
+ _disconnection_events.push_back(new Raul::List<DisconnectionEvent*>::Node(ev));
c->pending_disconnection(true);
}
}
diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp
index 68068821..aa686b0c 100644
--- a/src/libs/engine/events/DisconnectionEvent.cpp
+++ b/src/libs/engine/events/DisconnectionEvent.cpp
@@ -157,20 +157,19 @@ DisconnectionEvent::execute(ProcessContext& context)
QueuedEvent::execute(context);
if (_error == NO_ERROR) {
- Raul::ListNode<ConnectionImpl*>* const port_connection
+ Patch::Connections::Node* const port_connection
= _dst_input_port->remove_connection(_src_output_port);
if (port_connection != NULL) {
- Raul::ListNode<ConnectionImpl*>* const patch_connection
+ Patch::Connections::Node* const patch_connection
= _patch->remove_connection(_src_port, _dst_port);
assert(patch_connection);
- assert((ConnectionImpl*)port_connection->elem() == patch_connection->elem());
+ assert(port_connection->elem() == patch_connection->elem());
- // Clean up both the list node and the connection itself...
+ // Destroy list node, which will drop reference to connection itself
_engine.maid()->push(port_connection);
_engine.maid()->push(patch_connection);
- _engine.maid()->push(port_connection->elem());
if (_patch->compiled_patch() != NULL)
_engine.maid()->push(_patch->compiled_patch());