Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

pvoidvector Class Reference

The base class for void* vectors. More...

#include <pvoidvector.h>

Inherits etl::vector_base.

Inherited by ivector< T * >.

Public Member Functions

iterator begin ()
 Returns an iterator to the beginning of the vector.
const_iterator begin () const
 Returns a const_iterator to the beginning of the vector.
iterator end ()
 Returns an iterator to the end of the vector.
const_iterator end () const
 Returns a const_iterator to the end of the vector.
const_iterator cbegin () const
 Returns a const_iterator to the beginning of the vector.
const_iterator cend () const
 Returns a const_iterator to the end of the vector.
reverse_iterator rbegin ()
 Returns an reverse iterator to the reverse beginning of the vector.
const_reverse_iterator rbegin () const
 Returns a const reverse iterator to the reverse beginning of the vector.
reverse_iterator rend ()
 Returns a reverse iterator to the end + 1 of the vector.
const_reverse_iterator rend () const
 Returns a const reverse iterator to the end + 1 of the vector.
const_reverse_iterator crbegin () const
 Returns a const reverse iterator to the reverse beginning of the vector.
const_reverse_iterator crend () const
 Returns a const reverse iterator to the end + 1 of the vector.
void resize (size_t new_size)
 Resizes the vector.
void resize (size_t new_size, value_type value)
 Resizes the vector.
reference operator[] (size_t i)
 Returns a reference to the value at index 'i'.
const_reference operator[] (size_t i) const
 Returns a const reference to the value at index 'i'.
reference at (size_t i)
 Returns a reference to the value at index 'i' If asserts or exceptions are enabled, emits an etl::vector_out_of_bounds if the index is out of range.
const_reference at (size_t i) const
 Returns a const reference to the value at index 'i' If asserts or exceptions are enabled, emits an etl::vector_out_of_bounds if the index is out of range.
reference front ()
 Returns a reference to the first element.
const_reference front () const
 Returns a const reference to the first element.
reference back ()
 Returns a reference to the last element.
const_reference back () const
 Returns a const reference to the last element.
pointer data ()
 Returns a pointer to the beginning of the vector data.
const_pointer data () const
 Returns a const pointer to the beginning of the vector data.
template<typename TIterator >
void assign (TIterator first, TIterator last)
 Assigns values to the vector.
void assign (size_t n, value_type value)
 Assigns values to the vector.
void clear ()
 Clears the vector.
void push_back ()
 Increases the size of the vector by one, but does not initialise the new element.
void push_back (value_type value)
 Inserts a value at the end of the vector.
void pop_back ()
 Removes an element from the end of the vector.
iterator insert (iterator position, value_type value)
 Inserts a value to the vector.
void insert (iterator position, size_t n, value_type value)
 Inserts 'n' values to the vector.
template<typename TIterator >
void insert (iterator position, TIterator first, TIterator last)
 Inserts a range of values to the vector.
iterator erase (iterator i_element)
 Erases an element.
iterator erase (iterator first, iterator last)
 Erases a range of elements.
pvoidvectoroperator= (const pvoidvector &rhs)
 Assignment operator.
size_type size () const
 Gets the current size of the vector.
bool empty () const
 Checks the 'empty' state of the vector.
bool full () const
 Checks the 'full' state of the vector.
size_t available () const
 Returns the remaining capacity.
size_type capacity () const
 Returns the capacity of the vector.
size_type max_size () const
 Returns the maximum possible size of the vector.

Protected Member Functions

 pvoidvector (void **p_buffer_, size_t MAX_SIZE)
 Constructor.
void initialise ()
 Initialise the vector.
void repair (void **p_buffer_)
 Fix the internal pointers after a low level memory copy.

Protected Attributes

const size_type CAPACITY
 The maximum number of elements in the vector.
etl::debug_count construct_count
 Internal debugging.

Detailed Description

The base class for void* vectors.

Definition at line 61 of file pvoidvector.h.


Constructor & Destructor Documentation

pvoidvector ( void **  p_buffer_,
size_t  MAX_SIZE 
) [protected]

Constructor.

Definition at line 554 of file pvoidvector.h.


Member Function Documentation

void assign ( TIterator  first,
TIterator  last 
)

Assigns values to the vector.

If asserts or exceptions are enabled, emits vector_full if the vector does not have enough free space. If asserts or exceptions are enabled, emits vector_iterator if the iterators are reversed.

Parameters:
firstThe iterator to the first element.
lastThe iterator to the last element + 1.

Reimplemented in ivector< T * >.

Definition at line 328 of file pvoidvector.h.

void assign ( size_t  n,
value_type  value 
)

Assigns values to the vector.

If asserts or exceptions are enabled, emits vector_full if the vector does not have enough free space.

Parameters:
nThe number of elements to add.
valueThe value to insert for each element.

Definition at line 349 of file pvoidvector.h.

