void forEachValue(_Predicate predicate) const { if (_instance == NULL) return; if (!_mutex) _mutex = new FastMutex(); FastMutex::ScopedLock _(*_mutex); if (_instance == NULL) return; typename StringTypeMap::const_iterator iter = _instance->begin(); for(; iter != _instance->end(); ++iter) predicate(*(iter->second)); }
void getNames(_InsertIterator inserter) const { if (_instance == NULL) return; if (!_mutex) _mutex = new FastMutex(); FastMutex::ScopedLock _(*_mutex); if (_instance == NULL) return; typename StringTypeMap::const_iterator iter = _instance->begin(); for(; iter != _instance->end(); ++iter, ++inserter) inserter = iter->first; }
void cleanCache(void) { if (_instance == NULL) return; if (!_mutex) _mutex = new FastMutex(); FastMutex::ScopedLock _(*_mutex); if (_instance == NULL) return; #if defined(_DEBUG) || defined(DEBUG) std::cout << "Clean instance map of " << _Name <<" - Number object: " << _instance->size() << std::endl; #endif StringTypeMap * instance = _instance; _instance = NULL; typename StringTypeMap::iterator result = instance->begin(); for(; result != instance->end(); ++result) delete result->second; instance->clear(); delete instance; }