|
Open Model Railroad Network (OpenMRN)
|
This is a custom allocator that limits the number of mappings. More...
#include <Allocator.hxx>
Classes | |
| union | FreeList |
| List of unused elements. More... | |
| struct | rebind |
| typedef for allocator specialization More... | |
Public Types | |
| typedef T | value_type |
| value_type required by stl | |
| typedef value_type * | pointer |
| pointer required by stl | |
| typedef const value_type * | const_pointer |
| const_pointer required by stl | |
| typedef value_type & | reference |
| reference required by stl | |
| typedef const value_type & | const_reference |
| const_reference required by stl | |
| typedef std::size_t | size_type |
| size_type required by stl | |
| typedef std::ptrdiff_t | difference_type |
| difference_type required by stl | |
Public Member Functions | |
| Allocator (size_t e) | |
| Constructor. | |
| Allocator (Allocator const &a) | |
| Copy constructor. | |
| ~Allocator () | |
| Destructor. | |
| template<typename U > | |
| Allocator (Allocator< U > const &o) | |
| template copy constructor. | |
| T * | address (T &r) |
| Address of item. | |
| const T * | address (const T &r) |
| Const address of item. | |
| T * | allocate (size_t cnt, const void *=0) |
| Allocate item(s) out of the pool. | |
| void | deallocate (T *p, size_t n) |
| Free itme. | |
| size_t | max_size () const |
| Maximum number of items that can be allocated. | |
| void | construct (T *p, const T &t) |
| Placement constructor. | |
| void | destroy (T *p) |
| Destruct. | |
| bool | operator== (Allocator const &) |
| Overloaded operator ==. | |
| bool | operator!= (Allocator const &a) |
| Overloaded operator !=. | |
Public Attributes | |
| FreeList * | freeList |
| Start of free list. | |
| bool | init |
| flag that tell us if we have initilized our selves or not | |
| size_t | entries |
| number of elements in the fixed size pool | |
Private Member Functions | |
| Allocator () | |
| Default Constructor. | |
This is a custom allocator that limits the number of mappings.
It also performs a single dynamic allocation capable of holding the total number of mappings on the first allocation request. This is so that successive allocation requests are faster, more deterministic, and don't waste memory potentially used for the heap management headers.
Definition at line 46 of file Allocator.hxx.
| typedef const value_type* Allocator< T >::const_pointer |
const_pointer required by stl
Definition at line 68 of file Allocator.hxx.
| typedef const value_type& Allocator< T >::const_reference |
const_reference required by stl
Definition at line 70 of file Allocator.hxx.
| typedef std::ptrdiff_t Allocator< T >::difference_type |
difference_type required by stl
Definition at line 72 of file Allocator.hxx.
| typedef value_type* Allocator< T >::pointer |
pointer required by stl
Definition at line 67 of file Allocator.hxx.
| typedef value_type& Allocator< T >::reference |
reference required by stl
Definition at line 69 of file Allocator.hxx.
| typedef std::size_t Allocator< T >::size_type |
size_type required by stl
Definition at line 71 of file Allocator.hxx.
| typedef T Allocator< T >::value_type |
value_type required by stl
Definition at line 66 of file Allocator.hxx.
|
inlineexplicit |
Constructor.
| e | number of entries in the fixed size pool |
Definition at line 84 of file Allocator.hxx.
|
inlineexplicit |
Destructor.
Definition at line 103 of file Allocator.hxx.
|
inline |
template copy constructor.
| o | insance to copy |
Definition at line 110 of file Allocator.hxx.
|
inlineprivate |
Default Constructor.
Definition at line 216 of file Allocator.hxx.
|
inline |
Const address of item.
| r | item to take the address of |
Definition at line 130 of file Allocator.hxx.
|
inline |
Address of item.
| r | item to take the address of |
Definition at line 121 of file Allocator.hxx.
|
inline |
Allocate item(s) out of the pool.
| cnt | number of items to allocate |
Definition at line 139 of file Allocator.hxx.
|
inline |
Placement constructor.
| p | location of placement |
| t | parameter to constructor |
Definition at line 184 of file Allocator.hxx.
|
inline |
Free itme.
| p | item to free |
| n | number of items to free |
Definition at line 164 of file Allocator.hxx.
|
inline |
|
inline |
Maximum number of items that can be allocated.
Definition at line 174 of file Allocator.hxx.
Overloaded operator !=.
| a | item to compare |
Definition at line 209 of file Allocator.hxx.
| size_t Allocator< T >::entries |
number of elements in the fixed size pool
Definition at line 64 of file Allocator.hxx.
Start of free list.
Definition at line 58 of file Allocator.hxx.
flag that tell us if we have initilized our selves or not
Definition at line 61 of file Allocator.hxx.