NLMISC::CFixedSizeAllocator::CNode Class Reference


Public Member Functions

void link ()
void * unlink ()

Data Fields

CChunkChunk
CNodeNext
CNode ** Prev

Member Function Documentation

void NLMISC::CFixedSizeAllocator::CNode::link  ) 
 

Definition at line 189 of file fixed_size_allocator.cpp.

References NLMISC::CFixedSizeAllocator::_FreeSpace, NLMISC::CFixedSizeAllocator::CChunk::add(), NLMISC::CFixedSizeAllocator::CChunk::Allocator, Chunk, nlassert, and Prev.

Referenced by NLMISC::CFixedSizeAllocator::free().

00190 {
00191         // destroy the obj to get back uninitialized memory     
00192         nlassert(Chunk);
00193         nlassert(Chunk->Allocator);
00194         
00195         CNode *&head = Chunk->Allocator->_FreeSpace;
00196         Next = head;
00197         Prev = &head;
00198         if (Next)
00199         {
00200                 Next->Prev = &Next;
00201         }
00202         Chunk->Allocator->_FreeSpace = this;
00203         Chunk->add();
00204 }

void * NLMISC::CFixedSizeAllocator::CNode::unlink  ) 
 

Definition at line 178 of file fixed_size_allocator.cpp.

References Chunk, NLMISC::CFixedSizeAllocator::CChunk::grab(), nlassert, NLMISC::CFixedSizeAllocator::CChunk::NumFreeObjs, and Prev.

Referenced by NLMISC::CFixedSizeAllocator::alloc(), and NLMISC::CFixedSizeAllocator::CChunk::~CChunk().

00179 {                       
00180         nlassert(Prev != NULL);
00181         if (Next) { Next->Prev = Prev;}
00182         *Prev = Next;
00183         nlassert(Chunk->NumFreeObjs > 0);
00184         Chunk->grab(); // tells the containing chunk that a node has been allocated
00185         return (void *) &Next;
00186 }


Field Documentation

CChunk* NLMISC::CFixedSizeAllocator::CNode::Chunk
 

Definition at line 68 of file fixed_size_allocator.h.

Referenced by NLMISC::CFixedSizeAllocator::free(), NLMISC::CFixedSizeAllocator::CChunk::init(), link(), unlink(), and NLMISC::CFixedSizeAllocator::~CFixedSizeAllocator().

CNode* NLMISC::CFixedSizeAllocator::CNode::Next
 

Definition at line 70 of file fixed_size_allocator.h.

Referenced by NLMISC::CFixedSizeAllocator::CChunk::init().

CNode** NLMISC::CFixedSizeAllocator::CNode::Prev
 

Definition at line 71 of file fixed_size_allocator.h.

Referenced by NLMISC::CFixedSizeAllocator::CChunk::init(), link(), and unlink().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 13:13:24 2004 for NeL by doxygen 1.3.6