A base class for a generic internal fixed size stack and vector. More...
#include <tpie/internal_stack_vector_base.h>
Inherits tpie::linear_memory_base< child_t >.
Public Types | |
typedef T | value_type |
Public Member Functions | |
internal_stack_vector_base (size_t size=0, tpie::memory_bucket_ref b=memory_bucket_ref()) | |
Construct structure with given capacity. More... | |
void | resize (size_t size=0) |
Change the capacity of the structure and clear all elements. More... | |
bool | empty () const |
Check if no elements are currently pushed to the structure. More... | |
size_t | size () const |
Return the number of elements in the data structure. More... | |
void | clear () |
Clear the data structure of all elements. More... | |
Static Public Member Functions | |
static double | memory_coefficient () |
Return the memory coefficient of the structure. More... | |
static double | memory_overhead () |
Return the memory overhead of the structure. More... | |
static memory_size_type | memory_usage (memory_size_type size) |
Return the number of bytes required to create a data structure supporting a given number of elements. More... | |
static memory_size_type | memory_fits (memory_size_type memory) |
Return the maximum number of elements that can be contained in in the structure when it is allowed to fill a given number of bytes. More... | |
Protected Attributes | |
array< T > | m_elements |
Element storage. More... | |
size_t | m_size |
Number of elements pushed to the structure. More... | |
A base class for a generic internal fixed size stack and vector.
T | The type of items stored in the container. |
child_t | The subtype of the class (CRTP). |
Definition at line 38 of file internal_stack_vector_base.h.
|
inline |
Construct structure with given capacity.
If a zero capacity is given (the default), no elements may be pushed to the structure until the structure is resize
d to a different capacity.
size | Capacity of the structure. |
Definition at line 69 of file internal_stack_vector_base.h.
|
inline |
Clear the data structure of all elements.
Definition at line 92 of file internal_stack_vector_base.h.
|
inline |
Check if no elements are currently pushed to the structure.
Definition at line 82 of file internal_stack_vector_base.h.
|
inlinestatic |
Return the memory coefficient of the structure.
Allocating a structure with n elements will use at most bytes. This does not include memory overhead incurred if the structure is allocated using new.
Definition at line 51 of file internal_stack_vector_base.h.
|
inlinestaticinherited |
Return the maximum number of elements that can be contained in in the structure when it is allowed to fill a given number of bytes.
memory | The number of bytes the structure is allowed to occupy |
|
inlinestatic |
Return the memory overhead of the structure.
Definition at line 56 of file internal_stack_vector_base.h.
|
inlinestaticinherited |
Return the number of bytes required to create a data structure supporting a given number of elements.
size | The number of elements to support |
|
inline |
Change the capacity of the structure and clear all elements.
size | New capacity of the structure. |
Definition at line 77 of file internal_stack_vector_base.h.
|
inline |
Return the number of elements in the data structure.
Definition at line 87 of file internal_stack_vector_base.h.
Referenced by tpie::internal_stack_vector_base< T, internal_stack< T > >::resize().
|
protected |
Element storage.
Definition at line 41 of file internal_stack_vector_base.h.
Referenced by tpie::internal_stack_vector_base< T, internal_stack< T > >::resize().
|
protected |
Number of elements pushed to the structure.
Definition at line 44 of file internal_stack_vector_base.h.
Referenced by tpie::internal_stack_vector_base< T, internal_stack< T > >::clear(), tpie::internal_stack_vector_base< T, internal_stack< T > >::empty(), tpie::internal_stack_vector_base< T, internal_stack< T > >::resize(), and tpie::internal_stack_vector_base< T, internal_stack< T > >::size().