![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cTempPool.h>
Public Member Functions | |
cTempPool () | |
virtual | ~cTempPool () |
void | CleanTemps () |
void * | GetTempV (size_t nLenNeed) |
void * | GetTempV (size_t nLenNeed, const void *pData) |
template<typename TYPE > | |
TYPE * | GetTempT (StrLen_t nLenNeed) |
template<typename TYPE > | |
TYPE * | GetTempT (StrLen_t nLenNeed, const TYPE *pData) |
Static Public Member Functions | |
static cTempPool *__stdcall | GetTempPool () |
static void __stdcall | FreeTempsForThreadManually () |
static void *__stdcall | GetTempSV (size_t nLenNeed, const void *pData) |
template<typename TYPE > | |
static TYPE *__stdcall | GetTempST (StrLen_t nLenNeed) |
template<typename TYPE > | |
static TYPE *__stdcall | GetTempST (StrLen_t nLenNeed, const TYPE *pData) |
Public Attributes | |
int | m_iCountCur |
rotate this count to re-use buffers in m_aBlocks. More... | |
cArrayStruct< cHeapBlock > | m_aBlocks |
Temporary blocks to be used on a single thread. More... | |
Static Public Attributes | |
static const int | k_iCountMax = 16 |
Assume nested functions won't use more than m_aBlocks in a single thread. (e.g. This is the max number of args on a single sprintf) More... | |
static IThreadLocal * | sm_pThreadLocal = &cTempPool::sm_ThreadLocalDefault |
Allow this to be overloaded with a version that destructs on thread close. More... | |
static cThreadLocalSysNew< cTempPool > | sm_ThreadLocalDefault |
A set of thread safe temporary strings/spaces for function arguments and Unicode/UTF8 conversions. Used by StrArg<>. Pool of re-used strings/spaces after k_iCountMax uses. use a new set for each thread. Thread Local/Safe.
|
inline |
|
inlinevirtual |
void Gray::cTempPool::CleanTemps | ( | ) |
reset contents for this pool. release element allocated memory. keep array.
|
static |
Get thread local cTempPool. create it if its not already allocated.
|
inlinestatic |
Get thread local temp space.
|
inlinestatic |
Get thread local temp space.
|
inlinestatic |
Get thread local temp space.
|
inline |
void * Gray::cTempPool::GetTempV | ( | size_t | nLenNeed | ) |
Get a temporary/scratch memory space for random uses. Non leaking pointer return. beware of k_iCountMax. Ideally we use should CString(x).get_CPtr() instead. Typically used to hold "%s" argument conversions for StrT::sprintfN() type operations.
void * Gray::cTempPool::GetTempV | ( | size_t | nLenNeed, |
const void * | pData | ||
) |
|
static |
Assume nested functions won't use more than m_aBlocks in a single thread. (e.g. This is the max number of args on a single sprintf)
cArrayStruct<cHeapBlock> Gray::cTempPool::m_aBlocks |
Temporary blocks to be used on a single thread.
int Gray::cTempPool::m_iCountCur |
rotate this count to re-use buffers in m_aBlocks.
|
static |
Allow this to be overloaded with a version that destructs on thread close.
|
static |