Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

ivector< T > Class Template Reference

The base class for specifically sized vectors. More...

#include <vector.h>

Inherits etl::vector_base.

Inherited by vector< T, MAX_SIZE_ >.

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, T value)
 Resizes the vector.
void reserve (size_t)
 Does nothing.
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, parameter_t 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 (parameter_t value)
 Inserts a value at the end of the vector.
template<typename T1 >
void emplace_back (const T1 &value1)
 Constructs a value at the end of the vector.
template<typename T1 , typename T2 >
void emplace_back (const T1 &value1, const T2 &value2)
 Constructs a value at the end of the vector.
template<typename T1 , typename T2 , typename T3 >
void emplace_back (const T1 &value1, const T2 &value2, const T3 &value3)
 Constructs a value at the end of the vector.
template<typename T1 , typename T2 , typename T3 , typename T4 >
void emplace_back (const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4)
 Constructs a value at the end of the vector.
void pop_back ()
 Removes an element from the end of the vector.
iterator insert (iterator position, parameter_t value)
 Inserts a value to the vector.
template<typename T1 >
iterator emplace (iterator position, const T1 &value1)
 Emplaces a value to the vextor at the specified position.
template<typename T1 , typename T2 >
iterator emplace (iterator position, const T1 &value1, const T2 &value2)
 Emplaces a value to the vextor at the specified position.
template<typename T1 , typename T2 , typename T3 >
iterator emplace (iterator position, const T1 &value1, const T2 &value2, const T3 &value3)
 Emplaces a value to the vextor at the specified position.
template<typename T1 , typename T2 , typename T3 , typename T4 >
iterator emplace (iterator position, const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4)
 Emplaces a value to the vextor at the specified position.
void insert (iterator position, size_t n, parameter_t value)
 Inserts 'n' values to the vector.
template<class 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.
ivectoroperator= (const ivector &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.
virtual void repair ()=0
 Fix the internal pointers after a low level memory copy.
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

 ivector (T *p_buffer_, size_t MAX_SIZE)
 Constructor.
void initialise ()
 Initialise the vector.
void repair (T *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

template<typename T>
class etl::ivector< T >

The base class for specifically sized vectors.

Can be used as a reference type for all vectors containing a specific type.

Definition at line 74 of file vector.h.


Constructor & Destructor Documentation

ivector ( T *  p_buffer_,
size_t  MAX_SIZE 
) [protected]

Constructor.

Definition at line 882 of file vector.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.

Definition at line 360 of file vector.h.

void assign ( size_t  n,
parameter_t  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 384 of file vector.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'

Definition at line 292 of file vector.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'

Definition at line 280 of file vector.h.

size_t available (  ) const

Returns the remaining capacity.

Returns:
The remaining capacity.

Definition at line 865 of file vector.h.

reference back (  )

Returns a reference to the last element.

Returns:
A reference to the last element.

Definition at line 320 of file vector.h.

const_reference back (  ) const

Returns a const reference to the last element.

Returns:
A const reference to the last element.

Definition at line 329 of file vector.h.

iterator begin (  )

Returns an iterator to the beginning of the vector.

Returns:
An iterator to the beginning of the vector.

Definition at line 100 of file vector.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.

Definition at line 109 of file vector.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.

Definition at line 136 of file vector.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.

Definition at line 145 of file vector.h.

void clear (  )

Clears the vector.

Definition at line 400 of file vector.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.

Definition at line 190 of file vector.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.

Definition at line 199 of file vector.h.

pointer data (  )

Returns a pointer to the beginning of the vector data.

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

Definition at line 338 of file vector.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.

Definition at line 347 of file vector.h.

iterator emplace ( iterator  position,
const T1 &  value1 
)

Emplaces a value to the vextor at the specified position.

Definition at line 535 of file vector.h.

iterator emplace ( iterator  position,
const T1 &  value1,
const T2 &  value2 
)

Emplaces a value to the vextor at the specified position.

Definition at line 563 of file vector.h.

iterator emplace ( iterator  position,
const T1 &  value1,
const T2 &  value2,
const T3 &  value3 
)

Emplaces a value to the vextor at the specified position.

Definition at line 591 of file vector.h.

iterator emplace ( iterator  position,
const T1 &  value1,
const T2 &  value2,
const T3 &  value3,
const T4 &  value4 
)

Emplaces a value to the vextor at the specified position.

Definition at line 619 of file vector.h.

void emplace_back ( const T1 &  value1,
const T2 &  value2 
)

Constructs 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 453 of file vector.h.

void emplace_back ( const T1 &  value1,
const T2 &  value2,
const T3 &  value3 
)

Constructs 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 469 of file vector.h.

void emplace_back ( const T1 &  value1,
const T2 &  value2,
const T3 &  value3,
const T4 &  value4 
)

Constructs 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 485 of file vector.h.

void emplace_back ( const T1 &  value1 )

Constructs 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 437 of file vector.h.

bool empty (  ) const

Checks the 'empty' state of the vector.

Returns:
true if empty.

Definition at line 847 of file vector.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.

Definition at line 127 of file vector.h.

iterator end (  )

Returns an iterator to the end of the vector.

Returns:
An iterator to the end of the vector.

Definition at line 118 of file vector.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 782 of file vector.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 798 of file vector.h.

reference front (  )

Returns a reference to the first element.

Returns:
A reference to the first element.

Definition at line 302 of file vector.h.

const_reference front (  ) const

Returns a const reference to the first element.

Returns:
A const reference to the first element.

Definition at line 311 of file vector.h.

bool full (  ) const

Checks the 'full' state of the vector.

Returns:
true if full.

Definition at line 856 of file vector.h.

void initialise (  ) [protected]

Initialise the vector.

Definition at line 892 of file vector.h.

iterator insert ( iterator  position,
parameter_t  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 513 of file vector.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 717 of file vector.h.

void insert ( iterator  position,
size_t  n,
parameter_t  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 650 of file vector.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.

ivector& operator= ( const ivector< T > &  rhs )

Assignment operator.

Definition at line 824 of file vector.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'

Definition at line 259 of file vector.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'

Definition at line 269 of file vector.h.

void pop_back (  )

Removes an element from the end of the vector.

Does nothing if the vector is empty.

Definition at line 499 of file vector.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.

Definition at line 409 of file vector.h.

void push_back ( parameter_t  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 423 of file vector.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.

Definition at line 163 of file vector.h.

reverse_iterator rbegin (  )

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

Returns:
Iterator to the reverse beginning of the vector.

Definition at line 154 of file vector.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.

Definition at line 181 of file vector.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.

Definition at line 172 of file vector.h.

void repair ( T *  p_buffer_ ) [protected]

Fix the internal pointers after a low level memory copy.

Definition at line 906 of file vector.h.

void reserve ( size_t   )

Does nothing.

Definition at line 250 of file vector.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.

Definition at line 210 of file vector.h.

void resize ( size_t  new_size,
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 222 of file vector.h.

size_type size (  ) const

Gets the current size of the vector.

Returns:
The current size of the vector.

Definition at line 838 of file vector.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.