OregonCore  revision be9e804-git
Your Favourite TBC server
HashMapHolder< T > Class Template Reference

#include <ObjectAccessor.h>

Public Types

typedef UNORDERED_MAP< uint64, T * > MapType
 
typedef ACE_Thread_Mutex LockType
 
typedef Oregon::GeneralLock< LockTypeGuard
 

Static Public Member Functions

static void Insert (T *o)
 
static void Remove (T *o)
 
static T * Find (uint64 guid)
 
static MapTypeGetContainer ()
 
static LockTypeGetLock ()
 

Private Member Functions

 HashMapHolder ()
 

Static Private Attributes

static LockType i_lock
 
static MapType m_objectMap
 

Detailed Description

template<class T>
class HashMapHolder< T >

Definition at line 45 of file ObjectAccessor.h.

Member Typedef Documentation

template<class T>
typedef Oregon::GeneralLock<LockType > HashMapHolder< T >::Guard

Definition at line 51 of file ObjectAccessor.h.

template<class T>
typedef ACE_Thread_Mutex HashMapHolder< T >::LockType

Definition at line 50 of file ObjectAccessor.h.

template<class T>
typedef UNORDERED_MAP<uint64, T*> HashMapHolder< T >::MapType

Definition at line 49 of file ObjectAccessor.h.

Constructor & Destructor Documentation

template<class T>
HashMapHolder< T >::HashMapHolder ( )
inlineprivate

Definition at line 84 of file ObjectAccessor.h.

84 {}

Member Function Documentation

template<class T>
static LockType* HashMapHolder< T >::GetLock ( )
inlinestatic

Definition at line 77 of file ObjectAccessor.h.

References HashMapHolder< T >::i_lock.

78  {
79  return &i_lock;
80  }
static LockType i_lock
template<class T>
static void HashMapHolder< T >::Insert ( T *  o)
inlinestatic

Definition at line 53 of file ObjectAccessor.h.

References HashMapHolder< T >::i_lock, and HashMapHolder< T >::m_objectMap.

Referenced by ObjectAccessor::AddObject().

54  {
55  Guard guard(i_lock);
56  m_objectMap[o->GetGUID()] = o;
57  }
static LockType i_lock
static MapType m_objectMap
Oregon::GeneralLock< LockType > Guard
template<class T>
static void HashMapHolder< T >::Remove ( T *  o)
inlinestatic

Definition at line 59 of file ObjectAccessor.h.

References HashMapHolder< T >::i_lock, and HashMapHolder< T >::m_objectMap.

Referenced by ObjectAccessor::RemoveObject().

60  {
61  Guard guard(i_lock);
62  m_objectMap.erase(o->GetGUID());
63  }
static LockType i_lock
static MapType m_objectMap
Oregon::GeneralLock< LockType > Guard

Member Data Documentation

template<class T>
ACE_Thread_Mutex HashMapHolder< T >::i_lock
staticprivate
template<class T>
UNORDERED_MAP< uint64, T * > HashMapHolder< T >::m_objectMap
staticprivate

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