mbo::allocator< __ValueType, __ReferenceType > Class Template Reference

Allocator base using uninitalized memory. More...

#include <reallocator.h>

Inheritance diagram for mbo::allocator< __ValueType, __ReferenceType >:

Inheritance graph
{mbo::allocator\< __ValueType \>\n||+ address()\l+ address()\l+ allocate()\l+ deallocate()\l+ construct()\l+ max_size()\l}{mbo::reallocator\< __ValueType \>\n||+ reallocate()\l+ move()\l}{mbo::mem_reallocator\< __ValueType \>\n||+ allocate()\l+ deallocate()\l+ reallocate()\l+ move()\l}
[legend]
Collaboration diagram for mbo::allocator< __ValueType, __ReferenceType >:

Collaboration graph
[legend]

List of all members.

Public Types

typedef std::allocator
< __ValueType > 
__Allocator
typedef __Allocator::size_type size_type
typedef __Allocator::value_type value_type
typedef __Allocator::pointer pointer
typedef __Allocator::const_pointer const_pointer
typedef
__Allocator::difference_type 
difference_type
typedef __ReferenceType & reference
typedef const __ReferenceType & const_reference

Public Member Functions

pointer address (reference ref)
const_pointer address (const_reference ref)
pointer allocate (size_type size, std::allocator< void >::const_pointer hint=0L)
void deallocate (pointer ptr, size_type size)
void construct (pointer ptr, const_reference oth)
size_type max_size () const

Classes

struct  rebind


Detailed Description

template<class __ValueType, class __ReferenceType = __ValueType>
class mbo::allocator< __ValueType, __ReferenceType >

Allocator base using uninitalized memory.

Internally the handled element spaces are treated as char arrays.

Definition at line 58 of file reallocator.h.


Member Typedef Documentation

template<class __ValueType, class __ReferenceType = __ValueType>
typedef std::allocator<__ValueType> mbo::allocator< __ValueType, __ReferenceType >::__Allocator

allocator type

Definition at line 62 of file reallocator.h.

template<class __ValueType, class __ReferenceType = __ValueType>
typedef __Allocator::size_type mbo::allocator< __ValueType, __ReferenceType >::size_type

type used for size and indexing

Definition at line 63 of file reallocator.h.

template<class __ValueType, class __ReferenceType = __ValueType>
typedef __Allocator::value_type mbo::allocator< __ValueType, __ReferenceType >::value_type

value type

Definition at line 64 of file reallocator.h.

template<class __ValueType, class __ReferenceType = __ValueType>
typedef __Allocator::pointer mbo::allocator< __ValueType, __ReferenceType >::pointer

pointer to value type

Definition at line 65 of file reallocator.h.

template<class __ValueType, class __ReferenceType = __ValueType>
typedef __Allocator::const_pointer mbo::allocator< __ValueType, __ReferenceType >::const_pointer

const pointer to value type

Definition at line 66 of file reallocator.h.

template<class __ValueType, class __ReferenceType = __ValueType>
typedef __Allocator::difference_type mbo::allocator< __ValueType, __ReferenceType >::difference_type

type used to calculate element position distances

Definition at line 67 of file reallocator.h.

template<class __ValueType, class __ReferenceType = __ValueType>
typedef __ReferenceType& mbo::allocator< __ValueType, __ReferenceType >::reference

type used with element referencing (read/write)

Definition at line 69 of file reallocator.h.

template<class __ValueType, class __ReferenceType = __ValueType>
typedef const __ReferenceType& mbo::allocator< __ValueType, __ReferenceType >::const_reference

type used with const element referencing (read only)

Definition at line 70 of file reallocator.h.


Member Function Documentation

template<class __ValueType, class __ReferenceType = __ValueType>
pointer mbo::allocator< __ValueType, __ReferenceType >::address ( reference  ref  )  [inline]

Returns:
the address of the element ref

Definition at line 74 of file reallocator.h.

00075     {
00076         return &ref;
00077     }

template<class __ValueType, class __ReferenceType = __ValueType>
const_pointer mbo::allocator< __ValueType, __ReferenceType >::address ( const_reference  ref  )  [inline]

Returns:
the const address of the element ref

Definition at line 81 of file reallocator.h.

00082     {
00083         return &ref;
00084     }

template<class __ValueType, class __ReferenceType = __ValueType>
pointer mbo::allocator< __ValueType, __ReferenceType >::allocate ( size_type  size,
std::allocator< void >::const_pointer  hint = 0L 
) [inline]

Allocate element space

Parameters:
size number of elements required
hint ignored
Returns:
allocated element space
Note:
No default constructors are executed.

Definition at line 94 of file reallocator.h.

00095     {
00096         return size ? reinterpret_cast<pointer>(new char [size * sizeof(value_type)]) : 0L;
00097     }

template<class __ValueType, class __ReferenceType = __ValueType>
void mbo::allocator< __ValueType, __ReferenceType >::deallocate ( pointer  ptr,
size_type  size 
) [inline]

Deallocate an element space.

Parameters:
ptr element space to deallocate
size number of elements in element space
Note:
No destructors are called.

Definition at line 106 of file reallocator.h.

00107     {
00108         delete [] reinterpret_cast<char*>(ptr);
00109     }

template<class __ValueType, class __ReferenceType = __ValueType>
void mbo::allocator< __ValueType, __ReferenceType >::construct ( pointer  ptr,
const_reference  oth 
) [inline]

Construct an element as a copy of another one

Parameters:
ptr pointer to element position in element space
oth other element to copy from
Note:
An inplace copy constructor will be executed.

Definition at line 118 of file reallocator.h.

00119     {
00120 #if _MSC_VER >= 1300
00121 # pragma push_macro("new")
00122 # undef new
00123 #endif
00124         new (ptr) value_type(oth);
00125 #if _MSC_VER >= 1300
00126 # pragma pop_macro("new")
00127 #endif
00128     }

template<class __ValueType, class __ReferenceType = __ValueType>
size_type mbo::allocator< __ValueType, __ReferenceType >::max_size (  )  const [inline]

Returns:
the theoretical maximum number of elements if no other storage was allocated anywhere else.

Definition at line 133 of file reallocator.h.

00134     {
00135         return static_cast<size_type>(~0) / sizeof(value_type);
00136     }


The documentation for this class was generated from the following file:
  Hosted on code.google.com  
© Marcus Börger
Generated on Fri Jan 18 21:21:13 2008 for MBO-lib by doxygen 1.5.4