Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

mySharedAllocatorT< T > Class Template Reference

allocator for any data type More...

#include <mySharedAllocator.h>

List of all members.

Public Types

typedef size_t size_type
typedef ptrdiff_t difference_type
typedef T * pointer
typedef const T * const_pointer
typedef T & reference
typedef const T & const_reference
typedef T value_type

Public Methods

pointer address (reference x) const
 adress

const_pointer address (const_reference x) const
 adress

pointer allocate (size_type n, mySharedAllocatorT< void >::const_pointer hint=0)
 allocate memory

void deallocate (pointer p, size_type n)
 free memory

size_type max_size () const throw ()
 maximum allocation size

void construct (pointer p, const T &val)
 construct an object in allocated memory

void destroy (pointer p)
 destroy an object in shared memory

: incorect usage of the class mySharedMemoryAllocator
 mySharedAllocatorT () throw ()
 construtor

 mySharedAllocatorT (const mySharedAllocatorT &) throw ()
 copy constructor

template<typename U>  mySharedAllocatorT (const mySharedAllocatorT< U > &) throw ()
 copy from an other allocator

 ~mySharedAllocatorT () throw ()
 destructor


Detailed Description

template<typename T>
class mySharedAllocatorT< T >

allocator for any data type

Definition at line 81 of file mySharedAllocator.h.


Member Typedef Documentation

template<typename T>
typedef const T* mySharedAllocatorT< T >::const_pointer
 

Definition at line 86 of file mySharedAllocator.h.

Referenced by mySharedAllocatorT< T >::address(), and mySharedAllocatorT< T >::allocate().

template<typename T>
typedef const T& mySharedAllocatorT< T >::const_reference
 

Definition at line 88 of file mySharedAllocator.h.

Referenced by mySharedAllocatorT< T >::address().

template<typename T>
typedef ptrdiff_t mySharedAllocatorT< T >::difference_type
 

Definition at line 84 of file mySharedAllocator.h.

template<typename T>
typedef T* mySharedAllocatorT< T >::pointer
 

Definition at line 85 of file mySharedAllocator.h.

Referenced by mySharedAllocatorT< T >::address(), mySharedAllocatorT< T >::allocate(), mySharedAllocatorT< T >::construct(), mySharedAllocatorT< T >::deallocate(), and mySharedAllocatorT< T >::destroy().

template<typename T>
typedef T& mySharedAllocatorT< T >::reference
 

Definition at line 87 of file mySharedAllocator.h.

Referenced by mySharedAllocatorT< T >::address().

template<typename T>
typedef size_t mySharedAllocatorT< T >::size_type
 

Definition at line 83 of file mySharedAllocator.h.

Referenced by mySharedAllocatorT< T >::allocate(), mySharedAllocatorT< T >::deallocate(), and mySharedAllocatorT< T >::max_size().

template<typename T>
typedef T mySharedAllocatorT< T >::value_type
 

Definition at line 89 of file mySharedAllocator.h.


Constructor & Destructor Documentation

template<typename T>
mySharedAllocatorT< T >::mySharedAllocatorT   throw () [inline]
 

construtor

Definition at line 98 of file mySharedAllocator.h.

00098                                  {
00099       //cerr<<"mySharedAllocatorT"<<endl;
00100    };

template<typename T>
mySharedAllocatorT< T >::mySharedAllocatorT const mySharedAllocatorT< T > &    throw () [inline]
 

copy constructor

Definition at line 102 of file mySharedAllocator.h.

00102                                                           {
00103       //cerr<<"mySharedAllocatorT(const mySharedAllocatorT &)"<<endl;
00104    };

template<typename T>
template<typename U>
mySharedAllocatorT< T >::mySharedAllocatorT const mySharedAllocatorT< U > &    throw () [inline]
 

copy from an other allocator

Definition at line 106 of file mySharedAllocator.h.

00106                                                                                    {
00107       //cerr<<"mySharedAllocatorT(const mySharedAllocatorT<U> &)"<<endl;   
00108    }

template<typename T>
mySharedAllocatorT< T >::~mySharedAllocatorT   throw () [inline]
 

