Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

multiset< T, MAX_SIZE_, TCompare > Class Template Reference

multiset< T, MAX_SIZE_, TCompare > Class Template Reference

A templated multiset implementation that uses a fixed size buffer. More...

#include <multiset.h>

Inherits etl::imultiset< T, TCompare >.

Public Types

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

Public Member Functions

 multiset ()
 Default constructor.
 multiset (const multiset &other)
 Copy constructor.
template<typename TIterator >
 multiset (TIterator first, TIterator last)
 Constructor, from an iterator range.
 ~multiset ()
 Destructor.
multisetoperator= (const multiset &rhs)
 Assignment operator.
iterator begin ()
 Gets the beginning of the multiset.
const_iterator begin () const
 Gets the beginning of the multiset.
iterator end ()
 Gets the end of the multiset.
const_iterator end () const
 Gets the end of the multiset.
const_iterator cbegin () const
 Gets the beginning of the multiset.
const_iterator cend () const
 Gets the end of the multiset.
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 multiset.
void clear ()
 Clears the multiset.
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 &key)
 Returns two iterators with bounding (lower bound, upper bound) the key provided.
std::pair< const_iterator,
const_iterator
equal_range (const value_type &key) const
 Returns two const iterators with bounding (lower bound, upper bound) the key 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.
iterator insert (const value_type &value)
 Inserts a value to the multiset.
iterator insert (iterator, const value_type &value)
 Inserts a value to the multiset starting at the position recommended.
iterator insert (const_iterator, const value_type &value)
 Inserts a value to the multiset starting at the position recommended.
template<class TIterator >
void insert (TIterator first, TIterator last)
 Inserts a range of values to the multiset.
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.
void initialise ()
 Initialise the multiset.
