21 #ifndef CACHEMANAGER_H
22 #define CACHEMANAGER_H
53 template<
class K,
class V >
83 void Add(
const K& key, V value )
85 ( void )m_Cache.insert( pair< K, V >( key, value ) );
98 unsigned int size()
const
100 return m_Cache.size();
103 bool Contains(
const K& key )
105 typename map< K, V >::const_iterator cacheFinder = m_Cache.find( key );
106 typename map< K, V >::const_iterator cacheEnd = m_Cache.end();
107 bool retValue = ( cacheFinder != cacheEnd );
116 const V& operator[](
const K& key )
const
118 typename map< K, V >::const_iterator cacheFinder = m_Cache.find( key );
119 typename map< K, V >::const_iterator cacheEnd = m_Cache.end();
120 if( cacheFinder != cacheEnd )
121 return cacheFinder->second;
123 stringstream errorMessage;
124 errorMessage <<
"Value not found in cache [" << key <<
"]";
125 throw logic_error( errorMessage.str() );
130 #endif //CACHEMANAGER_H