summaryrefslogtreecommitdiffstats
path: root/src/libs/client/Store.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-10-08 16:30:57 +0000
committerDavid Robillard <d@drobilla.net>2007-10-08 16:30:57 +0000
commit763bba9de67fb1bd06658a0bac91440727ee5a51 (patch)
tree39e7af069828981c2c06d78e015686062eba73dc /src/libs/client/Store.cpp
parent260a406b12997fdab7446a9980e921d8cfc46915 (diff)
downloadingen-763bba9de67fb1bd06658a0bac91440727ee5a51.tar.gz
ingen-763bba9de67fb1bd06658a0bac91440727ee5a51.tar.bz2
ingen-763bba9de67fb1bd06658a0bac91440727ee5a51.zip
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
Diffstat (limited to 'src/libs/client/Store.cpp')
-rw-r--r--src/libs/client/Store.cpp25
1 files changed, 16 insertions, 9 deletions
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<ObjectModel> object)
// one (with precedence to the new values).
Objects::iterator existing = _objects.find(object->path());
if (existing != _objects.end()) {
- existing->second->set(object);
+ PtrCast<ObjectModel>(existing->second)->set(object);
} else {
if (object->path() != "/") {
@@ -253,7 +253,11 @@ Store::add_object(SharedPtr<ObjectModel> 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<ObjectModel> result = (*i).second;
+ SharedPtr<ObjectModel> result = PtrCast<ObjectModel>((*i).second);
+ assert(result);
//_objects.erase(i);
Objects::iterator descendants_end = _objects.find_descendants_end(i);
- Table<Path,SharedPtr<ObjectModel> > removed = _objects.yank(i, descendants_end);
+ Table<Path, SharedPtr<Shared::GraphObject> > 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<ObjectModel>();
} else {
- assert(i->second->path() == "/" || i->second->parent());
- return i->second;
+ SharedPtr<ObjectModel> model = PtrCast<ObjectModel>(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<Path,SharedPtr<ObjectModel> > removed = _objects.yank(parent, descendants_end);
+ Table<Path, SharedPtr<Shared::GraphObject> > removed = _objects.yank(parent, descendants_end);
assert(removed.size() > 0);
- for (Table<Path,SharedPtr<ObjectModel> >::iterator i = removed.begin(); i != removed.end(); ++i) {
+ for (Table<Path, SharedPtr<Shared::GraphObject> >::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<ObjectModel>(i->second)->set_path(child_new_path);
i->first = child_new_path;
}