Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

EStringPool Class Reference

#include <EStringPool.h>

List of all members.


Detailed Description

A memory pool for string data.

You may allocate a chunk of memory using the alloc() method; this memory is guaranteed to be reserved until the EStringPool is destroyed or the next time reset() is called.

Chunks are guaranteed to be aligned suitably for any kind of variable (currently hardcoded to 8 bytes).


Public Member Functions

 EStringPool (unsigned int initial_size=DEFAULT_INITIAL_SIZE)
 Constructs a pool with the specified initial size.
 ~EStringPool ()
 Destroys the pool, invalidating any allocated buffers.
void reset ()
 Invalidates any allocated buffers.
char * alloc (unsigned int size)
 Allocates a chunk of memory.

Static Public Attributes

const unsigned int DEFAULT_INITIAL_SIZE = 10240
 The default initial size of a string pool.


Constructor & Destructor Documentation

EStringPool::EStringPool unsigned int  initial_size = DEFAULT_INITIAL_SIZE  ) 
 

Constructs a pool with the specified initial size.

The pool will double in size as necessary to accomodate allocation requests.

EStringPool::~EStringPool  ) 
 

Destroys the pool, invalidating any allocated buffers.


Member Function Documentation

char* EStringPool::alloc unsigned int  size  ) 
 

Allocates a chunk of memory.

Chunks are guaranteed to be aligned suitably for any kind of variable (currently hardcoded to 8 bytes). The chunk is valid only until the next reset() call or the destruction of the EStringPool object.

void EStringPool::reset  ) 
 

Invalidates any allocated buffers.


Member Data Documentation

const unsigned int EStringPool::DEFAULT_INITIAL_SIZE = 10240 [static]
 

The default initial size of a string pool.


The documentation for this class was generated from the following file:
Generated on Fri Nov 12 15:15:23 2004 for Borealis by doxygen 1.3.8