OpenDDS::DCPS::FirstTimeFastAllocator< T, N > Class Template Reference

#include <ZeroCopyAllocator_T.h>

Inheritance diagram for OpenDDS::DCPS::FirstTimeFastAllocator< T, N >:

Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::FirstTimeFastAllocator< T, N >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 FirstTimeFastAllocator ()
virtual void * malloc (size_t nbytes)
virtual void free (void *ptr)
virtual void * calloc (size_t nbytes, char initial_value= '\0')
 These methods are no-ops.
virtual void * calloc (size_t n_elem, size_t elem_size, char initial_value= '\0')
virtual int remove (void)
virtual int bind (const char *name, void *pointer, int duplicates=0)
virtual int trybind (const char *name, void *&pointer)
virtual int find (const char *name, void *&pointer)
virtual int find (const char *name)
virtual int unbind (const char *name)
virtual int unbind (const char *name, void *&pointer)
virtual int sync (ssize_t len=-1, int flags=MS_SYNC)
virtual int sync (void *addr, size_t len, int flags=MS_SYNC)
virtual int protect (ssize_t len=-1, int prot=PROT_RDWR)
virtual int protect (void *addr, size_t len, int prot=PROT_RDWR)
virtual void dump (void) const
T * pool ()

Private Attributes

bool firstTime_
 is this the first time this is allocated?
pool_ [N]
 the pool of allocated memory.

Detailed Description

template<class T, std::size_t N>
class OpenDDS::DCPS::FirstTimeFastAllocator< T, N >

This allocator is "Fast" because it's pool can be on the stack (If the object is on the stack and hence it does not require the cost of allocating and deallocating on the heap. It object is on the heap then it requires just one allocation; not two.)
Warning:
The object using this allocator must not have a scope smaller than this object !!!


Constructor & Destructor Documentation

template<class T, std::size_t N>
ACE_INLINE OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::FirstTimeFastAllocator (  ) 


Member Function Documentation

template<class T, std::size_t N>
int OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::bind ( const char *  name,
void *  pointer,
int  duplicates = 0 
) [virtual]

template<class T, std::size_t N>
void * OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::calloc ( size_t  n_elem,
size_t  elem_size,
char  initial_value = '\0' 
) [virtual]

template<class T, std::size_t N>
void * OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::calloc ( size_t  nbytes,
char  initial_value = '\0' 
) [virtual]

These methods are no-ops.

template<class T, std::size_t N>
void OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::dump ( void   )  const [virtual]

template<class T, std::size_t N>
int OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::find ( const char *  name  )  [virtual]

template<class T, std::size_t N>
int OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::find ( const char *  name,
void *&  pointer 
) [virtual]

template<class T, std::size_t N>
ACE_INLINE void OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::free ( void *  ptr  )  [virtual]

template<class T, std::size_t N>
ACE_INLINE void * OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::malloc ( size_t  nbytes  )  [virtual]

template<class T, std::size_t N>
T* OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::pool (  )  [inline]

template<class T, std::size_t N>
int OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::protect ( void *  addr,
size_t  len,
int  prot = PROT_RDWR 
) [virtual]

template<class T, std::size_t N>
int OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::protect ( ssize_t  len = -1,
int  prot = PROT_RDWR 
) [virtual]

template<class T, std::size_t N>
int OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::remove ( void   )  [virtual]

template<class T, std::size_t N>
int OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::sync ( void *  addr,
size_t  len,
int  flags = MS_SYNC 
) [virtual]

template<class T, std::size_t N>
int OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::sync ( ssize_t  len = -1,
int  flags = MS_SYNC 
) [virtual]

template<class T, std::size_t N>
int OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::trybind ( const char *  name,
void *&  pointer 
) [virtual]

template<class T, std::size_t N>
int OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::unbind ( const char *  name,
void *&  pointer 
) [virtual]

template<class T, std::size_t N>
int OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::unbind ( const char *  name  )  [virtual]


Member Data Documentation

template<class T, std::size_t N>
bool OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::firstTime_ [private]

is this the first time this is allocated?

template<class T, std::size_t N>
T OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::pool_[N] [private]

the pool of allocated memory.


The documentation for this class was generated from the following files:
Generated on Fri Nov 7 09:37:53 2008 for OpenDDS by  doxygen 1.4.7