diff options
Diffstat (limited to 'cpp/src/IceGrid/Cache.h')
-rw-r--r-- | cpp/src/IceGrid/Cache.h | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/cpp/src/IceGrid/Cache.h b/cpp/src/IceGrid/Cache.h index 284ba6953d0..295aa4a55b4 100644 --- a/cpp/src/IceGrid/Cache.h +++ b/cpp/src/IceGrid/Cache.h @@ -38,21 +38,21 @@ public: bool has(const Key& key) const { - Lock sync(*this); - return getImpl(key); + Lock sync(*this); + return getImpl(key); } void remove(const Key& key) { - Lock sync(*this); - removeImpl(key); + Lock sync(*this); + removeImpl(key); } void setTraceLevels(const TraceLevelsPtr& traceLevels) { - _traceLevels = traceLevels; + _traceLevels = traceLevels; } const TraceLevelsPtr& getTraceLevels() const { return _traceLevels; } @@ -62,66 +62,66 @@ protected: virtual ValuePtr getImpl(const Key& key) const { - typename ValueMap::iterator p = const_cast<ValueMap&>(_entries).end(); - if(_entriesHint != p) - { - if(_entriesHint->first == key) - { - p = _entriesHint; - } - } - - if(p == const_cast<ValueMap&>(_entries).end()) - { - p = const_cast<ValueMap&>(_entries).find(key); - } - - if(p != const_cast<ValueMap&>(_entries).end()) - { - const_cast<typename ValueMap::iterator&>(_entriesHint) = p; - return p->second; - } - else - { - return 0; - } + typename ValueMap::iterator p = const_cast<ValueMap&>(_entries).end(); + if(_entriesHint != p) + { + if(_entriesHint->first == key) + { + p = _entriesHint; + } + } + + if(p == const_cast<ValueMap&>(_entries).end()) + { + p = const_cast<ValueMap&>(_entries).find(key); + } + + if(p != const_cast<ValueMap&>(_entries).end()) + { + const_cast<typename ValueMap::iterator&>(_entriesHint) = p; + return p->second; + } + else + { + return 0; + } } virtual ValuePtr addImpl(const Key& key, const ValuePtr& entry) { - typename ValueMap::value_type v(key, entry); - _entriesHint = _entries.insert(_entriesHint, v); - return entry; + typename ValueMap::value_type v(key, entry); + _entriesHint = _entries.insert(_entriesHint, v); + return entry; } virtual void removeImpl(const Key& key) { - typename ValueMap::iterator p = _entries.end(); - if(_entriesHint != _entries.end()) - { - if(_entriesHint->first == key) - { - p = _entriesHint; - } - } - - if(p == _entries.end()) - { - p = _entries.find(key); - } - - assert(p != _entries.end()); - if(p->second->canRemove()) - { - _entries.erase(p); - _entriesHint = _entries.end(); - } - else - { - _entriesHint = p; - } + typename ValueMap::iterator p = _entries.end(); + if(_entriesHint != _entries.end()) + { + if(_entriesHint->first == key) + { + p = _entriesHint; + } + } + + if(p == _entries.end()) + { + p = _entries.find(key); + } + + assert(p != _entries.end()); + if(p->second->canRemove()) + { + _entries.erase(p); + _entriesHint = _entries.end(); + } + else + { + _entriesHint = p; + } } TraceLevelsPtr _traceLevels; @@ -139,8 +139,8 @@ public: virtual std::vector<std::string> getAll(const std::string& expr) { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); - return getMatchingKeys<std::map<std::string,TPtr> >(Cache<std::string, T>::_entries, expr); + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + return getMatchingKeys<std::map<std::string,TPtr> >(Cache<std::string, T>::_entries, expr); } }; |