ReactOS 0.4.15-dev-5672-gf73ac17
tinyxml2::MemPoolT< SIZE > Class Template Reference

#include <tinyxml2.h>

Inheritance diagram for tinyxml2::MemPoolT< SIZE >:
Collaboration diagram for tinyxml2::MemPoolT< SIZE >:

Classes

struct  Block
 
union  Chunk
 

Public Types

enum  { COUNT = (4*1024)/SIZE }
 

Public Member Functions

 MemPoolT ()
 
 ~MemPoolT ()
 
void Clear ()
 
virtual int ItemSize () const
 
int CurrentAllocs () const
 
virtual voidAlloc ()
 
virtual void Free (void *mem)
 
void Trace (const char *name)
 
void SetTracked ()
 
int Untracked () const
 
- Public Member Functions inherited from tinyxml2::MemPool
 MemPool ()
 
virtual ~MemPool ()
 
virtual int ItemSize () const =0
 
virtual voidAlloc ()=0
 
virtual void Free (void *)=0
 
virtual void SetTracked ()=0
 
virtual void Clear ()=0
 

Private Member Functions

 MemPoolT (const MemPoolT &)
 
void operator= (const MemPoolT &)
 

Private Attributes

DynArray< Block *, 10 > _blockPtrs
 
Chunk_root
 
int _currentAllocs
 
int _nAllocs
 
int _maxAllocs
 
int _nUntracked
 

Detailed Description

template<int SIZE>
class tinyxml2::MemPoolT< SIZE >

Definition at line 315 of file tinyxml2.h.

Member Enumeration Documentation

◆ anonymous enum

template<int SIZE>
anonymous enum
Enumerator
COUNT 

Definition at line 401 of file tinyxml2.h.

401{ COUNT = (4*1024)/SIZE }; // Some compilers do not accept to use COUNT in private part if COUNT is private

Constructor & Destructor Documentation

◆ MemPoolT() [1/2]

template<int SIZE>
tinyxml2::MemPoolT< SIZE >::MemPoolT ( )
inline

Definition at line 318 of file tinyxml2.h.

◆ ~MemPoolT()

template<int SIZE>
tinyxml2::MemPoolT< SIZE >::~MemPoolT ( )
inline

Definition at line 319 of file tinyxml2.h.

319 {
320 Clear();
321 }

◆ MemPoolT() [2/2]

template<int SIZE>
tinyxml2::MemPoolT< SIZE >::MemPoolT ( const MemPoolT< SIZE > &  )
private

Member Function Documentation

◆ Alloc()

template<int SIZE>
virtual void * tinyxml2::MemPoolT< SIZE >::Alloc ( )
inlinevirtual

Implements tinyxml2::MemPool.

Definition at line 343 of file tinyxml2.h.

343 {
344 if ( !_root ) {
345 // Need a new block.
346 Block* block = new Block();
347 _blockPtrs.Push( block );
348
349 for( int i=0; i<COUNT-1; ++i ) {
350 block->chunk[i].next = &block->chunk[i+1];
351 }
352 block->chunk[COUNT-1].next = 0;
353 _root = block->chunk;
354 }
355 void* result = _root;
356 _root = _root->next;
357
359 if ( _currentAllocs > _maxAllocs ) {
361 }
362 _nAllocs++;
363 _nUntracked++;
364 return result;
365 }
DynArray< Block *, 10 > _blockPtrs
Definition: tinyxml2.h:414
GLuint64EXT * result
Definition: glext.h:11304
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static unsigned int block
Definition: xmlmemory.c:101

◆ Clear()

template<int SIZE>
void tinyxml2::MemPoolT< SIZE >::Clear ( )
inlinevirtual

Implements tinyxml2::MemPool.

Definition at line 323 of file tinyxml2.h.

323 {
324 // Delete the blocks.
325 while( !_blockPtrs.Empty()) {
326 Block* b = _blockPtrs.Pop();
327 delete b;
328 }
329 _root = 0;
330 _currentAllocs = 0;
331 _nAllocs = 0;
332 _maxAllocs = 0;
333 _nUntracked = 0;
334 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define b
Definition: ke_i.h:79

Referenced by tinyxml2::MemPoolT< SIZE >::~MemPoolT().

◆ CurrentAllocs()

template<int SIZE>
int tinyxml2::MemPoolT< SIZE >::CurrentAllocs ( ) const
inline

Definition at line 339 of file tinyxml2.h.

339 {
340 return _currentAllocs;
341 }

◆ Free()

template<int SIZE>
virtual void tinyxml2::MemPoolT< SIZE >::Free ( void mem)
inlinevirtual

Implements tinyxml2::MemPool.

Definition at line 367 of file tinyxml2.h.

367 {
368 if ( !mem ) {
369 return;
370 }
372 Chunk* chunk = static_cast<Chunk*>( mem );
373#ifdef DEBUG
374 memset( chunk, 0xfe, sizeof(Chunk) );
375#endif
376 chunk->next = _root;
377 _root = chunk;
378 }
#define memset(x, y, z)
Definition: compat.h:39
Definition: mem.c:156

◆ ItemSize()

template<int SIZE>
virtual int tinyxml2::MemPoolT< SIZE >::ItemSize ( ) const
inlinevirtual

Implements tinyxml2::MemPool.

Definition at line 336 of file tinyxml2.h.

336 {
337 return SIZE;
338 }
#define SIZE
Definition: consume.c:5

◆ operator=()

template<int SIZE>
void tinyxml2::MemPoolT< SIZE >::operator= ( const MemPoolT< SIZE > &  )
private

◆ SetTracked()

template<int SIZE>
void tinyxml2::MemPoolT< SIZE >::SetTracked ( )
inlinevirtual

Implements tinyxml2::MemPool.

Definition at line 384 of file tinyxml2.h.

384 {
385 _nUntracked--;
386 }

◆ Trace()

template<int SIZE>
void tinyxml2::MemPoolT< SIZE >::Trace ( const char name)
inline

Definition at line 379 of file tinyxml2.h.

379 {
380 printf( "Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n",
382 }
#define printf
Definition: freeldr.h:94
Definition: name.c:39

◆ Untracked()

template<int SIZE>
int tinyxml2::MemPoolT< SIZE >::Untracked ( ) const
inline

Definition at line 388 of file tinyxml2.h.

388 {
389 return _nUntracked;
390 }

Member Data Documentation

◆ _blockPtrs

template<int SIZE>
DynArray< Block*, 10 > tinyxml2::MemPoolT< SIZE >::_blockPtrs
private

◆ _currentAllocs

◆ _maxAllocs

◆ _nAllocs

◆ _nUntracked

◆ _root

template<int SIZE>
Chunk* tinyxml2::MemPoolT< SIZE >::_root
private

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