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
SharedPool< T, RefcounterTraits > Class Template Reference

#include <SharedPool.h>

Classes

class  Reference
 

Public Types

typedef vsUMap< T, unsigned intReferenceCounter
 
typedef SharedPool< T,
RefcounterTraits > 
PoolType
 
typedef T ValueType
 
typedef RefcounterTraits RefocounterTraitsType
 

Public Member Functions

 SharedPool ()
 
 ~SharedPool ()
 
Reference get (const T &s)
 
Reference get ()
 

Static Public Member Functions

static PoolTypegetSingleton ()
 
static PoolTypegetSingletonPtr ()
 

Friends

class PoolType::Reference
 

Detailed Description

template<class T, class RefcounterTraits = vsHashComp< T >>
class SharedPool< T, RefcounterTraits >

Definition at line 13 of file SharedPool.h.

Member Typedef Documentation

template<class T, class RefcounterTraits = vsHashComp< T >>
typedef SharedPool< T, RefcounterTraits > SharedPool< T, RefcounterTraits >::PoolType

Definition at line 17 of file SharedPool.h.

template<class T, class RefcounterTraits = vsHashComp< T >>
typedef vsUMap< T, unsigned int > SharedPool< T, RefcounterTraits >::ReferenceCounter

Definition at line 16 of file SharedPool.h.

template<class T, class RefcounterTraits = vsHashComp< T >>
typedef RefcounterTraits SharedPool< T, RefcounterTraits >::RefocounterTraitsType

Definition at line 25 of file SharedPool.h.

template<class T, class RefcounterTraits = vsHashComp< T >>
typedef T SharedPool< T, RefcounterTraits >::ValueType

Definition at line 24 of file SharedPool.h.

Constructor & Destructor Documentation

template<typename T , typename RT >
SharedPool< T, RT >::SharedPool ( )

Definition at line 7 of file SharedPool.cpp.

9  : referenceCounter(
10 #if defined (_WIN32) || __GNUC__ != 2
11  RT::min_buckets
12 #endif
13  )
14 #endif
15 {
16  if (ms_singleton == 0)
17  ms_singleton = this;
18 }
template<typename T , typename RT >
SharedPool< T, RT >::~SharedPool ( )

Definition at line 20 of file SharedPool.cpp.

21 {
22  if (ms_singleton == this)
23  ms_singleton = 0;
24 }

Member Function Documentation

template<class T, class RefcounterTraits = vsHashComp< T >>
Reference SharedPool< T, RefcounterTraits >::get ( const T &  s)
inline

Definition at line 172 of file SharedPool.h.

173  {
174  return Reference( &referenceCounter, s );
175  }
template<class T, class RefcounterTraits = vsHashComp< T >>
Reference SharedPool< T, RefcounterTraits >::get ( )
inline

Definition at line 177 of file SharedPool.h.

178  {
179  return Reference( &referenceCounter );
180  }
template<class T, class RefcounterTraits = vsHashComp< T >>
static PoolType& SharedPool< T, RefcounterTraits >::getSingleton ( )
inlinestatic

Definition at line 27 of file SharedPool.h.

28  {
29  return *ms_singleton;
30  }
template<class T, class RefcounterTraits = vsHashComp< T >>
static PoolType* SharedPool< T, RefcounterTraits >::getSingletonPtr ( )
inlinestatic

Definition at line 32 of file SharedPool.h.

33  {
34  return ms_singleton;
35  }

Friends And Related Function Documentation

template<class T, class RefcounterTraits = vsHashComp< T >>
friend class PoolType::Reference
friend

Definition at line 181 of file SharedPool.h.


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