Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayKernel::CKePool< TYPE, _OFFSET_ENTRY > Struct Template Reference

#include <cKernel.h>

Public Member Functions

void InitPool ()
 
bool IsFreeListEmpty () const
 
bool IsUsedListEmpty () const
 
int get_FreeCount ()
 
int get_UsedCount ()
 
void AddFreeObjZ (TYPE *pObj)
 
void DestroyFreeList ()
 
void DestroyUsedList ()
 

Static Public Member Functions

static TYPEGetCast (PLIST_ENTRY pObj)
 
static PLIST_ENTRY GetCast (TYPE *pObj)
 

Protected Member Functions

void AddFreeObj (TYPE *pObj)
 
void AddUsedObj (TYPE *pObj)
 
TYPERemoveFreeObj ()
 
bool IsUsedLast (TYPE *pObj) const
 
TYPEget_UsedFirst () const
 
TYPEGetNext (TYPE *pObj) const
 

Protected Attributes

CKeListT< TYPE, _OFFSET_ENTRY > m_FreeList
 
CKeListT< TYPE, _OFFSET_ENTRY > m_UsedList
 
CKeSpinLock m_SpinLock
 

Detailed Description

template<class TYPE, int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
struct GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >

2 x Circular (spin locked) double linked list. forming a pool of re-usable objects.

Member Function Documentation

◆ AddFreeObj()

template<class TYPE , int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
void GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >::AddFreeObj ( TYPE pObj)
inlineprotected

◆ AddFreeObjZ()

template<class TYPE , int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
void GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >::AddFreeObjZ ( TYPE pObj)
inline

pObj was allocated but never used!

◆ AddUsedObj()

template<class TYPE , int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
void GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >::AddUsedObj ( TYPE pObj)
inlineprotected

◆ DestroyFreeList()

template<class TYPE , int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
void GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >::DestroyFreeList ( )
inline

◆ DestroyUsedList()

template<class TYPE , int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
void GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >::DestroyUsedList ( )
inline

◆ get_FreeCount()

template<class TYPE , int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
int GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >::get_FreeCount ( )
inline

◆ get_UsedCount()

template<class TYPE , int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
int GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >::get_UsedCount ( )
inline

◆ get_UsedFirst()

template<class TYPE , int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
TYPE* GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >::get_UsedFirst ( ) const
inlineprotected

ASSUME m_SpinLock is already locked.

◆ GetCast() [1/2]

template<class TYPE , int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
static TYPE* GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >::GetCast ( PLIST_ENTRY  pObj)
inlinestatic

Acts like CONTAINING_RECORD() and offsetof()

◆ GetCast() [2/2]

template<class TYPE , int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
static PLIST_ENTRY GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >::GetCast ( TYPE pObj)
inlinestatic

Acts like CONTAINING_RECORD() and offsetof()

◆ GetNext()

template<class TYPE , int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
TYPE* GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >::GetNext ( TYPE pObj) const
inlineprotected

ASSUME m_SpinLock is already locked.

◆ InitPool()

template<class TYPE , int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
void GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >::InitPool ( )
inline

◆ IsFreeListEmpty()

template<class TYPE , int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
bool GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >::IsFreeListEmpty ( ) const
inline

◆ IsUsedLast()

template<class TYPE , int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
bool GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >::IsUsedLast ( TYPE pObj) const
inlineprotected

ASSUME m_SpinLock is already locked.

◆ IsUsedListEmpty()

template<class TYPE , int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
bool GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >::IsUsedListEmpty ( ) const
inline

◆ RemoveFreeObj()

template<class TYPE , int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
TYPE* GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >::RemoveFreeObj ( )
inlineprotected

Member Data Documentation

◆ m_FreeList

template<class TYPE , int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
CKeListT<TYPE, _OFFSET_ENTRY> GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >::m_FreeList
protected

◆ m_SpinLock

template<class TYPE , int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
CKeSpinLock GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >::m_SpinLock
protected

◆ m_UsedList

template<class TYPE , int _OFFSET_ENTRY = offsetof(TYPE, m_ListEntry)>
CKeListT<TYPE, _OFFSET_ENTRY> GrayKernel::CKePool< TYPE, _OFFSET_ENTRY >::m_UsedList
protected

The documentation for this struct was generated from the following file: