Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

iset< T, TCompare > Class Template Reference

A templated base for all etl::set types. More...

#include <set.h>

Inherits etl::set_base.

Inherited by set< T, MAX_SIZE_, TCompare >.

Data Structures

class  const_iterator
 const_iterator More...
struct  Data_Node
 The data node element in the set. More...
class  iterator
 iterator. More...
struct  key_comp
 How to compare two key elements. More...
struct  value_comp
 How to compare two value elements. More...

Public Types

typedef size_t size_type
 The type used for determining the size of set.

Public Member Functions

isetoperator= (const iset &rhs)
 Assignment operator.
iterator begin ()
 Gets the beginning of the set.
const_iterator begin () const
 Gets the beginning of the set.
iterator end ()
 Gets the end of the set.
const_iterator end () const
 Gets the end of the set.
const_iterator cbegin () const
 Gets the beginning of the set.
const_iterator cend () const
 Gets the end of the set.
reverse_iterator rbegin ()
 Gets the reverse beginning of the list.
const_reverse_iterator rbegin () const
 Gets the reverse beginning of the list.
reverse_iterator rend ()
 Gets the reverse end of the list.
const_reverse_iterator rend () const
 Gets the reverse end of the list.
const_reverse_iterator crbegin () const
 Gets the reverse beginning of the list.
const_reverse_iterator crend () const
 Gets the reverse end of the list.
template<typename TIterator >
void assign (TIterator first, TIterator last)
 Assigns values to the set.
void clear ()
 Clears the set.
size_type count (key_parameter_t key) const
 Counts the number of elements that contain the key specified.
std::pair< iterator, iteratorequal_range (const value_type &value)
 Returns two iterators with bounding (lower bound, upper bound) the value provided.
std::pair< const_iterator,
const_iterator
equal_range (const value_type &value) const
 Returns two const iterators with bounding (lower bound, upper bound) the value provided.
void erase (iterator position)
 Erases the value at the specified position.
iterator erase (const_iterator position)
 Erases the value at the specified position.
iterator erase (iterator first, iterator last)
 Erases a range of elements.
iterator erase (const_iterator first, const_iterator last)
 Erases a range of elements.
iterator find (key_parameter_t key_value)
 Finds an element.
const_iterator find (key_parameter_t key_value) const
 Finds an element.
std::pair< iterator, bool > insert (value_type &value)
 Inserts a value to the set.
iterator insert (iterator, value_type &value)
 Inserts a value to the set starting at the position recommended.
iterator insert (const_iterator, value_type &value)
 Inserts a value to the set starting at the position recommended.
template<class TIterator >
void insert (TIterator first, TIterator last)
 Inserts a range of values to the set.
iterator lower_bound (key_parameter_t key)
 Returns an iterator pointing to the first element in the container whose key is not considered to go before the key provided or end() if all keys are considered to go before the key provided.
const_iterator lower_bound (key_parameter_t key) const
 Returns a const_iterator pointing to the first element in the container whose key is not considered to go before the key provided or end() if all keys are considered to go before the key provided.
iterator upper_bound (key_parameter_t key)
 Returns an iterator pointing to the first element in the container whose key is not considered to go after the key provided or end() if all keys are considered to go after the key provided.
const_iterator upper_bound (key_parameter_t key) const
 Returns a const_iterator pointing to the first element in the container whose key is not considered to go after the key provided or end() if all keys are considered to go after the key provided.
size_type size () const
 Gets the size of the set.
size_type max_size () const
 Gets the maximum possible size of the set.
bool empty () const
 Checks to see if the set is empty.
bool full () const
 Checks to see if the set is full.
size_type capacity () const
 Returns the capacity of the vector.
size_t available () const
 Returns the remaining capacity.

Protected Types

typedef etl::parameter_type< T >
::type 
key_parameter_t
 Defines the key value parameter type.

Protected Member Functions

bool node_comp (const Data_Node &node1, const Data_Node &node2) const
 How to compare node elements.
 iset (etl::ipool &node_pool, size_t max_size_)
 Constructor.
void initialise ()
 Initialise the set.
void attach_node (Node *&position, Node &node)
 Attach the provided node to the position provided.
void detach_node (Node *&position, Node *&replacement)
 Detach the node at the position provided.
void balance_node (Node *&critical_node)
 Balance the critical node at the position provided as needed.
Nodefind_limit_node (Node *position, const int8_t dir) const
 Find the node whose key would go before all the other keys from the position provided.
const Nodefind_limit_node (const Node *position, const int8_t dir) const
 Find the node whose key would go before all the other keys from the position provided.
void rotate_2node (Node *&position, uint_least8_t dir)
 Rotate two nodes at the position provided the to balance the tree.
void rotate_3node (Node *&position, uint_least8_t dir, uint_least8_t third)
 Rotate three nodes at the position provided the to balance the tree.

Protected Attributes

size_type current_size
 The number of the used nodes.
const size_type CAPACITY
 The maximum size of the set.
Noderoot_node
 The node that acts as the set root.

Detailed Description

template<typename T, typename TCompare>
class etl::iset< T, TCompare >

A templated base for all etl::set types.

Definition at line 447 of file set.h.


Member Typedef Documentation

typedef etl::parameter_type<T>::type key_parameter_t [protected]

Defines the key value parameter type.

Definition at line 497 of file set.h.

typedef size_t size_type

The type used for determining the size of set.

Reimplemented from set_base.

Definition at line 457 of file set.h.


Constructor & Destructor Documentation

iset ( etl::ipool &  node_pool,
size_t  max_size_ 
) [protected]

Constructor.

Definition at line 1155 of file set.h.


Member Function Documentation

void assign ( TIterator  first,
TIterator  last 
)

Assigns values to the set.

If asserts or exceptions are enabled, emits set_full if the set does not have enough free space. If asserts or exceptions are enabled, emits set_iterator if the iterators are reversed.

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

Definition at line 893 of file set.h.

void attach_node ( Node *&  position,
Node node 
) [protected, inherited]

Attach the provided node to the position provided.

Definition at line 233 of file set.h.

size_t available (  ) const [inherited]

Returns the remaining capacity.

Returns:
The remaining capacity.

Definition at line 175 of file set.h.

void balance_node ( Node *&  critical_node ) [protected, inherited]

Balance the critical node at the position provided as needed.

Definition at line 272 of file set.h.

iterator begin (  )

Gets the beginning of the set.

Definition at line 792 of file set.h.

const_iterator begin (  ) const

Gets the beginning of the set.

Definition at line 800 of file set.h.

size_type capacity (  ) const [inherited]

Returns the capacity of the vector.

Returns:
The capacity of the vector.

Definition at line 166 of file set.h.

const_iterator cbegin (  ) const

Gets the beginning of the set.

Definition at line 824 of file set.h.

const_iterator cend (  ) const

Gets the end of the set.

Definition at line 832 of file set.h.

void clear (  )

Clears the set.

Definition at line 902 of file set.h.

size_type count ( key_parameter_t  key ) const

Counts the number of elements that contain the key specified.

Parameters:
keyThe key to search for.
Returns:
1 if element was found, 0 otherwise.

Definition at line 912 of file set.h.

const_reverse_iterator crbegin (  ) const

Gets the reverse beginning of the list.

Definition at line 872 of file set.h.

const_reverse_iterator crend (  ) const

Gets the reverse end of the list.

Definition at line 880 of file set.h.

void detach_node ( Node *&  position,
Node *&  replacement 
) [protected, inherited]

Detach the node at the position provided.

Definition at line 248 of file set.h.

bool empty (  ) const [inherited]

Checks to see if the set is empty.

Definition at line 149 of file set.h.

const_iterator end (  ) const

Gets the end of the set.

Definition at line 816 of file set.h.

iterator end (  )

Gets the end of the set.

Definition at line 808 of file set.h.

std::pair<iterator, iterator> equal_range ( const value_type &  value )

Returns two iterators with bounding (lower bound, upper bound) the value provided.

Definition at line 921 of file set.h.

std::pair<const_iterator, const_iterator> equal_range ( const value_type &  value ) const

Returns two const iterators with bounding (lower bound, upper bound) the value provided.

Definition at line 932 of file set.h.

void erase ( iterator  position )

Erases the value at the specified position.

Definition at line 942 of file set.h.

iterator erase ( const_iterator  position )

Erases the value at the specified position.

Definition at line 951 of file set.h.

iterator erase ( iterator  first,
iterator  last 
)

Erases a range of elements.

Definition at line 975 of file set.h.

iterator erase ( const_iterator  first,
const_iterator  last 
)

Erases a range of elements.

Definition at line 989 of file set.h.

iterator find ( key_parameter_t  key_value )

Finds an element.

Parameters:
keyThe key to search for.
Returns:
An iterator pointing to the element or end() if not found.

Definition at line 1005 of file set.h.

const_iterator find ( key_parameter_t  key_value ) const

Finds an element.

Parameters:
keyThe key to search for.
Returns:
An iterator pointing to the element or end() if not found.

Definition at line 1015 of file set.h.

Node* find_limit_node ( Node position,
const int8_t  dir 
) const [protected, inherited]

Find the node whose key would go before all the other keys from the position provided.

Definition at line 336 of file set.h.

const Node* find_limit_node ( const Node position,
const int8_t  dir 
) const [protected, inherited]

Find the node whose key would go before all the other keys from the position provided.

Definition at line 353 of file set.h.

bool full (  ) const [inherited]

Checks to see if the set is full.

Definition at line 157 of file set.h.

void initialise (  ) [protected]

Initialise the set.

Definition at line 1164 of file set.h.

iterator insert ( const_iterator  ,
value_type &  value 
)

Inserts a value to the set starting at the position recommended.

If asserts or exceptions are enabled, emits set_full if the set is already full.

Parameters:
positionThe position that would precede the value to insert.
valueThe value to insert.

Definition at line 1073 of file set.h.

void insert ( TIterator  first,
TIterator  last 
)

Inserts a range of values to the set.

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

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

Definition at line 1098 of file set.h.

std::pair<iterator, bool> insert ( value_type &  value )

Inserts a value to the set.

If asserts or exceptions are enabled, emits set_full if the set is already full.

Parameters:
valueThe value to insert.

Definition at line 1025 of file set.h.

iterator insert ( iterator  ,
value_type &  value 
)

Inserts a value to the set starting at the position recommended.

If asserts or exceptions are enabled, emits set_full if the set is already full.

Parameters:
positionThe position that would precede the value to insert.
valueThe value to insert.

Definition at line 1050 of file set.h.

const_iterator lower_bound ( key_parameter_t  key ) const

Returns a const_iterator pointing to the first element in the container whose key is not considered to go before the key provided or end() if all keys are considered to go before the key provided.

Returns:
An const_iterator pointing to the element not before key or end()

Definition at line 1123 of file set.h.

iterator lower_bound ( key_parameter_t  key )

Returns an iterator pointing to the first element in the container whose key is not considered to go before the key provided or end() if all keys are considered to go before the key provided.

Returns:
An iterator pointing to the element not before key or end()

Definition at line 1112 of file set.h.

size_type max_size (  ) const [inherited]

Gets the maximum possible size of the set.

Definition at line 141 of file set.h.

bool node_comp ( const Data_Node node1,
const Data_Node node2 
) const [protected]

How to compare node elements.

Definition at line 502 of file set.h.

iset& operator= ( const iset< T, TCompare > &  rhs )

Assignment operator.

Definition at line 779 of file set.h.

const_reverse_iterator rbegin (  ) const

Gets the reverse beginning of the list.

Definition at line 848 of file set.h.

reverse_iterator rbegin (  )

Gets the reverse beginning of the list.

Definition at line 840 of file set.h.

reverse_iterator rend (  )

Gets the reverse end of the list.

Definition at line 856 of file set.h.

const_reverse_iterator rend (  ) const

Gets the reverse end of the list.

Definition at line 864 of file set.h.

void rotate_2node ( Node *&  position,
uint_least8_t  dir 
) [protected, inherited]

Rotate two nodes at the position provided the to balance the tree.

Definition at line 369 of file set.h.

void rotate_3node ( Node *&  position,
uint_least8_t  dir,
uint_least8_t  third 
) [protected, inherited]

Rotate three nodes at the position provided the to balance the tree.

Definition at line 399 of file set.h.

size_type size (  ) const [inherited]

Gets the size of the set.

Definition at line 133 of file set.h.

iterator upper_bound ( key_parameter_t  key )

Returns an iterator pointing to the first element in the container whose key is not considered to go after the key provided or end() if all keys are considered to go after the key provided.

Returns:
An iterator pointing to the element after key or end()

Definition at line 1134 of file set.h.

const_iterator upper_bound ( key_parameter_t  key ) const

Returns a const_iterator pointing to the first element in the container whose key is not considered to go after the key provided or end() if all keys are considered to go after the key provided.

Returns:
An const_iterator pointing to the element after key or end()

Definition at line 1145 of file set.h.


Field Documentation

const size_type CAPACITY [protected, inherited]

The maximum size of the set.

Definition at line 437 of file set.h.

size_type current_size [protected, inherited]

The number of the used nodes.

Definition at line 436 of file set.h.

Node* root_node [protected, inherited]

The node that acts as the set root.

Definition at line 438 of file set.h.