L4Re – L4 Runtime Environment
|
Internal: AVL set with internally managed nodes. More...
Data Structures | |
class | Node |
A smart pointer to a tree item. More... | |
Public Types | |
enum | { E_noent = 2 , E_exist = 17 , E_nomem = 12 , E_inval = 22 } |
Return status constants. More... | |
typedef ITEM_TYPE | Item_type |
Type for the items store in the set. | |
typedef GET_KEY | Get_key |
Key-getter type to derive the sort key of an internal node. | |
typedef GET_KEY::Key_type | Key_type |
Type of the sort key used for the items. | |
typedef Type_traits< Item_type >::Const_type | Const_item_type |
Type used for const items within the set. | |
typedef COMPARE | Item_compare |
Type for the comparison functor. | |
typedef ALLOC< _Node > | Node_allocator |
Type for the node allocator. | |
typedef Avl_set_iter< _Node, Item_type, Fwd > | Iterator |
Forward iterator for the set. | |
typedef Avl_set_iter< _Node, Const_item_type, Fwd > | Const_iterator |
Constant forward iterator for the set. | |
typedef Avl_set_iter< _Node, Item_type, Rev > | Rev_iterator |
Backward iterator for the set. | |
typedef Avl_set_iter< _Node, Const_item_type, Rev > | Const_rev_iterator |
Constant backward iterator for the set. | |
Public Member Functions | |
Base_avl_set (Node_allocator const &alloc=Node_allocator()) | |
Create a AVL-tree based set. More... | |
Base_avl_set (Base_avl_set const &o) | |
Create a copy of an AVL-tree based set. More... | |
cxx::Pair< Iterator, int > | insert (Item_type const &item) |
Insert an item into the set. More... | |
int | remove (Key_type const &item) |
Remove an item from the set. More... | |
int | erase (Key_type const &item) |
Erase the item with the given key. More... | |
Node | find_node (Key_type const &item) const |
Lookup a node equal to item . More... | |
Node | lower_bound_node (Key_type const &key) const |
Find the first node greater or equal to key . More... | |
Const_iterator | begin () const |
Get the constant forward iterator for the first element in the set. More... | |
Const_iterator | end () const |
Get the end marker for the constant forward iterator. More... | |
Iterator | begin () |
Get the mutable forward iterator for the first element of the set. More... | |
Iterator | end () |
Get the end marker for the mutable forward iterator. More... | |
Const_rev_iterator | rbegin () const |
Get the constant backward iterator for the last element in the set. More... | |
Const_rev_iterator | rend () const |
Get the end marker for the constant backward iterator. More... | |
Rev_iterator | rbegin () |
Get the mutable backward iterator for the last element of the set. More... | |
Rev_iterator | rend () |
Get the end marker for the mutable backward iterator. More... | |
Internal: AVL set with internally managed nodes.
Use Avl_set, Avl_map, or Avl_tree in applications.
ITEM_TYPE | The type of the items to be stored in the set. |
COMPARE | The relation to define the partial order, default is to use operator '<'. |
ALLOC | The allocator to use for the nodes of the AVL set. |
GET_KEY | Sort-key getter (must provide the Key_type and sort-key for an item (of ITEM_TYPE ). |
anonymous enum |
Return status constants.
These constants are compatible with the L4 error codes, see l4_error_code_t.
Enumerator | |
---|---|
E_noent | Item does not exist. |
E_exist | Item exists already. |
E_nomem | Memory allocation failed. |
E_inval | Internal error. |
|
inlineexplicit |
|
inline |
Create a copy of an AVL-tree based set.
o | The set to copy. |
Creates a deep copy of the set with all its items.
Definition at line 398 of file avl_set.
References cxx::Bits::Base_avl_set< ITEM_TYPE, COMPARE, ALLOC, GET_KEY >::begin(), cxx::Bits::Base_avl_set< ITEM_TYPE, COMPARE, ALLOC, GET_KEY >::end(), and cxx::Bits::Base_avl_set< ITEM_TYPE, COMPARE, ALLOC, GET_KEY >::insert().
|
inline |
Get the mutable forward iterator for the first element of the set.
Definition at line 359 of file avl_set.
References cxx::Bits::Bst< Node, Get_key, Compare >::begin().
|
inline |
Get the constant forward iterator for the first element in the set.
Definition at line 348 of file avl_set.
References cxx::Bits::Bst< Node, Get_key, Compare >::begin().
Referenced by cxx::Bits::Base_avl_set< ITEM_TYPE, COMPARE, ALLOC, GET_KEY >::Base_avl_set().
|
inline |
Get the end marker for the mutable forward iterator.
Definition at line 364 of file avl_set.
References cxx::Bits::Bst< Node, Get_key, Compare >::end().
|
inline |
Get the end marker for the constant forward iterator.
Definition at line 353 of file avl_set.
References cxx::Bits::Bst< Node, Get_key, Compare >::end().
Referenced by cxx::Bits::Base_avl_set< ITEM_TYPE, COMPARE, ALLOC, GET_KEY >::Base_avl_set().
|
inline |
Erase the item with the given key.
item | The key of the item to remove. |
Definition at line 316 of file avl_set.
References cxx::Bits::Base_avl_set< ITEM_TYPE, COMPARE, ALLOC, GET_KEY >::remove().
|
inline |
Lookup a node equal to item
.
item | The value to search for. |
Definition at line 327 of file avl_set.
References cxx::Bits::Bst< Node, Get_key, Compare >::find_node().
Pair< typename Base_avl_set< Item, Compare, Alloc, KEY_TYPE >::Iterator, int > cxx::Bits::Base_avl_set< Item, Compare, Alloc, KEY_TYPE >::insert | ( | Item_type const & | item | ) |
Insert an item into the set.
item | The item to insert. |
first
) and return value (second
). second
will be 0 if the element was inserted into the set and -#E_exist
if the element was already in the set and the set was therefore not updated. In both cases, first
contains an iterator that points to the element. second
may also be -#E_nomem
when memory for the node could not be allocated. first
is then invalid.Insert a new item into the set, each item can only be once in the set.
Definition at line 408 of file avl_set.
References cxx::Pair< First, Second >::first, cxx::Avl_tree< Node, Get_key, Compare >::insert(), and cxx::Pair< First, Second >::second.
Referenced by cxx::Bits::Base_avl_set< ITEM_TYPE, COMPARE, ALLOC, GET_KEY >::Base_avl_set(), and cxx::Avl_map< KEY_TYPE, DATA_TYPE, COMPARE, ALLOC >::insert().
|
inline |
Find the first node greater or equal to key
.
key | Minimum key to look for. |
key
. Will be invalid if no such element was found. Definition at line 338 of file avl_set.
References cxx::Bits::Bst< Node, Get_key, Compare >::lower_bound_node().
|
inline |
Get the mutable backward iterator for the last element of the set.
Definition at line 381 of file avl_set.
References cxx::Bits::Bst< Node, Get_key, Compare >::rbegin().
|
inline |
Get the constant backward iterator for the last element in the set.
Definition at line 370 of file avl_set.
References cxx::Bits::Bst< Node, Get_key, Compare >::rbegin().
|
inline |
Remove an item from the set.
item | The item to remove. |
0 | Success |
-E_noent | Item does not exist |
-E_inval | Internal error |
Definition at line 296 of file avl_set.
References cxx::Bits::Base_avl_set< ITEM_TYPE, COMPARE, ALLOC, GET_KEY >::E_inval, cxx::Bits::Base_avl_set< ITEM_TYPE, COMPARE, ALLOC, GET_KEY >::E_noent, and cxx::Avl_tree< Node, Get_key, Compare >::remove().
Referenced by cxx::Bits::Base_avl_set< ITEM_TYPE, COMPARE, ALLOC, GET_KEY >::erase().
|
inline |
Get the end marker for the mutable backward iterator.
Definition at line 386 of file avl_set.
References cxx::Bits::Bst< Node, Get_key, Compare >::rend().
|
inline |
Get the end marker for the constant backward iterator.
Definition at line 375 of file avl_set.
References cxx::Bits::Bst< Node, Get_key, Compare >::rend().