const_reference at ( size_t  i ) const

Returns a const reference to the value at index 'i' If asserts or exceptions are enabled, emits an etl::vector_out_of_bounds if the index is out of range.

Parameters:
iThe index.
Returns:
A const reference to the value at index 'i'

Reimplemented in ivector< T * >.

Definition at line 260 of file pvoidvector.h.

reference at ( size_t  i )

Returns a reference to the value at index 'i' If asserts or exceptions are enabled, emits an etl::vector_out_of_bounds if the index is out of range.

Parameters:
iThe index.
Returns:
A reference to the value at index 'i'

Reimplemented in ivector< T * >.

Definition at line 248 of file pvoidvector.h.

size_t available (  ) const

Returns the remaining capacity.

Returns:
The remaining capacity.

Definition at line 544 of file pvoidvector.h.

reference back (  )

Returns a reference to the last element.

Returns:
A reference to the last element.

Reimplemented in ivector< T * >.

Definition at line 288 of file pvoidvector.h.

const_reference back (  ) const

Returns a const reference to the last element.

Returns:
A const reference to the last element.

Reimplemented in ivector< T * >.

Definition at line 297 of file pvoidvector.h.

iterator begin (  )

Returns an iterator to the beginning of the vector.

Returns:
An iterator to the beginning of the vector.

Reimplemented in ivector< T * >.

Definition at line 83 of file pvoidvector.h.

const_iterator begin (  ) const

Returns a const_iterator to the beginning of the vector.

Returns:
A const iterator to the beginning of the vector.

Reimplemented in ivector< T * >.

Definition at line 92 of file pvoidvector.h.

size_type capacity (  ) const [inherited]

Returns the capacity of the vector.

Returns:
The capacity of the vector.

Definition at line 133 of file vector_base.h.

const_iterator cbegin (  ) const

Returns a const_iterator to the beginning of the vector.

Returns:
A const iterator to the beginning of the vector.

Reimplemented in ivector< T * >.

Definition at line 119 of file pvoidvector.h.

const_iterator cend (  ) const

Returns a const_iterator to the end of the vector.

Returns:
A const iterator to the end of the vector.

Reimplemented in ivector< T * >.

Definition at line 128 of file pvoidvector.h.

void clear (  )

Clears the vector.

Reimplemented in ivector< T * >.

Definition at line 364 of file pvoidvector.h.

const_reverse_iterator crbegin (  ) const

Returns a const reverse iterator to the reverse beginning of the vector.

Returns:
Const reverse iterator to the reverse beginning of the vector.

Reimplemented in ivector< T * >.

Definition at line 173 of file pvoidvector.h.

const_reverse_iterator crend (  ) const

Returns a const reverse iterator to the end + 1 of the vector.

Returns:
Const reverse iterator to the end + 1 of the vector.

Reimplemented in ivector< T * >.

Definition at line 182 of file pvoidvector.h.

pointer data (  )

Returns a pointer to the beginning of the vector data.

Returns:
A pointer to the beginning of the vector data.

Reimplemented in ivector< T * >.

Definition at line 306 of file pvoidvector.h.

const_pointer data (  ) const

Returns a const pointer to the beginning of the vector data.

Returns:
A const pointer to the beginning of the vector data.

Reimplemented in ivector< T * >.

Definition at line 315 of file pvoidvector.h.

bool empty (  ) const

Checks the 'empty' state of the vector.

Returns:
true if empty.

Definition at line 526 of file pvoidvector.h.

const_iterator end (  ) const

Returns a const_iterator to the end of the vector.

Returns:
A const iterator to the end of the vector.

Reimplemented in ivector< T * >.

Definition at line 110 of file pvoidvector.h.

iterator end (  )

Returns an iterator to the end of the vector.

Returns:
An iterator to the end of the vector.

Reimplemented in ivector< T * >.

Definition at line 101 of file pvoidvector.h.

iterator erase ( iterator  i_element )

Erases an element.

Parameters:
i_elementIterator to the element.
Returns:
An iterator pointing to the element that followed the erased element.

Definition at line 473 of file pvoidvector.h.

iterator erase ( iterator  first,
iterator  last 
)

Erases a range of elements.

The range includes all the elements between first and last, including the element pointed by first, but not the one pointed by last.

Parameters:
firstIterator to the first element.
lastIterator to the last element.
Returns:
An iterator pointing to the element that followed the erased element.

Definition at line 489 of file pvoidvector.h.

reference front (  )

Returns a reference to the first element.

Returns:
A reference to the first element.

Reimplemented in ivector< T * >.

Definition at line 270 of file pvoidvector.h.

const_reference front (  ) const

Returns a const reference to the first element.

Returns:
A const reference to the first element.

Reimplemented in ivector< T * >.

Definition at line 279 of file pvoidvector.h.

bool full (  ) const

