Manager Class Template Reference

Inheritance diagram for Manager:

NonCopyable List of all members.

Detailed Description

template<size_t A, size_t G, size_t PS = 1024, size_t CS = details::DEFAULT_CHUNK_SIZE>
class omni::pool::Manager< A, G, PS, CS >

The pool manager.

The Manager class contains and manages several pool objects. The number of managed pool objects is equal to POOL_SIZE.

The granularity argument is the difference between block sizes of the two adjacent pool objects. For example, if granularity is 2, then pools are 2, 4, 6, 8, ... bytes. If granularity is 4, then pools are 4, 8, 12, 16, ... bytes.

Parameters:
A Alignment of pointers. Should be integer power of two.
G Granularity of memory block sizes. Recommended 4 or 16.
PS Total number of managed pool objects.
CS Approximate chunk size in bytes.
See also:
Fast memory management.

Public Types

Public Member Functions


Member Typedef Documentation

typedef ObjPool<ALIGNMENT> pool_type

The pool type.

typedef pool_type::size_type size_type

Size type.

typedef pool_type::pointer pointer

Pointer type.


Member Enumeration Documentation

anonymous enum

Constants.

Enumerator:
MAX_SIZE  Maximum available block size.
GRANULARITY  Block size granularity.
CHUNK_SIZE  Approximate chunk size.
POOL_SIZE  Total number of pools.
ALIGNMENT  Alignment of pointers.


Constructor & Destructor Documentation

Manager (  )  [inline]

Construction.

The constructor initializes all managed pools.

~Manager (  )  [inline]

Destruction.

The destructor destroys all managed pools.


Member Function Documentation

pointer get ( size_type  obj_size  )  [inline]

Get the memory block.

This method gets the memory block from the corresponding managed pool object.

The memory block size obj_size should be less than or equal to MAX_SIZE.

Parameters:
[in] obj_size The memory block size in bytes.
Returns:
The memory block.
See also:
ObjPool::get()

void put ( pointer  obj,
size_type  obj_size 
) [inline]

Put the memory block.

This method puts the memory block obj back into the corresponding managed pool object.

The memory block size obj_size should be less than or equal to MAX_SIZE.

Parameters:
[in] obj The memory block.
[in] obj_size The memory block size in bytes.
See also:
ObjPool::put()


Generated on Wed Jun 6 17:27:47 2007 for OMNI by  doxygen 1.5.2