|
cds
2.3.3
|
Split-ordered list set (template specialization for gc::nogc)
More...
#include <cds/container/split_list_set_nogc.h>
Public Types | |
| typedef cds::gc::nogc | gc |
| Garbage collector. | |
| typedef T | value_type |
| type of value to be stored in the list | |
| typedef Traits | traits |
| List traits. | |
| typedef maker::ordered_list | ordered_list |
| Underlying ordered list class. | |
| typedef base_class::key_comparator | key_comparator |
| key comparison functor | |
| typedef base_class::hash | hash |
| Hash functor for value_type and all its derivatives that you use. | |
| typedef base_class::item_counter | item_counter |
| Item counter type. | |
| typedef base_class::stat | stat |
| Internal statistics. | |
Public Member Functions | |
| SplitListSet () | |
| Initialize split-ordered list of default capacity. More... | |
| SplitListSet (size_t nItemCount, size_t nLoadFactor=1) | |
| Initialize split-ordered list. More... | |
| template<typename Q > | |
| iterator | insert (const Q &val) |
| Inserts new node. More... | |
| template<typename... Args> | |
| iterator | emplace (Args &&...args) |
Inserts data of type value_type created from args. More... | |
| template<typename Q > | |
| std::pair< iterator, bool > | update (Q const &key, bool bAllowInsert=true) |
| Updates the item. More... | |
| template<typename Q > | |
| iterator | contains (Q const &key) |
Checks whether the set contains key. More... | |
| template<typename Q , typename Less > | |
| iterator | contains (Q const &key, Less pred) |
Checks whether the set contains key using pred predicate for searching. More... | |
| void | clear () |
| Clears the set (not atomic, for debugging purposes only) | |
| bool | empty () const |
| Checks if the set is empty. More... | |
| size_t | size () const |
| Returns item count in the set. | |
| stat const & | statistics () const |
| Returns internal statistics. | |
| ordered_list::stat const & | list_statistics () const |
Returns internal statistics for ordered_list. | |
Forward iterators | |
| typedef iterator_type< false > | iterator |
| Forward iterator. More... | |
| typedef iterator_type< true > | const_iterator |
| Const forward iterator. | |
| iterator | begin () |
| Returns a forward iterator addressing the first element in a set. More... | |
| iterator | end () |
| Returns an iterator that addresses the location succeeding the last element in a set. More... | |
| const_iterator | begin () const |
| Returns a forward const iterator addressing the first element in a set. | |
| const_iterator | cbegin () const |
| Returns a forward const iterator addressing the first element in a set. | |
| const_iterator | end () const |
| Returns an const iterator that addresses the location succeeding the last element in a set. | |
| const_iterator | cend () const |
| Returns an const iterator that addresses the location succeeding the last element in a set. | |
Additional Inherited Members | |
Protected Types inherited from cds::intrusive::SplitListSet< cds::gc::nogc, Traits::ordered_list, Traits > | |
| typedef cds::gc::nogc | gc |
| Garbage collector. | |
| typedef Traits | traits |
| Set traits. | |
| typedef Traits::ordered_list | ordered_list |
| type of ordered list used as a base for split-list | |
| typedef ordered_list::value_type | value_type |
| type of value stored in the split-list | |
| typedef ordered_list::key_comparator | key_comparator |
| key comparison functor | |
| typedef ordered_list::disposer | disposer |
| Node disposer functor. | |
| typedef cds::opt::v::hash_selector< typename traits::hash >::type | hash |
Hash functor for value_type and all its derivatives you use. | |
| typedef traits::bit_reversal | bit_reversal |
Bit reversal algorithm, see split_list::traits::bit_reversal. | |
| typedef traits::item_counter | item_counter |
| Item counter type. | |
| typedef traits::back_off | back_off |
| back-off strategy for spinning | |
| typedef traits::memory_model | memory_model |
Memory ordering. See cds::opt::memory_model option. | |
| typedef traits::stat | stat |
Internal statistics, see spit_list::stat. | |
| typedef ordered_list::guarded_ptr | guarded_ptr |
| Guarded pointer. | |
| typedef iterator_type< false > | iterator |
| Forward iterator. More... | |
| typedef iterator_type< true > | const_iterator |
| Const forward iterator. More... | |
Protected Member Functions inherited from cds::intrusive::SplitListSet< cds::gc::nogc, Traits::ordered_list, Traits > | |
| SplitListSet () | |
| Initialize split-ordered list of default capacity. More... | |
| SplitListSet (size_t nItemCount, size_t nLoadFactor=1) | |
| Initialize split-ordered list. More... | |
| ~SplitListSet () | |
| Destroys split-list set. | |
| bool | insert (value_type &val) |
| Inserts new node. More... | |
| bool | insert (value_type &val, Func f) |
| Inserts new node. More... | |
| std::pair< bool, bool > | update (value_type &val, Func func, bool bAllowInsert=true) |
| Updates the node. More... | |
| std::pair< bool, bool > | upsert (value_type &val, bool bAllowInsert=true) |
Inserts or updates the node (only for IterableList) More... | |
| bool | unlink (value_type &val) |
Unlinks the item val from the set. More... | |
| bool | erase (Q const &key) |
| Deletes the item from the set. More... | |
| bool | erase (Q const &key, Func f) |
| Deletes the item from the set. More... | |
| bool | erase_with (const Q &key, Less pred) |
Deletes the item from the set with comparing functor pred. More... | |
| bool | erase_with (Q const &key, Less pred, Func f) |
Deletes the item from the set with comparing functor pred. More... | |
| bool | erase_at (iterator const &iter) |
Deletes the item pointed by iterator iter (only for IterableList based set) More... | |
| guarded_ptr | extract (Q const &key) |
Extracts the item with specified key. More... | |
| guarded_ptr | extract_with (Q const &key, Less pred) |
Extracts the item using compare functor pred. More... | |
| bool | find (Q &key, Func f) |
Finds the key key. More... | |
| iterator | find (Q &key) |
Finds key and returns iterator pointed to the item found (only for IterableList) More... | |
| bool | find_with (Q &key, Less pred, Func f) |
Finds the key key with pred predicate for comparing. More... | |
| iterator | find_with (Q &key, Less pred) |
Finds key using pred predicate and returns iterator pointed to the item found (only for IterableList) More... | |
| bool | contains (Q const &key) |
Checks whether the set contains key. More... | |
| bool | contains (Q const &key, Less pred) |
Checks whether the set contains key using pred predicate for searching. More... | |
| guarded_ptr | get (Q const &key) |
Finds the key key and return the item found. More... | |
| guarded_ptr | get_with (Q const &key, Less pred) |
Finds the key key and return the item found. More... | |
| size_t | size () const |
| Returns item count in the set. | |
| bool | empty () const |
| Checks if the set is empty. More... | |
| void | clear () |
| Clears the set (non-atomic) More... | |
| stat const & | statistics () const |
| Returns internal statistics. | |
| Traits::ordered_list::stat const & | list_statistics () const |
Returns internal statistics for OrderedList. | |
| iterator | begin () |
| Returns a forward iterator addressing the first element in a split-list. More... | |
| const_iterator | begin () const |
| Returns a forward const iterator addressing the first element in a split-list. | |
| iterator | end () |
| Returns an iterator that addresses the location succeeding the last element in a split-list. More... | |
| const_iterator | end () const |
| Returns an const iterator that addresses the location succeeding the last element in a split-list. | |
| const_iterator | cbegin () const |
| Returns a forward const iterator addressing the first element in a split-list. | |
| const_iterator | cend () const |
| Returns an const iterator that addresses the location succeeding the last element in a split-list. | |
Static Protected Attributes inherited from cds::intrusive::SplitListSet< cds::gc::nogc, Traits::ordered_list, Traits > | |
| static constexpr const size_t | c_nHazardPtrCount |
| Count of hazard pointer required. | |
Split-ordered list set (template specialization for gc::nogc)
This specialization is so-called append-only container when no item reclamation may be performed. The class does not support deleting of list item.
See SplitListSet for description of template parameters.
| typedef iterator_type<false> cds::container::SplitListSet< cds::gc::nogc, T, Traits >::iterator |
Forward iterator.
The forward iterator for split-list is based on OrderedList forward iterator and has some features:
The iterator interface:
|
inline |
Initialize split-ordered list of default capacity.
The default capacity is defined in bucket table constructor. See intrusive::split_list::expandable_bucket_table, intrusive::split_list::static_bucket_table which selects by split_list::dynamic_bucket_table option.
|
inline |
Initialize split-ordered list.
| nItemCount | estimated average of item count |
| nLoadFactor | load factor - average item count per bucket. Small integer up to 10, default is 1. |
|
inline |
|
inline |
Checks whether the set contains key.
The function searches the item with key equal to key and returns an iterator pointed to item found and end() otherwise
|
inline |
Checks whether the set contains key using pred predicate for searching.
The function is an analog of contains( key ) but pred is used for key comparing. Less functor has the interface like std::less. pred must imply the same element order as the comparator used for building the set.
|
inline |
Inserts data of type value_type created from args.
Return an iterator pointing to inserted item if success end() otherwise
|
inline |
Checks if the set is empty.
Emptiness is checked by item counting: if item count is zero then the set is empty. Thus, the correct item counting feature is an important part of split-list set implementation.
|
inline |
|
inline |
Inserts new node.
The function inserts val in the set if it does not contain an item with key equal to val. The value_type should be constructible from a value of type Q.
Return an iterator pointing to inserted item if success end() otherwise
|
inline |
Updates the item.
If key is not in the set and bAllowInsert is true, the function inserts a new item. Otherwise, the function returns an iterator pointing to the item found.
Returns std::pair<iterator, bool> where first is an iterator pointing to item found or inserted (if inserting is not allowed and key is not found, the iterator will be end()),
second is true if new item has been added or false if the item already is in the set.
see insert item troubleshooting. LazyList as the base provides exclusive access to inserted item
and does not require any node-level synchronization.