![]() |
SheafSystem
0.0.0.0
|
A reallocatable pool of objects of type T. Objects in the pool are either "allocated" or linked together into a "free" list. Intended to support efficient allocation and deallocation of nodes in a graph or other dynamic data structure. There is an implicit constraint on T: it must have a next() feature. More...
#include <pool.h>
Public Types | |
| typedef T | value_type |
| The container's value type. More... | |
| typedef T & | reference_type |
| A type that behaves as a reference to the container's value type. More... | |
| typedef const T & | const_reference_type |
| A type that behaves as a const reference to the container's value type. More... | |
| typedef T * | pointer_type |
| A type that behaves as a pointer to the container's value type. More... | |
| typedef const T * | const_pointer_type |
| A type that behaves as a const pointer to the container's value type. More... | |
| typedef pod_index_type | index_type |
| The containers index type. More... | |
| typedef pod_index_type | difference_type |
| A signed integral type used to represent the difference of two indices or iterators. More... | |
| typedef unsigned long int | size_type |
| An unsigned integral type used to represent sizes and capacities. More... | |
Public Member Functions | |
| bool | invariant () const |
| Class invariant. More... | |
| pod_index_type | index_ub () const |
| The upper bound on the index for members of the pool. More... | |
| bool | index_in_bounds (pod_index_type xindex) const |
| True if xindex is in bounds. More... | |
| int | free_ct () const |
| The size of free list. More... | |
| pod_index_type | free_list () const |
| The head of the free list. More... | |
| int | allocated_ct () const |
| The size of allocated list. More... | |
| bool | is_allocated (pod_index_type xindex) const |
| True if xindex is allocated. More... | |
| T & | item (pod_index_type xindex) |
| A pointer to the pool item at xindex. More... | |
| T & | operator[] (pod_index_type xindex) |
| A reference to the pool item at xindex. More... | |
| index_iterator | allocated_iterator () const |
| An iterator over allocated items in the pool. More... | |
| pod_index_type | allocate () |
| Allocate next available index from free list. More... | |
| void | deallocate (pod_index_type xindex) |
| Deallocate item at xindex. More... | |
| void | print () const |
| Prints the data members of this on cout. Intended for use debugging. More... | |
| void | print (std::ostream &out) const |
| Prints the data members of this on cout. Intended for use debugging. More... | |
| pool (pod_index_type xub) | |
| Creates an instance with xub upper bound. More... | |
| ~pool () | |
| Destructor. More... | |
Friends | |
| size_t | deep_size (const pool< T, EXTENSION_FACTOR > &xpool, bool xinclude_shallow) |
| The deep size of the referenced object of type pool<T, int>. More... | |
A reallocatable pool of objects of type T. Objects in the pool are either "allocated" or linked together into a "free" list. Intended to support efficient allocation and deallocation of nodes in a graph or other dynamic data structure. There is an implicit constraint on T: it must have a next() feature.
| typedef const T* sheaf::pool< T, EXTENSION_FACTOR >::const_pointer_type |
| typedef const T& sheaf::pool< T, EXTENSION_FACTOR >::const_reference_type |
| typedef pod_index_type sheaf::pool< T, EXTENSION_FACTOR >::difference_type |
| typedef pod_index_type sheaf::pool< T, EXTENSION_FACTOR >::index_type |
| typedef T* sheaf::pool< T, EXTENSION_FACTOR >::pointer_type |
| typedef T& sheaf::pool< T, EXTENSION_FACTOR >::reference_type |
| typedef unsigned long int sheaf::pool< T, EXTENSION_FACTOR >::size_type |
| typedef T sheaf::pool< T, EXTENSION_FACTOR >::value_type |
| sheaf::pool< T, EXTENSION_FACTOR >::pool | ( | pod_index_type | xub | ) |
Creates an instance with xub upper bound.
Definition at line 229 of file pool.impl.h.
References sheaf::invalid_pod_index(), and sheaf::pool< T, EXTENSION_FACTOR >::~pool().
Referenced by sheaf::pool< T, EXTENSION_FACTOR >::deallocate().
| sheaf::pool< T, EXTENSION_FACTOR >::~pool | ( | ) |
Destructor.
Definition at line 258 of file pool.impl.h.
References sheaf::pool< T, EXTENSION_FACTOR >::item().
Referenced by sheaf::pool< T, EXTENSION_FACTOR >::pool().
| pod_index_type sheaf::pool< T, EXTENSION_FACTOR >::allocate | ( | ) |
Allocate next available index from free list.
Definition at line 159 of file pool.impl.h.
References sheaf::pool< T, EXTENSION_FACTOR >::deallocate(), sheaf::invalid_pod_index(), and sheaf::is_valid().
Referenced by sheaf::pool< T, EXTENSION_FACTOR >::allocated_iterator().
| int sheaf::pool< T, EXTENSION_FACTOR >::allocated_ct | ( | ) | const |
The size of allocated list.
Definition at line 109 of file pool.impl.h.
References sheaf::pool< T, EXTENSION_FACTOR >::is_allocated().
Referenced by sheaf::pool< T, EXTENSION_FACTOR >::free_list().
| index_iterator sheaf::pool< T, EXTENSION_FACTOR >::allocated_iterator | ( | ) | const |
An iterator over allocated items in the pool.
Definition at line 139 of file pool.impl.h.
References sheaf::pool< T, EXTENSION_FACTOR >::allocate().
Referenced by sheaf::pool< T, EXTENSION_FACTOR >::is_allocated().
| void sheaf::pool< T, EXTENSION_FACTOR >::deallocate | ( | pod_index_type | xindex | ) |
Deallocate item at xindex.
Definition at line 200 of file pool.impl.h.
References sheaf::pool< T, EXTENSION_FACTOR >::pool().
Referenced by sheaf::pool< T, EXTENSION_FACTOR >::allocate().
| int sheaf::pool< T, EXTENSION_FACTOR >::free_ct | ( | ) | const |
The size of free list.
Definition at line 93 of file pool.impl.h.
References sheaf::pool< T, EXTENSION_FACTOR >::free_list().
Referenced by sheaf::pool< T, EXTENSION_FACTOR >::index_in_bounds().
| pod_index_type sheaf::pool< T, EXTENSION_FACTOR >::free_list | ( | ) | const |
The head of the free list.
Definition at line 101 of file pool.impl.h.
References sheaf::pool< T, EXTENSION_FACTOR >::allocated_ct().
Referenced by sheaf::pool< T, EXTENSION_FACTOR >::free_ct().
| bool sheaf::pool< T, EXTENSION_FACTOR >::index_in_bounds | ( | pod_index_type | xindex | ) | const |
True if xindex is in bounds.
Definition at line 85 of file pool.impl.h.
References sheaf::pool< T, EXTENSION_FACTOR >::free_ct().
Referenced by sheaf::pool< T, EXTENSION_FACTOR >::index_ub().
| pod_index_type sheaf::pool< T, EXTENSION_FACTOR >::index_ub | ( | ) | const |
The upper bound on the index for members of the pool.
Definition at line 65 of file pool.impl.h.
References sheaf::pool< T, EXTENSION_FACTOR >::index_in_bounds().
Referenced by sheaf::deep_size(), and sheaf::pool< T, EXTENSION_FACTOR >::invariant().
| bool sheaf::pool< T, EXTENSION_FACTOR >::invariant | ( | ) | const |
Class invariant.
Definition at line 49 of file pool.impl.h.
References sheaf::pool< T, EXTENSION_FACTOR >::index_ub().
| bool sheaf::pool< T, EXTENSION_FACTOR >::is_allocated | ( | pod_index_type | xindex | ) | const |
True if xindex is allocated.
Definition at line 117 of file pool.impl.h.
References sheaf::pool< T, EXTENSION_FACTOR >::allocated_iterator().
Referenced by sheaf::pool< T, EXTENSION_FACTOR >::allocated_ct().
| T & sheaf::pool< T, EXTENSION_FACTOR >::item | ( | pod_index_type | xindex | ) |
A pointer to the pool item at xindex.
Definition at line 278 of file pool.impl.h.
References sheaf::pool< T, EXTENSION_FACTOR >::operator[]().
Referenced by sheaf::pool< T, EXTENSION_FACTOR >::~pool().
| T & sheaf::pool< T, EXTENSION_FACTOR >::operator[] | ( | pod_index_type | xindex | ) |
A reference to the pool item at xindex.
Definition at line 297 of file pool.impl.h.
References sheaf::invalid_pod_index(), sheaf::is_valid(), and sheaf::pool< T, EXTENSION_FACTOR >::print().
Referenced by sheaf::pool< T, EXTENSION_FACTOR >::item().
| void sheaf::pool< T, EXTENSION_FACTOR >::print | ( | ) | const |
Prints the data members of this on cout. Intended for use debugging.
Definition at line 409 of file pool.impl.h.
Referenced by sheaf::pool< T, EXTENSION_FACTOR >::operator[]().
| void sheaf::pool< T, EXTENSION_FACTOR >::print | ( | std::ostream & | out | ) | const |
Prints the data members of this on cout. Intended for use debugging.
Definition at line 417 of file pool.impl.h.
|
friend |
The deep size of the referenced object of type pool<T, int>.
Definition at line 453 of file pool.impl.h.