AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
RefMgr< TO, FROM > Class Template Reference

#include "RefMgr.h"

Inheritance diagram for RefMgr< TO, FROM >:
LinkedListHead GridRefMgr< Corpse > GridRefMgr< Creature > GridRefMgr< DynamicObject > GridRefMgr< GameObject > GridRefMgr< NGridType > GridRefMgr< Player > GridRefMgr< T > GridRefMgr< H > GridRefMgr< GRID_OBJECT_TYPES > GridRefMgr< WORLD_OBJECT_TYPES > GridRefMgr< NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES > > GridRefMgr< OBJECT_TYPES >

Public Types

typedef LinkedListHead::Iterator< Reference< TO, FROM > > iterator
 
- Public Types inherited from LinkedListHead
typedef Iterator< LinkedListElementiterator
 

Public Member Functions

 RefMgr ()=default
 
virtual ~RefMgr ()
 
Reference< TO, FROM > * getFirst ()
 
Reference< TO, FROM > const * getFirst () const
 
Reference< TO, FROM > * getLast ()
 
Reference< TO, FROM > const * getLast () const
 
iterator begin ()
 
iterator end ()
 
iterator rbegin ()
 
iterator rend ()
 
void clearReferences ()
 
- Public Member Functions inherited from LinkedListHead
 LinkedListHead ()
 
bool IsEmpty () const
 
LinkedListElementgetFirst ()
 
LinkedListElement const * getFirst () const
 
LinkedListElementgetLast ()
 
LinkedListElement const * getLast () const
 
void insertFirst (LinkedListElement *pElem)
 
void insertLast (LinkedListElement *pElem)
 
uint32 getSize () const
 
void incSize ()
 
void decSize ()
 

Detailed Description

template<class TO, class FROM>
class RefMgr< TO, FROM >

Member Typedef Documentation

◆ iterator

template<class TO , class FROM >
typedef LinkedListHead::Iterator< Reference<TO, FROM> > RefMgr< TO, FROM >::iterator

Constructor & Destructor Documentation

◆ RefMgr()

template<class TO , class FROM >
RefMgr< TO, FROM >::RefMgr ( )
default

◆ ~RefMgr()

template<class TO , class FROM >
virtual RefMgr< TO, FROM >::~RefMgr ( )
inlinevirtual
30{ clearReferences(); }
void clearReferences()
Definition: RefMgr.h:42

References RefMgr< TO, FROM >::clearReferences().

Member Function Documentation

◆ begin()

template<class TO , class FROM >
iterator RefMgr< TO, FROM >::begin ( )
inline
37{ return iterator(getFirst()); }
LinkedListHead::Iterator< Reference< TO, FROM > > iterator
Definition: RefMgr.h:28
Reference< TO, FROM > * getFirst()
Definition: RefMgr.h:32

References RefMgr< TO, FROM >::getFirst().

◆ clearReferences()

template<class TO , class FROM >
void RefMgr< TO, FROM >::clearReferences ( )
inline
43 {
45 while ((ref = getFirst()) != nullptr)
46 {
47 ((Reference<TO, FROM>*) ref)->invalidate();
48 ref->delink(); // the delink might be already done by invalidate(), but doing it here again does not hurt and insures an empty list
49 }
50 }
Definition: LinkedList.h:28
void delink()
Definition: LinkedList.h:52
Definition: Reference.h:27

References LinkedListElement::delink(), and RefMgr< TO, FROM >::getFirst().

Referenced by Loot::clear(), and RefMgr< TO, FROM >::~RefMgr().

◆ end()

template<class TO , class FROM >
iterator RefMgr< TO, FROM >::end ( )
inline
38{ return iterator(nullptr); }

◆ getFirst() [1/2]

template<class TO , class FROM >
Reference< TO, FROM > * RefMgr< TO, FROM >::getFirst ( )
inline

◆ getFirst() [2/2]

template<class TO , class FROM >
Reference< TO, FROM > const * RefMgr< TO, FROM >::getFirst ( ) const
inline

◆ getLast() [1/2]

template<class TO , class FROM >
Reference< TO, FROM > * RefMgr< TO, FROM >::getLast ( )
inline
LinkedListElement * getLast()
Definition: LinkedList.h:102

References LinkedListHead::getLast().

Referenced by LootValidatorRefMgr::getLast(), MapRefMgr::getLast(), and RefMgr< TO, FROM >::rbegin().

◆ getLast() [2/2]

template<class TO , class FROM >
Reference< TO, FROM > const * RefMgr< TO, FROM >::getLast ( ) const
inline

◆ rbegin()

template<class TO , class FROM >
iterator RefMgr< TO, FROM >::rbegin ( )
inline
39{ return iterator(getLast()); }
Reference< TO, FROM > * getLast()
Definition: RefMgr.h:34

References RefMgr< TO, FROM >::getLast().

◆ rend()

template<class TO , class FROM >
iterator RefMgr< TO, FROM >::rend ( )
inline
40{ return iterator(nullptr); }