Protium
Math and Design Features
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
Protium::Allocation::STLAdapter< Host, AllocType > Class Template Reference

Allocator to be used by STL containers. More...

#include <STLAdapter.h>

Classes

struct  rebind
 Allows Adapters to use each other. More...
 

Public Types

typedef const Host * const_hostPointer
 
typedef const Host & const_hostRef
 
typedef const Host * const_pointer
 Const Pointer to host type. More...
 
typedef const Host & const_reference
 Const Reference to host type. More...
 
typedef std::ptrdiff_t difference_type
 Type to be used when calculating distance between pointers. More...
 
typedef Host * hostPointer
 
typedef Host & hostRef
 
typedef Host * pointer
 Pointer type to host type. More...
 
typedef Host & reference
 Reference to host type. More...
 
typedef std::size_t size_type
 Size to be used in allocation. More...
 
typedef Host value_type
 Host Type. More...
 

Public Member Functions

 STLAdapter () throw ()
 Default constuctor does nothing. More...
 
 STLAdapter (const STLAdapter &) throw ()
 Copy constructor utilizes nothing. More...
 
template<typename T >
 STLAdapter (const STLAdapter< T > &) throw ()
 Templated copy constructor does nothing. More...
 
 ~STLAdapter () throw ()
 Nothing to destruct. More...
 
Host * address (Host &elem) const
 Returns the address of the host object. More...
 
const Host * address (const Host &elem) const
 Returns the const address of the host object. More...
 
Host * allocate (std::size_t count, const void *hint=0)
 Allocates out a host object type. More...
 
void construct (Host *p, const Host &value)
 Constructs a copy host instance at the pointer. More...
 
void deallocate (Host *p, std::size_t size)
 Deallocates host objects up to size. More...
 
void destroy (Host *p)
 Destructs the host instance at p. More...
 
std::size_t max_size () const throw ()
 Returns the maximum number of objects that can be allocated at once. More...
 

Detailed Description

template<typename Host, typename AllocType = SmallObjectAllocator<>>
class Protium::Allocation::STLAdapter< Host, AllocType >

Allocator to be used by STL containers.

Parameters
HostCRTP style template. Use like: std::vector<MyClass, STLAdapter<MyClass> >
AllocTypeuse if SmallObject uses custom Allocator

Definition at line 17 of file STLAdapter.h.

Member Typedef Documentation

template<typename Host, typename AllocType = SmallObjectAllocator<>>
typedef const Host* Protium::Allocation::STLAdapter< Host, AllocType >::const_hostPointer

Definition at line 41 of file STLAdapter.h.

template<typename Host, typename AllocType = SmallObjectAllocator<>>
typedef const Host& Protium::Allocation::STLAdapter< Host, AllocType >::const_hostRef

Definition at line 43 of file STLAdapter.h.

template<typename Host, typename AllocType = SmallObjectAllocator<>>
typedef const Host* Protium::Allocation::STLAdapter< Host, AllocType >::const_pointer

Const Pointer to host type.

Definition at line 29 of file STLAdapter.h.

template<typename Host, typename AllocType = SmallObjectAllocator<>>
typedef const Host& Protium::Allocation::STLAdapter< Host, AllocType >::const_reference

Const Reference to host type.

Definition at line 35 of file STLAdapter.h.

template<typename Host, typename AllocType = SmallObjectAllocator<>>
typedef std::ptrdiff_t Protium::Allocation::STLAdapter< Host, AllocType >::difference_type

Type to be used when calculating distance between pointers.

Definition at line 23 of file STLAdapter.h.

template<typename Host, typename AllocType = SmallObjectAllocator<>>
typedef Host* Protium::Allocation::STLAdapter< Host, AllocType >::hostPointer

Definition at line 40 of file STLAdapter.h.

template<typename Host, typename AllocType = SmallObjectAllocator<>>
typedef Host& Protium::Allocation::STLAdapter< Host, AllocType >::hostRef

Definition at line 42 of file STLAdapter.h.