destructor

Definition at line 110 of file mySharedAllocator.h.

00110                                  {
00111       //cerr<<"~mySharedAllocatorT()"<<endl;
00112    };


Member Function Documentation

template<typename T>
const_pointer mySharedAllocatorT< T >::address const_reference    x const [inline]
 

adress

Definition at line 121 of file mySharedAllocator.h.

References mySharedAllocatorT< T >::const_pointer, and mySharedAllocatorT< T >::const_reference.

00121                                                   {
00122       return &x;
00123    }

template<typename T>
pointer mySharedAllocatorT< T >::address reference    x const [inline]
 

adress

Definition at line 116 of file mySharedAllocator.h.

References mySharedAllocatorT< T >::pointer, and mySharedAllocatorT< T >::reference.

00116                                       {
00117       return &x;
00118    }

template<typename T>
pointer mySharedAllocatorT< T >::allocate size_type    n,
mySharedAllocatorT< void >::const_pointer    hint = 0
[inline]
 

allocate memory

Definition at line 126 of file mySharedAllocator.h.

References mySharedAllocatorT< T >::const_pointer, PsnSharedMemoryManager::lockIfNeeded(), PsnSharedMemoryManager::mmalloc(), mySharedAllocatorT< T >::pointer, mySharedAllocatorT< T >::size_type, PsMomeController::STLSharedMemoryManager, and PsnSharedMemoryManager::unlockIfNeeded().

00126                                                                                   {
00127       if(n<0) {
00128          n=0;
00129       }
00130       PsnSharedMemoryManager * STLManager = PsMomeController::STLSharedMemoryManager;
00131       //cerr<<"mySharedAllocator::allocate avant lock()"<<endl;
00132       STLManager->lockIfNeeded();
00133       //cerr<<"mySharedAllocator::allocate après lock()"<<endl;
00134       pointer resul=(pointer)PsMomeController::STLSharedMemoryManager->mmalloc(n*sizeof(T));
00135       STLManager->unlockIfNeeded();
00136       return resul;
00137    }

template<typename T>
void mySharedAllocatorT< T >::construct pointer    p,
const T &    val
[inline]
 

construct an object in allocated memory

Definition at line 154 of file mySharedAllocator.h.

References mySharedAllocatorT< T >::pointer.

00154                                            {
00155       cerr<<"mySharedAllocatorT::construct"<<endl;
00156       return new((void *)p) T(val);
00157    };

template<typename T>
void mySharedAllocatorT< T >::deallocate pointer    p,
size_type    n
[inline]
 

free memory

Definition at line 140 of file mySharedAllocator.h.

References PsnSharedMemoryManager::lockIfNeeded(), PsnSharedMemoryManager::mfree(), mySharedAllocatorT< T >::pointer, mySharedAllocatorT< T >::size_type, PsMomeController::STLSharedMemoryManager, and PsnSharedMemoryManager::unlockIfNeeded().

00140                                            {
00141       PsnSharedMemoryManager * STLManager = PsMomeController::STLSharedMemoryManager;
00142       STLManager->lockIfNeeded();
00143       PsMomeController::STLSharedMemoryManager->mfree((void *)p,n*sizeof(T));
00144       STLManager->unlockIfNeeded();
00145    }

template<typename T>
void mySharedAllocatorT< T >::destroy pointer    p [inline]
 

destroy an object in shared memory

Definition at line 160 of file mySharedAllocator.h.

References mySharedAllocatorT< T >::pointer.

00160                            {
00161       cerr<<"mySharedAllocatorT::destroy"<<endl;
00162       ((T*)p)->~T() ;
00163    }

template<typename T>
size_type mySharedAllocatorT< T >::max_size   const throw () [inline]
 

maximum allocation size

Definition at line 148 of file mySharedAllocator.h.

References mySharedAllocatorT< T >::size_type.

00148                                       {
00149       cerr<<"mySharedAllocatorT::max_size"<<endl;
00150       return 16374;
00151    }


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

Documentation generated on Mon Nov 25 15:26:14 2002

Generated with doxygen 1.2.12 by Dimitri van Heesch ,   1997-2001