summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-10-08 04:51:33 +0000
committerDavid Robillard <d@drobilla.net>2007-10-08 04:51:33 +0000
commit260a406b12997fdab7446a9980e921d8cfc46915 (patch)
treed900ce2737a2b027a632c6ecb80cf889cb6ebc6d
parentfae7e7519afae5f42836eaaf5e317151ea9c4378 (diff)
downloadingen-260a406b12997fdab7446a9980e921d8cfc46915.tar.gz
ingen-260a406b12997fdab7446a9980e921d8cfc46915.tar.bz2
ingen-260a406b12997fdab7446a9980e921d8cfc46915.zip
SharedPtr-ize engine-side Connections (towards merge for patch->connections()).
git-svn-id: http://svn.drobilla.net/lad/ingen@846 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/libs/engine/InputPort.cpp4
-rw-r--r--src/libs/engine/ObjectSender.cpp9
-rw-r--r--src/libs/engine/Patch.cpp14
-rw-r--r--src/libs/engine/Patch.hpp6
-rw-r--r--src/libs/engine/events/ClearPatchEvent.cpp2
-rw-r--r--src/libs/engine/events/ConnectionEvent.cpp2
-rw-r--r--src/libs/engine/events/ConnectionEvent.hpp7
-rw-r--r--src/libs/engine/events/DisconnectNodeEvent.cpp2
-rw-r--r--src/libs/engine/events/DisconnectPortEvent.cpp2
-rw-r--r--src/libs/engine/events/DisconnectionEvent.cpp2
10 files changed, 26 insertions, 24 deletions
diff --git a/src/libs/engine/InputPort.cpp b/src/libs/engine/InputPort.cpp
index ed0a3c4c..b9723855 100644
--- a/src/libs/engine/InputPort.cpp
+++ b/src/libs/engine/InputPort.cpp
@@ -43,8 +43,8 @@ InputPort::set_buffer_size(size_t size)
PortImpl::set_buffer_size(size);
assert(_buffer_size = size);
- for (Raul::List< SharedPtr<ConnectionImpl> >::iterator c = _connections.begin(); c != _connections.end(); ++c)
- (*c)->set_buffer_size(size);
+ for (Connections::iterator c = _connections.begin(); c != _connections.end(); ++c)
+ ((ConnectionImpl*)c->get())->set_buffer_size(size);
}
diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp
index 4d0adb51..208e1333 100644
--- a/src/libs/engine/ObjectSender.cpp
+++ b/src/libs/engine/ObjectSender.cpp
@@ -54,12 +54,9 @@ ObjectSender::send_patch(ClientInterface* client, const Patch* patch, bool recur
}
// Send connections
- 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());
-
- }
+ for (Patch::Connections::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 39348ce9..8256f0c5 100644
--- a/src/libs/engine/Patch.cpp
+++ b/src/libs/engine/Patch.cpp
@@ -54,7 +54,7 @@ Patch::~Patch()
{
assert(!_activated);
- for (List< SharedPtr<ConnectionImpl> >::iterator i = _connections.begin(); i != _connections.end(); ++i) {
+ for (Connections::iterator i = _connections.begin(); i != _connections.end(); ++i) {
(*i).reset();
delete _connections.erase(i);
}
@@ -116,8 +116,8 @@ Patch::prepare_internal_poly(uint32_t poly)
for (List<NodeImpl*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i)
(*i)->prepare_poly(poly);
- for (List< SharedPtr<ConnectionImpl> >::iterator i = _connections.begin(); i != _connections.end(); ++i)
- (*i)->prepare_poly(poly);
+ for (Connections::iterator i = _connections.begin(); i != _connections.end(); ++i)
+ ((ConnectionImpl*)i->get())->prepare_poly(poly);
/* FIXME: Deal with failure */
@@ -133,8 +133,8 @@ Patch::apply_internal_poly(Raul::Maid& maid, uint32_t poly)
for (List<NodeImpl*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i)
(*i)->apply_poly(maid, poly);
- for (List< SharedPtr<ConnectionImpl> >::iterator i = _connections.begin(); i != _connections.end(); ++i)
- (*i)->apply_poly(maid, poly);
+ for (Connections::iterator i = _connections.begin(); i != _connections.end(); ++i)
+ PtrCast<ConnectionImpl>(*i)->apply_poly(maid, poly);
_internal_poly = poly;
@@ -290,9 +290,11 @@ Patch::remove_connection(const PortImpl* src_port, const PortImpl* dst_port)
bool found = false;
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) {
+ ConnectionImpl* const c = (ConnectionImpl*)i->get();
+ if (c->src_port() == src_port && c->dst_port() == dst_port) {
connection = _connections.erase(i);
found = true;
+ break;
}
}
diff --git a/src/libs/engine/Patch.hpp b/src/libs/engine/Patch.hpp
index 3097a87a..8b9f9ad7 100644
--- a/src/libs/engine/Patch.hpp
+++ b/src/libs/engine/Patch.hpp
@@ -34,6 +34,8 @@ using Raul::List;
namespace Ingen {
+namespace Shared { class Connection; }
+
class ConnectionImpl;
class Engine;
class CompiledPatch;
@@ -85,8 +87,8 @@ public:
// Patch specific stuff not inherited from Node
- typedef List< SharedPtr<ConnectionImpl> > Connections;
- typedef List<NodeImpl*> Nodes;
+ typedef List< SharedPtr<Shared::Connection> > Connections;
+ typedef List<NodeImpl*> Nodes;
void add_node(Nodes::Node* tn);
Nodes::Node* remove_node(const string& name);
diff --git a/src/libs/engine/events/ClearPatchEvent.cpp b/src/libs/engine/events/ClearPatchEvent.cpp
index 84731d0a..0d76724a 100644
--- a/src/libs/engine/events/ClearPatchEvent.cpp
+++ b/src/libs/engine/events/ClearPatchEvent.cpp
@@ -92,7 +92,7 @@ ClearPatchEvent::post_process()
_patch->nodes().clear();
// Delete all connections
- for (List< SharedPtr<ConnectionImpl> >::iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i)
+ for (Patch::Connections::iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i)
(*i).reset();
_patch->connections().clear();
diff --git a/src/libs/engine/events/ConnectionEvent.cpp b/src/libs/engine/events/ConnectionEvent.cpp
index ce84c4bc..3a954781 100644
--- a/src/libs/engine/events/ConnectionEvent.cpp
+++ b/src/libs/engine/events/ConnectionEvent.cpp
@@ -126,8 +126,8 @@ ConnectionEvent::pre_process()
}
_connection = SharedPtr<ConnectionImpl>(new ConnectionImpl(_src_port, _dst_port));
- _port_listnode = new Patch::Connections::Node(_connection);
_patch_listnode = new Patch::Connections::Node(_connection);
+ _port_listnode = new InputPort::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...
diff --git a/src/libs/engine/events/ConnectionEvent.hpp b/src/libs/engine/events/ConnectionEvent.hpp
index 3c2f1f68..1d46be6f 100644
--- a/src/libs/engine/events/ConnectionEvent.hpp
+++ b/src/libs/engine/events/ConnectionEvent.hpp
@@ -22,6 +22,7 @@
#include <raul/Path.hpp>
#include "QueuedEvent.hpp"
#include "Patch.hpp"
+#include "InputPort.hpp"
#include "types.hpp"
using std::string;
@@ -78,9 +79,9 @@ private:
CompiledPatch* _compiled_patch; ///< New process order for Patch
- SharedPtr<ConnectionImpl> _connection;
- Patch::Connections::Node* _patch_listnode;
- Patch::Connections::Node* _port_listnode;
+ SharedPtr<ConnectionImpl> _connection;
+ Patch::Connections::Node* _patch_listnode;
+ InputPort::Connections::Node* _port_listnode;
ErrorType _error;
};
diff --git a/src/libs/engine/events/DisconnectNodeEvent.cpp b/src/libs/engine/events/DisconnectNodeEvent.cpp
index 723bd864..f085e974 100644
--- a/src/libs/engine/events/DisconnectNodeEvent.cpp
+++ b/src/libs/engine/events/DisconnectNodeEvent.cpp
@@ -89,7 +89,7 @@ DisconnectNodeEvent::pre_process()
}
for (Patch::Connections::const_iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i) {
- const SharedPtr<ConnectionImpl> c(*i);
+ ConnectionImpl* c = (ConnectionImpl*)i->get();
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());
diff --git a/src/libs/engine/events/DisconnectPortEvent.cpp b/src/libs/engine/events/DisconnectPortEvent.cpp
index 5fa82b15..9aaf5c45 100644
--- a/src/libs/engine/events/DisconnectPortEvent.cpp
+++ b/src/libs/engine/events/DisconnectPortEvent.cpp
@@ -105,7 +105,7 @@ DisconnectPortEvent::pre_process()
for (Patch::Connections::const_iterator i = _patch->connections().begin();
i != _patch->connections().end(); ++i) {
- const SharedPtr<ConnectionImpl> c(*i);
+ ConnectionImpl* c = (ConnectionImpl*)i->get();
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());
diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp
index aa686b0c..6e69c3ba 100644
--- a/src/libs/engine/events/DisconnectionEvent.cpp
+++ b/src/libs/engine/events/DisconnectionEvent.cpp
@@ -157,7 +157,7 @@ DisconnectionEvent::execute(ProcessContext& context)
QueuedEvent::execute(context);
if (_error == NO_ERROR) {
- Patch::Connections::Node* const port_connection
+ InputPort::Connections::Node* const port_connection
= _dst_input_port->remove_connection(_src_output_port);
if (port_connection != NULL) {