Orocos Real-Time Toolkit  2.8.3
Classes | Public Types | Public Member Functions | List of all members
RTT::os::local_allocator< T, Alloc > Class Template Reference

A simple local allocator which keeps a small pool which you can grow manually with grow(). More...

#include <rtt/os/oro_allocator.hpp>

Classes

struct  rebind
 

Public Types

typedef Alloc::value_type value_type
 
typedef Alloc::pointer pointer
 
typedef Alloc::const_pointer const_pointer
 
typedef Alloc::reference reference
 
typedef Alloc::const_reference const_reference
 
typedef Alloc::size_type size_type
 
typedef Alloc::difference_type difference_type
 

Public Member Functions

pointer address (reference x) const
 
const_pointer address (const_reference x) const
 
pointer allocate (size_type n, const_pointer hint=0)
 
void deallocate (pointer p, size_type n)
 
size_type max_size () const
 
void construct (pointer p, const value_type &x)
 
void destroy (pointer p)
 
void grow (size_type n, const_pointer hint=0)
 Grow local pool with room for at least n additional items. More...
 
void shrink (size_type n)
 Shrink local pool with n items. More...
 
 local_allocator ()
 
 local_allocator (const local_allocator &)
 
 ~local_allocator ()
 
template<class U , class A >
 local_allocator (const local_allocator< U, A > &)
 
void operator= (const local_allocator &)
 

Detailed Description

template<class T, class Alloc = std::allocator<T>>
class RTT::os::local_allocator< T, Alloc >

A simple local allocator which keeps a small pool which you can grow manually with grow().

It delegates allocation to the Alloc for each allocation request, also if the pool is empty. The pool works on a per-type basis globally (static !). The pool is thus not per-object. A per-object allocator is not allowed by the standard. The pool is deallocated upon global destruction.

Parameters
Tthe type to allocate memory for
Allocthe allocator to delegate allocation to.

Definition at line 64 of file oro_allocator.hpp.

Member Typedef Documentation

template<class T, class Alloc = std::allocator<T>>
typedef Alloc::const_pointer RTT::os::local_allocator< T, Alloc >::const_pointer

Definition at line 69 of file oro_allocator.hpp.

template<class T, class Alloc = std::allocator<T>>
typedef Alloc::const_reference RTT::os::local_allocator< T, Alloc >::const_reference

Definition at line 71 of file oro_allocator.hpp.

template<class T, class Alloc = std::allocator<T>>
typedef Alloc::difference_type RTT::os::local_allocator< T, Alloc >::difference_type

Definition at line 73 of file oro_allocator.hpp.

template<class T, class Alloc = std::allocator<T>>
typedef Alloc::pointer RTT::os::local_allocator< T, Alloc >::pointer

Definition at line 68 of file oro_allocator.hpp.

template<class T, class Alloc = std::allocator<T>>
typedef Alloc::reference RTT::os::local_allocator< T, Alloc >::reference

Definition at line 70 of file oro_allocator.hpp.

template<class T, class Alloc = std::allocator<T>>
typedef Alloc::size_type RTT::os::local_allocator< T, Alloc >::size_type

Definition at line 72 of file oro_allocator.hpp.

template<class T, class Alloc = std::allocator<T>>
typedef Alloc::value_type RTT::os::local_allocator< T, Alloc >::value_type

Definition at line 67 of file oro_allocator.hpp.

Constructor & Destructor Documentation

template<class T, class Alloc = std::allocator<T>>
RTT::os::local_allocator< T, Alloc >::local_allocator ( )
inline

Definition at line 168 of file oro_allocator.hpp.

template<class T, class Alloc = std::allocator<T>>
RTT::os::local_allocator< T, Alloc >::local_allocator ( const local_allocator< T, Alloc > &  )
inline

Definition at line 169 of file oro_allocator.hpp.

template<class T, class Alloc = std::allocator<T>>
RTT::os::local_allocator< T, Alloc >::~local_allocator ( )
inline

Definition at line 170 of file oro_allocator.hpp.

template<class T, class Alloc = std::allocator<T>>
template<class U , class A >
RTT::os::local_allocator< T, Alloc >::local_allocator ( const local_allocator< U, A > &  )
inline

Definition at line 172 of file oro_allocator.hpp.

Member Function Documentation

template<class T, class Alloc = std::allocator<T>>
pointer RTT::os::local_allocator< T, Alloc >::address ( reference  x) const
inline

Definition at line 76 of file oro_allocator.hpp.

template<class T, class Alloc = std::allocator<T>>
const_pointer RTT::os::local_allocator< T, Alloc >::address ( const_reference  x) const
inline

Definition at line 80 of file oro_allocator.hpp.

template<class T, class Alloc = std::allocator<T>>
pointer RTT::os::local_allocator< T, Alloc >::allocate ( size_type  n,
const_pointer  hint = 0 
)
inline

Definition at line 84 of file oro_allocator.hpp.

template<class T, class Alloc = std::allocator<T>>
void RTT::os::local_allocator< T, Alloc >::construct ( pointer  p,
const value_type x 
)
inline

Definition at line 132 of file oro_allocator.hpp.

template<class T, class Alloc = std::allocator<T>>
void RTT::os::local_allocator< T, Alloc >::deallocate ( pointer  p,
size_type  n 
)
inline

Definition at line 110 of file oro_allocator.hpp.

template<class T, class Alloc = std::allocator<T>>
void RTT::os::local_allocator< T, Alloc >::destroy ( pointer  p)
inline

Definition at line 136 of file oro_allocator.hpp.

template<class T, class Alloc = std::allocator<T>>
void RTT::os::local_allocator< T, Alloc >::grow ( size_type  n,
const_pointer  hint = 0 
)
inline

Grow local pool with room for at least n additional items.

Definition at line 141 of file oro_allocator.hpp.

Referenced by RTT::os::rt_list< T, Alloc >::rt_grow().

template<class T, class Alloc = std::allocator<T>>
size_type RTT::os::local_allocator< T, Alloc >::max_size ( ) const
inline

Definition at line 128 of file oro_allocator.hpp.

template<class T, class Alloc = std::allocator<T>>
void RTT::os::local_allocator< T, Alloc >::operator= ( const local_allocator< T, Alloc > &  )
inline

Definition at line 177 of file oro_allocator.hpp.

template<class T, class Alloc = std::allocator<T>>
void RTT::os::local_allocator< T, Alloc >::shrink ( size_type  n)
inline

Shrink local pool with n items.

Definition at line 151 of file oro_allocator.hpp.

Referenced by RTT::os::rt_list< T, Alloc >::rt_shrink().


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