summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-07-30 16:54:03 +0000
committerDavid Robillard <d@drobilla.net>2012-07-30 16:54:03 +0000
commit155f4c422735cdb7400d9290dc6defca8f580a1b (patch)
treea3a79ec2db90d91ed7f238f8ce138f1e83dc23f8 /src
parenta2aaeab5f5a42c7980ea0e015a143bb01fdb4015 (diff)
downloadingen-155f4c422735cdb7400d9290dc6defca8f580a1b.tar.gz
ingen-155f4c422735cdb7400d9290dc6defca8f580a1b.tar.bz2
ingen-155f4c422735cdb7400d9290dc6defca8f580a1b.zip
Shrink events.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4574 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/server/events/Connect.cpp66
-rw-r--r--src/server/events/Connect.hpp17
-rw-r--r--src/server/events/CreateNode.cpp7
-rw-r--r--src/server/events/CreateNode.hpp3
-rw-r--r--src/server/events/Delete.cpp13
-rw-r--r--src/server/events/Delete.hpp1
-rw-r--r--src/server/events/Delta.cpp5
-rw-r--r--src/server/events/Delta.hpp2
-rw-r--r--src/server/events/Disconnect.cpp22
-rw-r--r--src/server/events/Disconnect.hpp10
-rw-r--r--src/server/events/DisconnectAll.cpp4
-rw-r--r--src/server/events/DisconnectAll.hpp18
-rw-r--r--src/server/events/SetPortValue.cpp9
-rw-r--r--src/server/events/SetPortValue.hpp3
14 files changed, 80 insertions, 100 deletions
diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp
index dc6f7b99..e4468c3a 100644
--- a/src/server/events/Connect.cpp
+++ b/src/server/events/Connect.cpp
@@ -44,8 +44,7 @@ Connect::Connect(Engine& engine,
, _tail_path(tail_path)
, _head_path(head_path)
, _patch(NULL)
- , _src_output_port(NULL)
- , _dst_input_port(NULL)
+ , _head(NULL)
, _compiled_patch(NULL)
, _buffers(NULL)
{}
@@ -63,50 +62,49 @@ Connect::pre_process()
return Event::pre_process_done(PORT_NOT_FOUND, _head_path.str());
}
- _dst_input_port = dynamic_cast<InputPort*>(head);
- _src_output_port = dynamic_cast<OutputPort*>(tail);
- if (!_dst_input_port || !_src_output_port) {
+ OutputPort* tail_output = dynamic_cast<OutputPort*>(tail);
+ _head = dynamic_cast<InputPort*>(head);
+ if (!tail_output || !_head) {
return Event::pre_process_done(DIRECTION_MISMATCH, _head_path.str());
}
- NodeImpl* const src_node = tail->parent_node();
- NodeImpl* const dst_node = head->parent_node();
- if (!src_node || !dst_node) {
+ NodeImpl* const tail_node = tail->parent_node();
+ NodeImpl* const head_node = head->parent_node();
+ if (!tail_node || !head_node) {
return Event::pre_process_done(PARENT_NOT_FOUND, _head_path.str());
}
- if (src_node->parent() != dst_node->parent()
- && src_node != dst_node->parent()
- && src_node->parent() != dst_node) {
+ if (tail_node->parent() != head_node->parent()
+ && tail_node != head_node->parent()
+ && tail_node->parent() != head_node) {
return Event::pre_process_done(PARENT_DIFFERS, _head_path.str());
}
- if (!EdgeImpl::can_connect(_src_output_port, _dst_input_port)) {
+ if (!EdgeImpl::can_connect(tail_output, _head)) {
return Event::pre_process_done(TYPE_MISMATCH, _head_path);
}
- if (src_node->parent_patch() != dst_node->parent_patch()) {
+ if (tail_node->parent_patch() != head_node->parent_patch()) {
// Edge to a patch port from inside the patch
- assert(src_node->parent() == dst_node || dst_node->parent() == src_node);
- if (src_node->parent() == dst_node) {
- _patch = dynamic_cast<PatchImpl*>(dst_node);
+ assert(tail_node->parent() == head_node || head_node->parent() == tail_node);
+ if (tail_node->parent() == head_node) {
+ _patch = dynamic_cast<PatchImpl*>(head_node);
} else {
- _patch = dynamic_cast<PatchImpl*>(src_node);
+ _patch = dynamic_cast<PatchImpl*>(tail_node);
}
- } else if (src_node == dst_node && dynamic_cast<PatchImpl*>(src_node)) {
+ } else if (tail_node == head_node && dynamic_cast<PatchImpl*>(tail_node)) {
// Edge from a patch input to a patch output (pass through)
- _patch = dynamic_cast<PatchImpl*>(src_node);
+ _patch = dynamic_cast<PatchImpl*>(tail_node);
} else {
// Normal edge between nodes with the same parent
- _patch = src_node->parent_patch();
+ _patch = tail_node->parent_patch();
}
- if (_patch->has_edge(_src_output_port, _dst_input_port)) {
+ if (_patch->has_edge(tail_output, _head)) {
return Event::pre_process_done(EXISTS, _head_path);
}
- _edge = SharedPtr<EdgeImpl>(
- new EdgeImpl(_src_output_port, _dst_input_port));
+ _edge = SharedPtr<EdgeImpl>(new EdgeImpl(tail_output, _head));
rlock.release();
@@ -117,19 +115,19 @@ Connect::pre_process()
node's parent as a dependant/provider, or adding a patch as its own
provider...
*/
- if (src_node != dst_node && src_node->parent() == dst_node->parent()) {
- dst_node->providers().push_back(src_node);
- src_node->dependants().push_back(dst_node);
+ if (tail_node != head_node && tail_node->parent() == head_node->parent()) {
+ head_node->providers().push_back(tail_node);
+ tail_node->dependants().push_back(head_node);
}
_patch->add_edge(_edge);
- _dst_input_port->increment_num_edges();
+ _head->increment_num_edges();
}
- _buffers = new Raul::Array<BufferRef>(_dst_input_port->poly());
- _dst_input_port->get_buffers(_engine.message_context(),
- *_engine.buffer_factory(),
- _buffers, _dst_input_port->poly());
+ _buffers = new Raul::Array<BufferRef>(_head->poly());
+ _head->get_buffers(_engine.message_context(),
+ *_engine.buffer_factory(),
+ _buffers, _head->poly());
if (_patch->enabled()) {
_compiled_patch = _patch->compile();
@@ -142,9 +140,9 @@ void
Connect::execute(ProcessContext& context)
{
if (!_status) {
- _dst_input_port->add_edge(context, _edge.get());
- _engine.maid()->push(_dst_input_port->set_buffers(context, _buffers));
- _dst_input_port->connect_buffers();
+ _head->add_edge(context, _edge.get());
+ _engine.maid()->push(_head->set_buffers(context, _buffers));
+ _head->connect_buffers();
_engine.maid()->push(_patch->compiled_patch());
_patch->compiled_patch(_compiled_patch);
}
diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp
index 87de6104..8d75d2da 100644
--- a/src/server/events/Connect.hpp
+++ b/src/server/events/Connect.hpp
@@ -57,17 +57,12 @@ public:
void post_process();
private:
- Raul::Path _tail_path;
- Raul::Path _head_path;
-
- PatchImpl* _patch;
- OutputPort* _src_output_port;
- InputPort* _dst_input_port;
-
- CompiledPatch* _compiled_patch; ///< New process order for Patch
-
- SharedPtr<EdgeImpl> _edge;
-
+ const Raul::Path _tail_path;
+ const Raul::Path _head_path;
+ PatchImpl* _patch;
+ InputPort* _head;
+ CompiledPatch* _compiled_patch;
+ SharedPtr<EdgeImpl> _edge;
Raul::Array<BufferRef>* _buffers;
};
diff --git a/src/server/events/CreateNode.cpp b/src/server/events/CreateNode.cpp
index b8e795e8..f7e570f0 100644
--- a/src/server/events/CreateNode.cpp
+++ b/src/server/events/CreateNode.cpp
@@ -53,9 +53,10 @@ CreateNode::pre_process()
typedef Resource::Properties::const_iterator iterator;
+ std::string plugin_uri;
const iterator t = _properties.find(uris.ingen_prototype);
if (t != _properties.end() && t->second.type() == uris.forge.URI) {
- _plugin_uri = t->second.get_uri();
+ plugin_uri = t->second.get_uri();
} else {
return Event::pre_process_done(BAD_REQUEST);
}
@@ -68,9 +69,9 @@ CreateNode::pre_process()
return Event::pre_process_done(PARENT_NOT_FOUND, _path.parent().str());
}
- PluginImpl* plugin = _engine.node_factory()->plugin(_plugin_uri);
+ PluginImpl* plugin = _engine.node_factory()->plugin(plugin_uri);
if (!plugin) {
- return Event::pre_process_done(PLUGIN_NOT_FOUND, _plugin_uri);
+ return Event::pre_process_done(PLUGIN_NOT_FOUND, plugin_uri);
}
const iterator p = _properties.find(uris.ingen_polyphonic);
diff --git a/src/server/events/CreateNode.hpp b/src/server/events/CreateNode.hpp
index 358c2eae..32c0f4b9 100644
--- a/src/server/events/CreateNode.hpp
+++ b/src/server/events/CreateNode.hpp
@@ -56,12 +56,11 @@ private:
typedef std::list< std::pair<Raul::URI, Resource::Properties> > Update;
Raul::Path _path;
- std::string _plugin_uri;
Resource::Properties _properties;
Update _update;
PatchImpl* _patch;
NodeImpl* _node;
- CompiledPatch* _compiled_patch; ///< Patch's new process order
+ CompiledPatch* _compiled_patch;
};
} // namespace Events
diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp
index 9c68f4fe..b16a1f8d 100644
--- a/src/server/events/Delete.cpp
+++ b/src/server/events/Delete.cpp
@@ -41,7 +41,6 @@ Delete::Delete(Engine& engine,
const Raul::URI& uri)
: Event(engine, client, id, time)
, _uri(uri)
- , _store_iterator(engine.engine_store()->end())
, _garbage(NULL)
, _engine_port(NULL)
, _patch_node_listnode(NULL)
@@ -73,17 +72,17 @@ Delete::pre_process()
_removed_bindings = _engine.control_bindings()->remove(_path);
- _store_iterator = _engine.engine_store()->find(_path);
+ EngineStore::iterator iter = _engine.engine_store()->find(_path);
- if (_store_iterator != _engine.engine_store()->end()) {
- _node = PtrCast<NodeImpl>(_store_iterator->second);
+ if (iter != _engine.engine_store()->end()) {
+ _node = PtrCast<NodeImpl>(iter->second);
if (!_node)
- _port = PtrCast<PortImpl>(_store_iterator->second);
+ _port = PtrCast<PortImpl>(iter->second);
}
- if (_store_iterator != _engine.engine_store()->end()) {
- _removed_table = _engine.engine_store()->remove(_store_iterator);
+ if (iter != _engine.engine_store()->end()) {
+ _removed_table = _engine.engine_store()->remove(iter);
}
if (_node && !_path.is_root()) {
diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp
index 45a92cd7..4e8f58cd 100644
--- a/src/server/events/Delete.hpp
+++ b/src/server/events/Delete.hpp
@@ -70,7 +70,6 @@ public:
private:
Raul::URI _uri;
Raul::Path _path;
- EngineStore::iterator _store_iterator;
SharedPtr<NodeImpl> _node; ///< Non-NULL iff a node
SharedPtr<PortImpl> _port; ///< Non-NULL iff a port
Raul::Deletable* _garbage;
diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp
index 0f067a7e..1adb9ba1 100644
--- a/src/server/events/Delta.cpp
+++ b/src/server/events/Delta.cpp
@@ -18,9 +18,8 @@
#include <glibmm/thread.h>
-#include "raul/Maid.hpp"
-
#include "ingen/shared/URIs.hpp"
+#include "raul/Maid.hpp"
#include "Broadcaster.hpp"
#include "ControlBindings.hpp"
@@ -65,8 +64,8 @@ Delta::Delta(Engine& engine,
, _object(NULL)
, _patch(NULL)
, _compiled_patch(NULL)
- , _create(create)
, _context(context)
+ , _create(create)
{
if (context != Resource::DEFAULT) {
Resource::set_context(_properties, context);
diff --git a/src/server/events/Delta.hpp b/src/server/events/Delta.hpp
index d3c6e5db..e7d708ae 100644
--- a/src/server/events/Delta.hpp
+++ b/src/server/events/Delta.hpp
@@ -107,9 +107,9 @@ private:
Ingen::Shared::ResourceImpl* _object;
PatchImpl* _patch;
CompiledPatch* _compiled_patch;
- bool _create;
Resource::Graph _context;
ControlBindings::Key _binding;
+ bool _create;
SharedPtr<ControlBindings::Bindings> _old_bindings;
};
diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp
index 00e4b374..e797c6a7 100644
--- a/src/server/events/Disconnect.cpp
+++ b/src/server/events/Disconnect.cpp
@@ -50,8 +50,6 @@ Disconnect::Disconnect(Engine& engine,
, _tail_path(tail_path)
, _head_path(head_path)
, _patch(NULL)
- , _tail(NULL)
- , _head(NULL)
, _impl(NULL)
, _compiled_patch(NULL)
{
@@ -122,17 +120,17 @@ Disconnect::pre_process()
return Event::pre_process_done(PARENT_DIFFERS, _head_path);
}
- _tail = _engine.engine_store()->find_port(_tail_path);
- _head = _engine.engine_store()->find_port(_head_path);
+ PortImpl* tail = _engine.engine_store()->find_port(_tail_path);
+ PortImpl* head = _engine.engine_store()->find_port(_head_path);
- if (!_tail) {
+ if (!tail) {
return Event::pre_process_done(PORT_NOT_FOUND, _tail_path);
- } else if (!_head) {
+ } else if (!head) {
return Event::pre_process_done(PORT_NOT_FOUND, _head_path);
}
- NodeImpl* const src_node = _tail->parent_node();
- NodeImpl* const dst_node = _head->parent_node();
+ NodeImpl* const src_node = tail->parent_node();
+ NodeImpl* const dst_node = head->parent_node();
if (src_node->parent_patch() != dst_node->parent_patch()) {
// Edge to a patch port from inside the patch
@@ -152,7 +150,7 @@ Disconnect::pre_process()
assert(_patch);
- if (!_patch->has_edge(_tail, _head)) {
+ if (!_patch->has_edge(tail, head)) {
return Event::pre_process_done(NOT_FOUND, _head_path);
}
@@ -162,8 +160,8 @@ Disconnect::pre_process()
_impl = new Impl(_engine,
_patch,
- dynamic_cast<OutputPort*>(_tail),
- dynamic_cast<InputPort*>(_head));
+ dynamic_cast<OutputPort*>(tail),
+ dynamic_cast<InputPort*>(head));
if (_patch->enabled())
_compiled_patch = _patch->compile();
@@ -217,7 +215,7 @@ void
Disconnect::post_process()
{
if (!respond()) {
- _engine.broadcaster()->disconnect(_tail->path(), _head->path());
+ _engine.broadcaster()->disconnect(_tail_path, _head_path);
}
delete _impl;
diff --git a/src/server/events/Disconnect.hpp b/src/server/events/Disconnect.hpp
index 1f846806..bcd8f1bc 100644
--- a/src/server/events/Disconnect.hpp
+++ b/src/server/events/Disconnect.hpp
@@ -79,13 +79,9 @@ public:
private:
const Raul::Path _tail_path;
const Raul::Path _head_path;
-
- PatchImpl* _patch;
- PortImpl* _tail;
- PortImpl* _head;
-
- Impl* _impl;
- CompiledPatch* _compiled_patch;
+ PatchImpl* _patch;
+ Impl* _impl;
+ CompiledPatch* _compiled_patch;
};
} // namespace Events
diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp
index e1310251..13d6e00f 100644
--- a/src/server/events/DisconnectAll.cpp
+++ b/src/server/events/DisconnectAll.cpp
@@ -45,10 +45,10 @@ DisconnectAll::DisconnectAll(Engine& engine,
int32_t id,
SampleCount timestamp,
const Raul::Path& parent_path,
- const Raul::Path& node_path)
+ const Raul::Path& path)
: Event(engine, client, id, timestamp)
, _parent_path(parent_path)
- , _path(node_path)
+ , _path(path)
, _parent(NULL)
, _node(NULL)
, _port(NULL)
diff --git a/src/server/events/DisconnectAll.hpp b/src/server/events/DisconnectAll.hpp
index 4f7d13f4..a6d5d3d6 100644
--- a/src/server/events/DisconnectAll.hpp
+++ b/src/server/events/DisconnectAll.hpp
@@ -61,18 +61,16 @@ public:
void post_process();
private:
- Raul::Path _parent_path;
- Raul::Path _path;
- PatchImpl* _parent;
- NodeImpl* _node;
- PortImpl* _port;
-
typedef std::list<Disconnect::Impl*> Impls;
- Impls _impls;
-
- CompiledPatch* _compiled_patch; ///< New process order for Patch
- bool _deleting;
+ Raul::Path _parent_path;
+ Raul::Path _path;
+ PatchImpl* _parent;
+ NodeImpl* _node;
+ PortImpl* _port;
+ Impls _impls;
+ CompiledPatch* _compiled_patch;
+ bool _deleting;
};
} // namespace Events
diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp
index 005974a2..e0a56489 100644
--- a/src/server/events/SetPortValue.cpp
+++ b/src/server/events/SetPortValue.cpp
@@ -43,9 +43,8 @@ SetPortValue::SetPortValue(Engine& engine,
PortImpl* port,
const Raul::Atom& value)
: Event(engine, client, id, timestamp)
- , _port_path(port->path())
- , _value(value)
, _port(port)
+ , _value(value)
{
}
@@ -57,7 +56,7 @@ bool
SetPortValue::pre_process()
{
if (_port->is_output()) {
- return Event::pre_process_done(DIRECTION_MISMATCH, _port_path);
+ return Event::pre_process_done(DIRECTION_MISMATCH, _port->path());
}
// Port is on a message context node, set value and run
@@ -119,7 +118,7 @@ SetPortValue::apply(Context& context)
(const uint8_t*)_value.get_body())) {
_port->raise_set_by_user_flag();
} else {
- Raul::warn(Raul::fmt("Error writing to port %1%\n") % _port_path);
+ Raul::warn(Raul::fmt("Error writing to port %1%\n") % _port->path());
}
} else {
Raul::warn(Raul::fmt("Unknown value type %1%\n") % _value.type());
@@ -131,7 +130,7 @@ SetPortValue::post_process()
{
if (!respond()) {
_engine.broadcaster()->set_property(
- _port_path,
+ _port->path(),
_engine.world()->uris().ingen_value,
_value);
}
diff --git a/src/server/events/SetPortValue.hpp b/src/server/events/SetPortValue.hpp
index e328ff9e..93a4b528 100644
--- a/src/server/events/SetPortValue.hpp
+++ b/src/server/events/SetPortValue.hpp
@@ -58,9 +58,8 @@ public:
private:
void apply(Context& context);
- const Raul::Path _port_path;
- const Raul::Atom _value;
PortImpl* _port;
+ const Raul::Atom _value;
ControlBindings::Key _binding;
};