From 763bba9de67fb1bd06658a0bac91440727ee5a51 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 8 Oct 2007 16:30:57 +0000 Subject: SharedPtr-ify engine side store. Fix reattaching to engine. Fix connection paths. Remove last dependencies on client (model) library from Serialiser. Fix Raul::PathTable::find_descendants_end. git-svn-id: http://svn.drobilla.net/lad/ingen@847 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/Store.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'src/libs/client/Store.cpp') diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp index e1744ac0..ae07fa08 100644 --- a/src/libs/client/Store.cpp +++ b/src/libs/client/Store.cpp @@ -222,7 +222,7 @@ Store::add_object(SharedPtr object) // one (with precedence to the new values). Objects::iterator existing = _objects.find(object->path()); if (existing != _objects.end()) { - existing->second->set(object); + PtrCast(existing->second)->set(object); } else { if (object->path() != "/") { @@ -253,7 +253,11 @@ Store::add_object(SharedPtr object) } - //cout << "[Store] Added " << object->path() << endl; + /*cout << "[Store] Added " << object->path() << " {" << endl; + for (Objects::iterator i = _objects.begin(); i != _objects.end(); ++i) { + cout << "\t" << i->first << endl; + } + cout << "}" << endl;*/ } @@ -264,10 +268,11 @@ Store::remove_object(const Path& path) if (i != _objects.end()) { assert((*i).second->path() == path); - SharedPtr result = (*i).second; + SharedPtr result = PtrCast((*i).second); + assert(result); //_objects.erase(i); Objects::iterator descendants_end = _objects.find_descendants_end(i); - Table > removed = _objects.yank(i, descendants_end); + Table > removed = _objects.yank(i, descendants_end); /*cout << "[Store] Removing " << i->first << " {" << endl; for (Objects::iterator i = removed.begin(); i != removed.end(); ++i) { cout << "\t" << i->first << endl; @@ -317,8 +322,10 @@ Store::object(const Path& path) if (i == _objects.end()) { return SharedPtr(); } else { - assert(i->second->path() == "/" || i->second->parent()); - return i->second; + SharedPtr model = PtrCast(i->second); + assert(model); + assert(model->path() == "/" || model->parent()); + return model; } } @@ -358,11 +365,11 @@ Store::rename_event(const Path& old_path, const Path& new_path) Objects::iterator descendants_end = _objects.find_descendants_end(parent); - Table > removed = _objects.yank(parent, descendants_end); + Table > removed = _objects.yank(parent, descendants_end); assert(removed.size() > 0); - for (Table >::iterator i = removed.begin(); i != removed.end(); ++i) { + for (Table >::iterator i = removed.begin(); i != removed.end(); ++i) { const Path& child_old_path = i->first; assert(Path::descendant_comparator(old_path, child_old_path)); @@ -373,7 +380,7 @@ Store::rename_event(const Path& old_path, const Path& new_path) child_new_path = new_path.base() + child_old_path.substr(old_path.length()+1); cerr << "[Store] Renamed " << child_old_path << " -> " << child_new_path << endl; - i->second->set_path(child_new_path); + PtrCast(i->second)->set_path(child_new_path); i->first = child_new_path; } -- cgit v1.2.1