template<typename Host, typename AllocType = SmallObjectAllocator<>>
typedef Host* Protium::Allocation::STLAdapter< Host, AllocType >::pointer

Pointer type to host type.

Definition at line 26 of file STLAdapter.h.

template<typename Host, typename AllocType = SmallObjectAllocator<>>
typedef Host& Protium::Allocation::STLAdapter< Host, AllocType >::reference

Reference to host type.

Definition at line 32 of file STLAdapter.h.

template<typename Host, typename AllocType = SmallObjectAllocator<>>
typedef std::size_t Protium::Allocation::STLAdapter< Host, AllocType >::size_type

Size to be used in allocation.

Definition at line 20 of file STLAdapter.h.

template<typename Host, typename AllocType = SmallObjectAllocator<>>
typedef Host Protium::Allocation::STLAdapter< Host, AllocType >::value_type

Host Type.

Definition at line 38 of file STLAdapter.h.

Constructor & Destructor Documentation

template<typename Host, typename AllocType = SmallObjectAllocator<>>
Protium::Allocation::STLAdapter< Host, AllocType >::STLAdapter ( )
throw (
)
inline

Default constuctor does nothing.

Definition at line 46 of file STLAdapter.h.

template<typename Host, typename AllocType = SmallObjectAllocator<>>
Protium::Allocation::STLAdapter< Host, AllocType >::STLAdapter ( const STLAdapter< Host, AllocType > &  )
throw (
)
inline

Copy constructor utilizes nothing.

Definition at line 49 of file STLAdapter.h.

template<typename Host, typename AllocType = SmallObjectAllocator<>>
template<typename T >
Protium::Allocation::STLAdapter< Host, AllocType >::STLAdapter ( const STLAdapter< T > &  )
throw (
)
inline

Templated copy constructor does nothing.

Definition at line 53 of file STLAdapter.h.

template<typename Host, typename AllocType = SmallObjectAllocator<>>
Protium::Allocation::STLAdapter< Host, AllocType >::~STLAdapter ( )
throw (
)
inline

Nothing to destruct.

Definition at line 56 of file STLAdapter.h.

Member Function Documentation

template<typename Host, typename AllocType = SmallObjectAllocator<>>
Host* Protium::Allocation::STLAdapter< Host, AllocType >::address ( Host &  elem) const
inline

Returns the address of the host object.

Definition at line 65 of file STLAdapter.h.

template<typename Host, typename AllocType = SmallObjectAllocator<>>
const Host* Protium::Allocation::STLAdapter< Host, AllocType >::address ( const Host &  elem) const
inline

Returns the const address of the host object.

Definition at line 68 of file STLAdapter.h.

template<typename Host, typename AllocType = SmallObjectAllocator<>>
Host* Protium::Allocation::STLAdapter< Host, AllocType >::allocate ( std::size_t  count,
const void *  hint = 0 
)
inline

Allocates out a host object type.

Definition at line 71 of file STLAdapter.h.

template<typename Host, typename AllocType = SmallObjectAllocator<>>
void Protium::Allocation::STLAdapter< Host, AllocType >::construct ( Host *  p,
const Host &  value 
)
inline

Constructs a copy host instance at the pointer.

Definition at line 90 of file STLAdapter.h.

template<typename Host, typename AllocType = SmallObjectAllocator<>>
void Protium::Allocation::STLAdapter< Host, AllocType >::deallocate ( Host *  p,
std::size_t  size 
)
inline

Deallocates host objects up to size.

Definition at line 78 of file STLAdapter.h.

template<typename Host, typename AllocType = SmallObjectAllocator<>>
void Protium::Allocation::STLAdapter< Host, AllocType >::destroy ( Host *  p)
inline

Destructs the host instance at p.

Definition at line 95 of file STLAdapter.h.

template<typename Host, typename AllocType = SmallObjectAllocator<>>
std::size_t Protium::Allocation::STLAdapter< Host, AllocType >::max_size ( ) const
throw (
)
inline

Returns the maximum number of objects that can be allocated at once.

Definition at line 83 of file STLAdapter.h.