diff options
Diffstat (limited to 'src/libs/engine/events')
-rw-r--r-- | src/libs/engine/events/ClearPatchEvent.cpp | 11 | ||||
-rw-r--r-- | src/libs/engine/events/ConnectionEvent.cpp | 11 | ||||
-rw-r--r-- | src/libs/engine/events/ConnectionEvent.hpp | 9 | ||||
-rw-r--r-- | src/libs/engine/events/CreateNodeEvent.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/events/CreatePatchEvent.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/events/CreatePortEvent.cpp | 4 | ||||
-rw-r--r-- | src/libs/engine/events/DestroyEvent.hpp | 6 | ||||
-rw-r--r-- | src/libs/engine/events/DisconnectNodeEvent.cpp | 9 | ||||
-rw-r--r-- | src/libs/engine/events/DisconnectPortEvent.cpp | 8 | ||||
-rw-r--r-- | src/libs/engine/events/DisconnectionEvent.cpp | 9 |
10 files changed, 34 insertions, 37 deletions
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()); |