From f7368e7850307de97b024238a4f520afe1150c8b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 26 Jul 2007 09:32:49 +0000 Subject: 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 --- src/libs/engine/NodeBase.cpp | 10 ++++++++++ src/libs/engine/ObjectStore.hpp | 4 ++-- src/libs/engine/events/RenameEvent.cpp | 8 +++++--- src/libs/engine/tests/Makefile.am | 2 +- src/libs/engine/tests/node_tree_test.cpp | 4 ++-- 5 files changed, 20 insertions(+), 8 deletions(-) (limited to 'src/libs/engine') 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* o); + void add(GraphObject* o); + void add(TreeNode* o); TreeNode* remove(const string& key); const Tree& 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* 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 #include #include -#include "../Tree.h" -#include "../TreeImplementation.h" +#include "../Tree.hpp" +#include "../TreeImplementation.hpp" using std::vector; using std::cout; using std::cerr; using std::endl; -- cgit v1.2.1