Public Member Functions

SparseClassAllocator< C > Class Template Reference

Allocator for space class, a class with a lot of uninitialized space/members. More...

#include <Allocator.h>

Inherits ClassAllocator< C >.

Collaboration diagram for SparseClassAllocator< C >:
Collaboration graph
[legend]

Public Member Functions

C * alloc ()
 Allocates objects of the templated type.
 SparseClassAllocator (const char *name, unsigned int chunk_size=128, unsigned int alignment=16, void(*instantiate_func)(C *proto, C *instance)=NULL)
 Create a new class specific SparseClassAllocator.

Detailed Description

template<class C>
class SparseClassAllocator< C >

Allocator for space class, a class with a lot of uninitialized space/members.

It uses an instantiate fucntion do initialization of objects. This is particulary useful if most of the space in the objects does not need to be intialized. The inifunction passed can be used to intialize a few fields selectively. Using ClassAllocator for space objects would unnecessarily initialized all of the members.

Definition at line 186 of file Allocator.h.


Constructor & Destructor Documentation

template<class C>
SparseClassAllocator< C >::SparseClassAllocator ( const char *  name,
unsigned int  chunk_size = 128,
unsigned int  alignment = 16,
void(*)(C *proto, C *instance)  instantiate_func = NULL 
) [inline]

Create a new class specific SparseClassAllocator.

Parameters:
name some identifying name, used for mem tracking purposes.
chunk_size number of units to be allocated if free pool is empty.
alignment of objects must be a power of 2.
instantiate_func 

Definition at line 212 of file Allocator.h.


Member Function Documentation

template<class C>
C* SparseClassAllocator< C >::alloc (  )  [inline]

Allocates objects of the templated type.

Reimplemented from ClassAllocator< C >.

Definition at line 191 of file Allocator.h.

References Allocator::fl, ink_freelist_new(), memcpy, and ClassAllocator< C >::proto.

Referenced by HttpSM::allocate().


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