void attach_node (Node *parent, 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.
void next_node (Node *&position) const
 Find the next node in sequence from the node provided.
void next_node (const Node *&position) const
 Find the next node in sequence from the node provided.
void prev_node (Node *&position) const
 Find the previous node in sequence from the node provided.
void prev_node (const Node *&position) const
 Find the previous node in sequence from the node 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 multiset root.

Detailed Description

template<typename T, const size_t MAX_SIZE_, typename TCompare = std::less<T>>
class etl::multiset< T, MAX_SIZE_, TCompare >

A templated multiset implementation that uses a fixed size buffer.

Definition at line 1871 of file multiset.h.


Member Typedef Documentation

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

Defines the key value parameter type.

Definition at line 659 of file multiset.h.

typedef size_t size_type [inherited]

The type used for determining the size of set.

Reimplemented from multiset_base.

Definition at line 619 of file multiset.h.


Constructor & Destructor Documentation

multiset (  )

Default constructor.

Definition at line 1880 of file multiset.h.

multiset ( const multiset< T, MAX_SIZE_, TCompare > &  other )

Copy constructor.

Definition at line 1889 of file multiset.h.

multiset ( TIterator  first,
TIterator  last 
)

Constructor, from an iterator range.

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

Definition at line 1902 of file multiset.h.

~multiset (  )

Destructor.

Definition at line 1911 of file multiset.h.


Member Function Documentation

void assign ( TIterator  first,
TIterator  last 
) [inherited]

Assigns values to the multiset.

If asserts or exceptions are enabled, emits set_full if the multiset 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 1040 of file multiset.h.

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

Attach the provided node to the position provided.

Definition at line 233 of file multiset.h.

size_t available (  ) const [inherited]

Returns the remaining capacity.

Returns:
The remaining capacity.

Definition at line 174 of file multiset.h.

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

Balance the critical node at the position provided as needed.

Definition at line 284 of file multiset.h.

iterator begin (  ) [inherited]

Gets the beginning of the multiset.

Definition at line 939 of file multiset.h.

const_iterator begin (  ) const [inherited]

Gets the beginning of the multiset.

Definition at line 947 of file multiset.h.

size_type capacity (  ) const [inherited]

Returns the capacity of the vector.

Returns:
The capacity of the vector.

Definition at line 165 of file multiset.h.

const_iterator cbegin (  ) const [inherited]

Gets the beginning of the multiset.

Definition at line 971 of file multiset.h.

const_iterator cend (  ) const [inherited]

Gets the end of the multiset.

Definition at line 979 of file multiset.h.

void clear (  ) [inherited]

Clears the multiset.

Definition at line 1049 of file multiset.h.

size_type count ( key_parameter_t  key ) const [inherited]

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 1059 of file multiset.h.

const_reverse_iterator crbegin (  ) const [inherited]

Gets the reverse beginning of the list.

Definition at line 1019 of file multiset.h.

const_reverse_iterator crend (  ) const [inherited]

Gets the reverse end of the list.

Definition at line 1027 of file multiset.h.

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

Detach the node at the position provided.

Definition at line 251 of file multiset.h.

bool empty (  ) const [inherited]

Checks to see if the set is empty.

Definition at line 148 of file multiset.h.

const_iterator end (  ) const [inherited]

Gets the end of the multiset.

Definition at line 963 of file multiset.h.

iterator end (  ) [inherited]

Gets the end of the multiset.

Definition at line 955 of file multiset.h.

std::pair<iterator, iterator> equal_range ( const value_type &  key ) [inherited]

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

Definition at line 1068 of file multiset.h.

std::pair<const_iterator, const_iterator> equal_range ( const value_type &  key ) const [inherited]

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

Definition at line 1079 of file multiset.h.

void erase ( iterator  position ) [inherited]

Erases the value at the specified position.

Definition at line 1089 of file multiset.h.

iterator erase ( const_iterator  position ) [inherited]

Erases the value at the specified position.

Definition at line 1098 of file multiset.h.

iterator erase ( iterator  first,
iterator  last 
) [inherited]

Erases a range of elements.

Definition at line 1137 of file multiset.h.

iterator erase ( const_iterator  first,
const_iterator  last 
) [inherited]

Erases a range of elements.

Definition at line 1151 of file multiset.h.

iterator find ( key_parameter_t  key_value ) [inherited]

Finds an element.

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

Definition at line 1167 of file multiset.h.

const_iterator find ( key_parameter_t  key_value ) const [inherited]

Finds an element.

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

Definition at line 1177 of file multiset.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 348 of file multiset.h.

bool full (  ) const [inherited]

Checks to see if the set is full.

Definition at line 156 of file multiset.h.

void initialise (  ) [protected, inherited]

Initialise the multiset.

Definition at line 1316 of file multiset.h.

void insert ( TIterator  first,
TIterator  last 
) [inherited]

Inserts a range of values to the multiset.

If asserts or exceptions are enabled, emits set_full if the multiset 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 1236 of file multiset.h.

iterator insert ( const_iterator  ,
const value_type &  value 
) [inherited]

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

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

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

Definition at line 1222 of file multiset.h.

iterator insert ( const value_type &  value ) [inherited]

Inserts a value to the multiset.

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

Parameters:
valueThe value to insert.

Definition at line 1187 of file multiset.h.

iterator insert ( iterator  ,
const value_type &  value 
) [inherited]

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

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

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

Definition at line 1210 of file multiset.h.

iterator lower_bound ( key_parameter_t  key ) [inherited]

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 1250 of file multiset.h.

const_iterator lower_bound ( key_parameter_t  key ) const [inherited]

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 1261 of file multiset.h.

size_type max_size (  ) const [inherited]

Gets the maximum possible size of the set.

Definition at line 140 of file multiset.h.

void next_node ( Node *&  position ) const [protected, inherited]

Find the next node in sequence from the node provided.

Definition at line 364 of file multiset.h.

void next_node ( const Node *&  position ) const [protected, inherited]

Find the next node in sequence from the node provided.

Definition at line 396 of file multiset.h.

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

How to compare node elements.

Definition at line 664 of file multiset.h.

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

Assignment operator.

Definition at line 1919 of file multiset.h.

void prev_node ( const Node *&  position ) const [protected, inherited]

Find the previous node in sequence from the node provided.

Definition at line 466 of file multiset.h.

void prev_node ( Node *&  position ) const [protected, inherited]

Find the previous node in sequence from the node provided.

Definition at line 428 of file multiset.h.

reverse_iterator rbegin (  ) [inherited]

Gets the reverse beginning of the list.

Definition at line 987 of file multiset.h.

const_reverse_iterator rbegin (  ) const [inherited]

Gets the reverse beginning of the list.

Definition at line 995 of file multiset.h.

const_reverse_iterator rend (  ) const [inherited]

Gets the reverse end of the list.

Definition at line 1011 of file multiset.h.

reverse_iterator rend (  ) [inherited]

Gets the reverse end of the list.

Definition at line 1003 of file multiset.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 504 of file multiset.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 545 of file multiset.h.

size_type size (  ) const [inherited]

Gets the size of the set.

Definition at line 132 of file multiset.h.

iterator upper_bound ( key_parameter_t  key ) [inherited]

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 1272 of file multiset.h.

const_iterator upper_bound ( key_parameter_t  key ) const [inherited]

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 1283 of file multiset.h.


Field Documentation

const size_type CAPACITY [protected, inherited]

The maximum size of the set.

Definition at line 599 of file multiset.h.

size_type current_size [protected, inherited]

The number of the used nodes.

Definition at line 598 of file multiset.h.

Node* root_node [protected, inherited]

The node that acts as the multiset root.

Definition at line 600 of file multiset.h.