Checks the 'full' state of the vector.

Returns:
true if full.

Definition at line 535 of file pvoidvector.h.

void initialise (  ) [protected]

Initialise the vector.

Definition at line 564 of file pvoidvector.h.

void insert ( iterator  position,
size_t  n,
value_type  value 
)

Inserts 'n' values to the vector.

If asserts or exceptions are enabled, emits vector_full if the vector does not have enough free space.

Parameters:
positionThe position to insert before.
nThe number of elements to add.
valueThe value to insert.

Definition at line 438 of file pvoidvector.h.

void insert ( iterator  position,
TIterator  first,
TIterator  last 
)

Inserts a range of values to the vector.

If asserts or exceptions are enabled, emits vector_full if the vector does not have enough free space. For fundamental and pointer types.

Parameters:
positionThe position to insert before.
firstThe first element to add.
lastThe last + 1 element to add.

Definition at line 457 of file pvoidvector.h.

iterator insert ( iterator  position,
value_type  value 
)

Inserts a value to the vector.

If asserts or exceptions are enabled, emits vector_full if the vector is already full.

Parameters:
positionThe position to insert before.
valueThe value to insert.

Definition at line 413 of file pvoidvector.h.

size_type max_size (  ) const [inherited]

Returns the maximum possible size of the vector.

Returns:
The maximum size of the vector.

Definition at line 142 of file vector_base.h.

pvoidvector& operator= ( const pvoidvector rhs )

Assignment operator.

Definition at line 503 of file pvoidvector.h.

const_reference operator[] ( size_t  i ) const

Returns a const reference to the value at index 'i'.

Parameters:
iThe index.
Returns:
A const reference to the value at index 'i'

Reimplemented in ivector< T * >.

Definition at line 237 of file pvoidvector.h.

reference operator[] ( size_t  i )

Returns a reference to the value at index 'i'.

Parameters:
iThe index.
Returns:
A reference to the value at index 'i'

Reimplemented in ivector< T * >.

Definition at line 227 of file pvoidvector.h.

void pop_back (  )

Removes an element from the end of the vector.

Does nothing if the vector is empty.

Reimplemented in ivector< T * >.

Definition at line 399 of file pvoidvector.h.

void push_back ( value_type  value )

Inserts a value at the end of the vector.

If asserts or exceptions are enabled, emits vector_full if the vector is already full.

Parameters:
valueThe value to add.

Definition at line 387 of file pvoidvector.h.

void push_back (  )

Increases the size of the vector by one, but does not initialise the new element.

If asserts or exceptions are enabled, throws a vector_full if the vector is already full.

Reimplemented in ivector< T * >.

Definition at line 373 of file pvoidvector.h.

reverse_iterator rbegin (  )

Returns an reverse iterator to the reverse beginning of the vector.

Returns:
Iterator to the reverse beginning of the vector.

Reimplemented in ivector< T * >.

Definition at line 137 of file pvoidvector.h.

const_reverse_iterator rbegin (  ) const

Returns a const reverse iterator to the reverse beginning of the vector.

Returns:
Const iterator to the reverse beginning of the vector.

Reimplemented in ivector< T * >.

Definition at line 146 of file pvoidvector.h.

const_reverse_iterator rend (  ) const

Returns a const reverse iterator to the end + 1 of the vector.

Returns:
Const reverse iterator to the end + 1 of the vector.

Reimplemented in ivector< T * >.

Definition at line 164 of file pvoidvector.h.

reverse_iterator rend (  )

Returns a reverse iterator to the end + 1 of the vector.

Returns:
Reverse iterator to the end + 1 of the vector.

Reimplemented in ivector< T * >.

Definition at line 155 of file pvoidvector.h.

void repair ( void **  p_buffer_ ) [protected]

Fix the internal pointers after a low level memory copy.

Definition at line 572 of file pvoidvector.h.

void resize ( size_t  new_size,
value_type  value 
)

Resizes the vector.

If asserts or exceptions are enabled and the new size is larger than the maximum then a vector_full is thrown.

Parameters:
new_sizeThe new size.
valueThe value to fill new elements with. Default = default constructed value.

Definition at line 207 of file pvoidvector.h.

void resize ( size_t  new_size )

Resizes the vector.

If asserts or exceptions are enabled and the new size is larger than the maximum then a vector_full is thrown.

Parameters:
new_sizeThe new size.

Reimplemented in ivector< T * >.

Definition at line 193 of file pvoidvector.h.

size_type size (  ) const

Gets the current size of the vector.

Returns:
The current size of the vector.

Definition at line 517 of file pvoidvector.h.


Field Documentation

const size_type CAPACITY [protected, inherited]

The maximum number of elements in the vector.

Definition at line 157 of file vector_base.h.

etl::debug_count construct_count [protected, inherited]

Internal debugging.

Definition at line 158 of file vector_base.h.