summaryrefslogtreecommitdiffstats
path: root/src/libs/engine
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-07-26 09:32:49 +0000
committerDavid Robillard <d@drobilla.net>2007-07-26 09:32:49 +0000
commitf7368e7850307de97b024238a4f520afe1150c8b (patch)
treebcc3cb7099c57cb4b3206f68c41e8b828175b18a /src/libs/engine
parent397667bfaffdb622dfcf5bbbf64c49fd6a729f7e (diff)
downloadingen-f7368e7850307de97b024238a4f520afe1150c8b.tar.gz
ingen-f7368e7850307de97b024238a4f520afe1150c8b.tar.bz2
ingen-f7368e7850307de97b024238a4f520afe1150c8b.zip
Add const find interface to Raul::Table, fix bugs.
Use Raul::Table on Ingen client side instead of std::map for objects, plugins. Work on renaming (still broken). git-svn-id: http://svn.drobilla.net/lad/ingen@634 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine')
-rw-r--r--src/libs/engine/NodeBase.cpp10
-rw-r--r--src/libs/engine/ObjectStore.hpp4
-rw-r--r--src/libs/engine/events/RenameEvent.cpp8
-rw-r--r--src/libs/engine/tests/Makefile.am2
-rw-r--r--src/libs/engine/tests/node_tree_test.cpp4
5 files changed, 20 insertions, 8 deletions
diff --git a/src/libs/engine/NodeBase.cpp b/src/libs/engine/NodeBase.cpp
index 04afe3b6..203dc823 100644
--- a/src/libs/engine/NodeBase.cpp
+++ b/src/libs/engine/NodeBase.cpp
@@ -156,6 +156,7 @@ NodeBase::post_process(SampleCount nframes, FrameTime start, FrameTime end)
void
NodeBase::set_path(const Path& new_path)
{
+#if 0
const Path old_path = path();
//cerr << "Renaming " << old_path << " -> " << new_path << endl;
@@ -180,6 +181,15 @@ NodeBase::set_path(const Path& new_path)
assert(_store->find(new_path) == this);
+#endif
+ GraphObject::set_path(new_path);
+
+ // Rename children (ports)
+ for (size_t i=0; i < num_ports(); ++i) {
+ Port* const port = _ports->at(i);
+ const string name = port->path().name();
+ port->set_path(new_path.base() + name);
+ }
}
diff --git a/src/libs/engine/ObjectStore.hpp b/src/libs/engine/ObjectStore.hpp
index 8a5b61c6..9d56cb77 100644
--- a/src/libs/engine/ObjectStore.hpp
+++ b/src/libs/engine/ObjectStore.hpp
@@ -47,8 +47,8 @@ public:
Port* find_port(const Path& path);
GraphObject* find(const Path& path);
- void add(GraphObject* o);
- void add(TreeNode<GraphObject*>* o);
+ void add(GraphObject* o);
+ void add(TreeNode<GraphObject*>* o);
TreeNode<GraphObject*>* remove(const string& key);
const Tree<GraphObject*>& objects() { return _objects; }
diff --git a/src/libs/engine/events/RenameEvent.cpp b/src/libs/engine/events/RenameEvent.cpp
index 035bd005..0a2b0239 100644
--- a/src/libs/engine/events/RenameEvent.cpp
+++ b/src/libs/engine/events/RenameEvent.cpp
@@ -65,7 +65,7 @@ RenameEvent::pre_process()
return;
}
- GraphObject* obj = _engine.object_store()->find(_old_path);
+ TreeNode<GraphObject*>* obj = _engine.object_store()->remove(_old_path);
if (obj == NULL) {
_error = OBJECT_NOT_FOUND;
@@ -81,8 +81,10 @@ RenameEvent::pre_process()
}*/
if (obj != NULL) {
- obj->set_path(_new_path);
- assert(obj->path() == _new_path);
+ obj->node()->set_path(_new_path);
+ obj->key(_new_path);
+ _engine.object_store()->add(obj);
+ assert(obj->node()->path() == _new_path);
}
QueuedEvent::pre_process();
diff --git a/src/libs/engine/tests/Makefile.am b/src/libs/engine/tests/Makefile.am
index 9363f51f..64fdd419 100644
--- a/src/libs/engine/tests/Makefile.am
+++ b/src/libs/engine/tests/Makefile.am
@@ -1,6 +1,6 @@
if BUILD_UNIT_TESTS
-AM_CXXFLAGS = @JACK_CFLAGS@ @RAUL_CFLAGS@ @LIBLO_CFLAGS@ @ALSA_CFLAGS@ -I../../common
+AM_CXXFLAGS = @JACK_CFLAGS@ @LIBLO_CFLAGS@ @ALSA_CFLAGS@ -I$(top_srcdir)/raul -I../../common
common_ldadd = @JACK_LIBS@ @RAUL_LIBS@ @LIBLO_LIBS@ @ALSA_LIBS@ -lrt
node_tree_test_LDADD = $(common_ldadd)
diff --git a/src/libs/engine/tests/node_tree_test.cpp b/src/libs/engine/tests/node_tree_test.cpp
index 2bce9b97..923cb0ba 100644
--- a/src/libs/engine/tests/node_tree_test.cpp
+++ b/src/libs/engine/tests/node_tree_test.cpp
@@ -1,8 +1,8 @@
#include <cstdlib>
#include <iostream>
#include <vector>
-#include "../Tree.h"
-#include "../TreeImplementation.h"
+#include "../Tree.hpp"
+#include "../TreeImplementation.hpp"
using std::vector;
using std::cout; using std::cerr; using std::endl;