VnodeCacher::~VnodeCacher() { Vnodes vnodes; // enumrate all Vnodes for (DirectoriesMap::const_iterator it = directories_->begin(); it != directories_->end(); ++it) { vnodes.push_back((*it).first); EntriesMap* entries = (*it).second; for (EntriesMap::iterator i = entries->begin(); i != entries->end(); i++) { vnodes.push_back((*i).second); } delete entries; } // enumrate unique Vnodes sort(vnodes.begin(), vnodes.end()); Vnodes::iterator v = unique(vnodes.begin(), vnodes.end()); vnodes.erase(v ,vnodes.end()); for (Vnodes::const_iterator it = vnodes.begin(); it != vnodes.end(); ++it) { Vnode* v = (*it); // todo. v->fs will be destroyed before coming this line. // v->fs->destroy_vnode(v); } delete directories_; }
void VnodeCacher::enumCaches(Vnode* directory, std::vector<std::string>& caches) { DirectoriesMap::iterator it = directories_->find(directory); if (it == directories_->end()) { return; } EntriesMap* entries = it->second; for (EntriesMap::const_iterator eit = entries->begin(); eit != entries->end(); ++eit) { caches.push_back(eit->first); } }
void PivotTable::cleanup() { EntriesMap* entries = 0; for (Container::iterator iter = mDocumentMap.begin(); iter != mDocumentMap.end(); ++iter) { entries = iter->second; for (EntriesMap::iterator theIterEntries = entries->begin(); theIterEntries != entries->end(); ++theIterEntries) { if (theIterEntries->second) { delete theIterEntries->second; theIterEntries->second = 0; } } delete entries; delete[] iter->first; iter->second = 0; } }