ACE_Cached_Mem_Pool_Node< T > Class Template Reference

ACE_Cached_Mem_Pool_Node keeps unused memory within a free list. More...

#include <Malloc_T.h>

List of all members.

Public Member Functions

T * addr (void)
 Return the address of free memory.

T > * 
get_next (void)
 Get the next ACE_Cached_Mem_Pool_Node in a list.

void set_next (ACE_Cached_Mem_Pool_Node< T > *ptr)
 Set the next ACE_Cached_Mem_Pool_Node.

Private Attributes

T > * 

Detailed Description

template<class T>
class ACE_Cached_Mem_Pool_Node< T >

ACE_Cached_Mem_Pool_Node keeps unused memory within a free list.

The length of a piece of unused memory must be greater than sizeof (void*). This makes sense because we'll waste even more memory if we keep them in a separate data structure. This class should really be placed within the ACE_Cached_Allocator class but this can't be done due to C++ compiler portability problems.

Definition at line 44 of file Malloc_T.h.

Member Function Documentation

template<class T>

Return the address of free memory.

Definition at line 10 of file Malloc_T.inl.

00011 {
00012   // This should be done using a single reinterpret_cast, but Sun/CC
00013   // (4.2) gets awfully confused when T is a char[20] (and maybe other
00014   // types).
00015   return static_cast<T *> (static_cast <void *> (this));
00016 }

template<class T>
ACE_INLINE ACE_Cached_Mem_Pool_Node< T > * ACE_Cached_Mem_Pool_Node< T >::get_next void   ) 

Get the next ACE_Cached_Mem_Pool_Node in a list.

Definition at line 19 of file Malloc_T.inl.

00020 {
00021   return this->next_;
00022 }

template<class T>
ACE_INLINE void ACE_Cached_Mem_Pool_Node< T >::set_next ACE_Cached_Mem_Pool_Node< T > *  ptr  ) 

Set the next ACE_Cached_Mem_Pool_Node.

Definition at line 25 of file Malloc_T.inl.

00026 {
00027   this->next_ = ptr;
00028 }

Member Data Documentation

template<class T>
ACE_Cached_Mem_Pool_Node<T>* ACE_Cached_Mem_Pool_Node< T >::next_ [private]

Since memory is not used when placed in a free list, we can use it to maintain the structure of free list. I was using union to hide the fact of overlapping memory usage. However, that cause problem on MSVC. So, I now turn back to hack this with casting.

Definition at line 64 of file Malloc_T.h.

The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:20:34 2006 for ACE by doxygen 1.3.6