DGtal
1.5.beta
|
Aim: Represents a mixed list/array structure which is useful in some context. It is essentially a list of blocks. More...
#include <DGtal/base/IndexedListWithBlocks.h>
Data Structures | |
struct | AnyBlock |
union | BlockPointer |
Forward declaration. More... | |
class | ConstIterator |
struct | FirstBlock |
class | Iterator |
union | ValueOrBlockPointer |
Used in blocks to finish it or to point to the next block. More... | |
Public Types | |
typedef TValue | Value |
typedef std::ptrdiff_t | DifferenceType |
typedef std::size_t | SizeType |
typedef Value & | Reference |
typedef Value * | Pointer |
typedef const Value & | ConstReference |
typedef const Value * | ConstPointer |
typedef Value | value_type |
typedef DifferenceType | difference_type |
typedef Reference | reference |
typedef Pointer | pointer |
typedef ConstReference | const_reference |
typedef ConstPointer | const_pointer |
typedef SizeType | size_type |
typedef Iterator | iterator |
typedef ConstIterator | const_iterator |
Public Member Functions | |
IndexedListWithBlocks () | |
IndexedListWithBlocks (const IndexedListWithBlocks &other) | |
IndexedListWithBlocks & | operator= (const IndexedListWithBlocks &other) |
~IndexedListWithBlocks () | |
SizeType | size () const |
bool | empty () const |
SizeType | max_size () const |
SizeType | capacity () const |
void | clear () |
Value & | operator[] (unsigned int idx) |
const Value & | operator[] (unsigned int idx) const |
void | insert (unsigned int idx, const Value &value) |
void | erase (unsigned int idx) |
Iterator | begin () |
Iterator | end () |
ConstIterator | begin () const |
ConstIterator | end () const |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
Private Member Functions | |
BOOST_STATIC_ASSERT (N >=1) | |
BOOST_STATIC_ASSERT (M >=2) | |
Private Attributes | |
FirstBlock | myFirstBlock |
Aim: Represents a mixed list/array structure which is useful in some context. It is essentially a list of blocks.
Description of template class 'IndexedListWithBlocks'
if less than 3 values and N = 2 +------+------+------+------+------+ | size | V[0] | V[1] | ... | 0 | +------+------+------+------+------+ if only 3 values and N = 2 +------+------+------+------+------+ | size | V[0] | V[1] | V[2] | V[3] | +------+------+------+------+------+ if more than 3 values and N = 2, M = 4 +------+------+------+------+------+ +------+------+------+------+------+ | size | V[0] | V[1] | V[2] | ptr --------> | V[3] | V[4] | V[5] | V[6] | ptr --------> ... +------+------+------+------+------+ +------+------+------+------+------+
Such a structure is useful when:
TValue | the type for the values stored in the list. |
N | the number of value stored in the first block. |
M | the number of value stored in the further blocks. |
NB: In the following, we use the notations
Definition at line 93 of file IndexedListWithBlocks.h.
typedef ConstIterator DGtal::IndexedListWithBlocks< TValue, N, M >::const_iterator |
Definition at line 119 of file IndexedListWithBlocks.h.
typedef ConstPointer DGtal::IndexedListWithBlocks< TValue, N, M >::const_pointer |
Definition at line 116 of file IndexedListWithBlocks.h.
typedef ConstReference DGtal::IndexedListWithBlocks< TValue, N, M >::const_reference |
Definition at line 115 of file IndexedListWithBlocks.h.
typedef const Value* DGtal::IndexedListWithBlocks< TValue, N, M >::ConstPointer |
Definition at line 105 of file IndexedListWithBlocks.h.
typedef const Value& DGtal::IndexedListWithBlocks< TValue, N, M >::ConstReference |
Definition at line 104 of file IndexedListWithBlocks.h.
typedef DifferenceType DGtal::IndexedListWithBlocks< TValue, N, M >::difference_type |
Definition at line 112 of file IndexedListWithBlocks.h.
typedef std::ptrdiff_t DGtal::IndexedListWithBlocks< TValue, N, M >::DifferenceType |
Definition at line 100 of file IndexedListWithBlocks.h.
typedef Iterator DGtal::IndexedListWithBlocks< TValue, N, M >::iterator |
Definition at line 118 of file IndexedListWithBlocks.h.
typedef Value* DGtal::IndexedListWithBlocks< TValue, N, M >::Pointer |
Definition at line 103 of file IndexedListWithBlocks.h.
typedef Pointer DGtal::IndexedListWithBlocks< TValue, N, M >::pointer |
Definition at line 114 of file IndexedListWithBlocks.h.
typedef Value& DGtal::IndexedListWithBlocks< TValue, N, M >::Reference |
Definition at line 102 of file IndexedListWithBlocks.h.
typedef Reference DGtal::IndexedListWithBlocks< TValue, N, M >::reference |
Definition at line 113 of file IndexedListWithBlocks.h.
typedef SizeType DGtal::IndexedListWithBlocks< TValue, N, M >::size_type |
Definition at line 117 of file IndexedListWithBlocks.h.
typedef std::size_t DGtal::IndexedListWithBlocks< TValue, N, M >::SizeType |
Definition at line 101 of file IndexedListWithBlocks.h.
typedef TValue DGtal::IndexedListWithBlocks< TValue, N, M >::Value |
Definition at line 99 of file IndexedListWithBlocks.h.
typedef Value DGtal::IndexedListWithBlocks< TValue, N, M >::value_type |
Definition at line 111 of file IndexedListWithBlocks.h.
DGtal::IndexedListWithBlocks< TValue, N, M >::IndexedListWithBlocks | ( | ) |
Constructor.
DGtal::IndexedListWithBlocks< TValue, N, M >::IndexedListWithBlocks | ( | const IndexedListWithBlocks< TValue, N, M > & | other | ) |
Copy constructor.
other | the object to clone. |
DGtal::IndexedListWithBlocks< TValue, N, M >::~IndexedListWithBlocks | ( | ) |
Destructor.
Iterator DGtal::IndexedListWithBlocks< TValue, N, M >::begin | ( | ) |
ConstIterator DGtal::IndexedListWithBlocks< TValue, N, M >::begin | ( | ) | const |
|
private |
|
private |
SizeType DGtal::IndexedListWithBlocks< TValue, N, M >::capacity | ( | ) | const |
The number of values currently allocated in the structure.
void DGtal::IndexedListWithBlocks< TValue, N, M >::clear | ( | ) |
Removes all the values stored in the structure. O(b) complexity.
bool DGtal::IndexedListWithBlocks< TValue, N, M >::empty | ( | ) | const |
Iterator DGtal::IndexedListWithBlocks< TValue, N, M >::end | ( | ) |
ConstIterator DGtal::IndexedListWithBlocks< TValue, N, M >::end | ( | ) | const |
void DGtal::IndexedListWithBlocks< TValue, N, M >::erase | ( | unsigned int | idx | ) |
Removal of a value at a given position. Following values are shifted.
idx | the index of the value in the container. |
void DGtal::IndexedListWithBlocks< TValue, N, M >::insert | ( | unsigned int | idx, |
const Value & | value | ||
) |
bool DGtal::IndexedListWithBlocks< TValue, N, M >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
SizeType DGtal::IndexedListWithBlocks< TValue, N, M >::max_size | ( | ) | const |
The maximum number of values storable in the structure.
IndexedListWithBlocks& DGtal::IndexedListWithBlocks< TValue, N, M >::operator= | ( | const IndexedListWithBlocks< TValue, N, M > & | other | ) |
Assignment.
other | the object to copy. |
Value& DGtal::IndexedListWithBlocks< TValue, N, M >::operator[] | ( | unsigned int | idx | ) |
Random unprotected read-write access to value at position idx
idx | the index of the value in the container. |
const Value& DGtal::IndexedListWithBlocks< TValue, N, M >::operator[] | ( | unsigned int | idx | ) | const |
Random unprotected read access to value at position idx
idx | the index of the value in the container. |
void DGtal::IndexedListWithBlocks< TValue, N, M >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
SizeType DGtal::IndexedListWithBlocks< TValue, N, M >::size | ( | ) | const |
The number of values stored in the structure. O(1) complexity.
|
private |
Stores the first block of values.
Definition at line 700 of file IndexedListWithBlocks.h.