CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Types | Protected Attributes | Private Member Functions
LayerHitMapCache::SimpleCache< KeyType, ValueType > Class Template Reference

Public Member Functions

void add (const KeyType &key, const ValueType *value)
 add object to cache. It is caller responsibility to check that object is not yet there. More...
 
virtual void clear ()
 emptify cache, delete values associated to Key More...
 
const ValueType * get (const KeyType &key)
 
void reserve (int size)
 
 SimpleCache (int initSize)
 
virtual ~SimpleCache ()
 

Protected Types

typedef std::vector
< KeyValuePair >
::const_iterator 
ConstItr
 
typedef std::pair< KeyType,
const ValueType * > 
KeyValuePair
 

Protected Attributes

std::vector< KeyValuePairtheContainer
 

Private Member Functions

 SimpleCache (const SimpleCache &)
 

Detailed Description

template<class KeyType, class ValueType>
class LayerHitMapCache::SimpleCache< KeyType, ValueType >

Definition at line 18 of file LayerHitMapCache.h.

Member Typedef Documentation

template<class KeyType , class ValueType >
typedef std::vector< KeyValuePair >::const_iterator LayerHitMapCache::SimpleCache< KeyType, ValueType >::ConstItr
protected

Definition at line 41 of file LayerHitMapCache.h.

template<class KeyType , class ValueType >
typedef std::pair< KeyType, const ValueType * > LayerHitMapCache::SimpleCache< KeyType, ValueType >::KeyValuePair
protected

Definition at line 39 of file LayerHitMapCache.h.

Constructor & Destructor Documentation

template<class KeyType , class ValueType >
LayerHitMapCache::SimpleCache< KeyType, ValueType >::SimpleCache ( int  initSize)
inline

Definition at line 20 of file LayerHitMapCache.h.

References LayerHitMapCache::SimpleCache< KeyType, ValueType >::reserve().

20 { reserve(initSize); }
template<class KeyType , class ValueType >
virtual LayerHitMapCache::SimpleCache< KeyType, ValueType >::~SimpleCache ( )
inlinevirtual

Definition at line 21 of file LayerHitMapCache.h.

References LayerHitMapCache::SimpleCache< KeyType, ValueType >::clear().

21 { clear(); }
virtual void clear()
emptify cache, delete values associated to Key
template<class KeyType , class ValueType >
LayerHitMapCache::SimpleCache< KeyType, ValueType >::SimpleCache ( const SimpleCache< KeyType, ValueType > &  )
inlineprivate

Definition at line 43 of file LayerHitMapCache.h.

43 { }

Member Function Documentation

template<class KeyType , class ValueType >
void LayerHitMapCache::SimpleCache< KeyType, ValueType >::add ( const KeyType &  key,
const ValueType *  value 
)
inline

add object to cache. It is caller responsibility to check that object is not yet there.

Definition at line 30 of file LayerHitMapCache.h.

References LayerHitMapCache::SimpleCache< KeyType, ValueType >::theContainer.

Referenced by LayerHitMapCache::operator()().

30  {
31  theContainer.push_back( std::make_pair(key,value));
32  }
std::vector< KeyValuePair > theContainer
list key
Definition: combine.py:13
template<class KeyType , class ValueType >
virtual void LayerHitMapCache::SimpleCache< KeyType, ValueType >::clear ( void  )
inlinevirtual

emptify cache, delete values associated to Key

Definition at line 34 of file LayerHitMapCache.h.

References i, and LayerHitMapCache::SimpleCache< KeyType, ValueType >::theContainer.

Referenced by LayerHitMapCache::clear(), and LayerHitMapCache::SimpleCache< KeyType, ValueType >::~SimpleCache().

34  {
35  for (ConstItr i=theContainer.begin(); i!= theContainer.end(); i++) { delete i->second; }
36  theContainer.clear();
37  }
int i
Definition: DBlmapReader.cc:9
std::vector< KeyValuePair > theContainer
std::vector< KeyValuePair >::const_iterator ConstItr
template<class KeyType , class ValueType >
const ValueType* LayerHitMapCache::SimpleCache< KeyType, ValueType >::get ( const KeyType &  key)
inline
template<class KeyType , class ValueType >
void LayerHitMapCache::SimpleCache< KeyType, ValueType >::reserve ( int  size)
inline

Member Data Documentation

template<class KeyType , class ValueType >
std::vector< KeyValuePair > LayerHitMapCache::SimpleCache< KeyType, ValueType >::theContainer
protected