Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ClassCache< Typ, Key > Class Template Reference

#include <unit_const_cache.h>

Static Public Member Functions

static const Typ * getCachedConst (Key k)
 
static Typ * getCachedMutable (const Key &k)
 
static Typ * setCachedMutable (const Key &k, Typ *un)
 
static const Typ * setCachedConst (const Key &k, Typ *un)
 
static void purgeCache (void(*Kill)(Typ *un))
 

Detailed Description

template<class Typ, class Key>
class ClassCache< Typ, Key >

Definition at line 51 of file unit_const_cache.h.

Member Function Documentation

template<class Typ , class Key >
static const Typ* ClassCache< Typ, Key >::getCachedConst ( Key  k)
inlinestatic
template<class Typ , class Key >
static Typ* ClassCache< Typ, Key >::getCachedMutable ( const Key &  k)
inlinestatic

Definition at line 63 of file unit_const_cache.h.

References i.

Referenced by ClassCache< Typ, Key >::getCachedConst(), and getTemplate().

64  {
65 #if !defined (_WIN32) && __GNUC__ != 2
66  typename vsUMap< Key, Typ*, ConstHasher >::iterator i = unit_cache.find( k );
67 #else
68  typename vsUMap< Key, Typ* >::iterator i = unit_cache.find( k );
69 #endif
70  if ( i != unit_cache.end() )
71  return (*i).second;
72  return NULL;
73  }
template<class Typ , class Key >
static void ClassCache< Typ, Key >::purgeCache ( void(*)(Typ *un)  Kill)
inlinestatic

Definition at line 83 of file unit_const_cache.h.

References i.

84  {
85  typename vsUMap< Key, Typ*, ConstHasher >::iterator i = unit_cache.begin();
86  for (; i != unit_cache.end(); ++i)
87  (*Kill)( (*i).second );
88  unit_cache.clear();
89  }
template<class Typ , class Key >
static const Typ* ClassCache< Typ, Key >::setCachedConst ( const Key &  k,
Typ *  un 
)
inlinestatic
template<class Typ , class Key >
static Typ* ClassCache< Typ, Key >::setCachedMutable ( const Key &  k,
Typ *  un 
)
inlinestatic

Definition at line 74 of file unit_const_cache.h.

Referenced by getTemplate(), and ClassCache< Typ, Key >::setCachedConst().

75  {
76  unit_cache.insert( std::pair< Key, Typ* > ( k, un ) );
77  return un;
78  }

The documentation for this class was generated from the following files: