cds  1.3.0
Data Structures | Public Types | Public Member Functions
cds::container::SplitListSet< cds::gc::nogc, T, Traits > Class Template Reference

Split-ordered list set (template specialization for gc::nogc) More...

#include <cds/container/split_list_set_nogc.h>

Inheritance diagram for cds::container::SplitListSet< cds::gc::nogc, T, Traits >:
cds::intrusive::SplitListSet< cds::gc::nogc, Traits::ordered_list, Traits >

Data Structures

class  iterator_type
 Forward iterator. More...
 

Public Types

typedef options::gc gc
 Garbage collector.
 
typedef options::value_type value_type
 type of value stored in the list
 
typedef options::ordered_list ordered_list
 Underlying ordered list class.
 
typedef base_class::key_comparator key_comparator
 key comparision 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 iterator_type< false > iterator
 Forward iterator.
 
typedef iterator_type< true > const_iterator
 Const forward iterator.
 

Public Member Functions

 SplitListSet ()
 Initialize split-ordered list of default capacity.
 
 SplitListSet (size_t nItemCount, size_t nLoadFactor=1)
 Initialize split-ordered list.
 
iterator begin ()
 Returns a forward iterator addressing the first element in a set.
 
iterator end ()
 Returns an iterator that addresses the location succeeding the last element in a set.
 
const_iterator begin () 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.
 
template<typename Q >
iterator insert (const Q &val)
 Inserts new node.
 
template<typename... Args>
iterator emplace (Args &&...args)
 Inserts data of type value_type constructed with std::forward<Args>(args)...
 
template<typename Q >
std::pair< iterator, bool > ensure (const Q &val)
 Ensures that the item val exists in the set.
 
template<typename Q >
iterator find (const Q &key)
 Find the key val.
 
bool empty () const
 Checks if the set is empty.
 
size_t size () const
 Returns item count in the set.
 

Additional Inherited Members

- Protected Types inherited from cds::intrusive::SplitListSet< cds::gc::nogc, Traits::ordered_list, Traits >
typedef Traits options
 Traits template parameters.
 
typedef cds::gc::nogc gc
 Garbage collector.
 
typedef
cds::opt::v::hash_selector
< typename options::hash >
::type 
hash
 Hash functor for value_type and all its derivatives that you use.
 
typedef Traits::ordered_list ordered_list
 type of ordered list used as 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 comparision functor
 
typedef ordered_list::disposer disposer
 Node disposer functor.
 
typedef options::item_counter item_counter
 Item counter type.
 
typedef options::back_off back_off
 back-off strategy for spinning
 
typedef options::memory_model memory_model
 Memory ordering. See cds::opt::memory_model option.
 
typedef iterator_type< false > iterator
 Forward iterator.
 
typedef iterator_type< true > const_iterator
 Const forward iterator.
 
typedef ordered_list::node_type list_node_type
 Node type as declared in ordered list.
 
typedef split_list::node
< list_node_type
node_type
 split-list node type
 
typedef node_type dummy_node_type
 dummy node type
 
typedef
split_list::node_traits
< typename
ordered_list::node_traits > 
node_traits
 Split-list node traits.
 
- Protected Member Functions inherited from cds::intrusive::SplitListSet< cds::gc::nogc, Traits::ordered_list, Traits >
 SplitListSet ()
 Initialize split-ordered list of default capacity.
 
 SplitListSet (size_t nItemCount, size_t nLoadFactor=1)
 Initialize split-ordered list.
 
bool insert (value_type &val)
 Inserts new node.
 
bool insert (value_type &val, Func f)
 Inserts new node.
 
std::pair< bool, bool > ensure (value_type &val, Func func)
 Ensures that the val exists in the set.
 
bool unlink (value_type &val)
 Unlink the item val from the set.
 
bool erase (const Q &val)
 Delete the item from the set.
 
bool erase (Q const &val, Func f)
 Delete the item from the set.
 
bool find (Q &val, Func f)
 Find the key val.
 
bool find (Q const &val, Func f)
 Find the key val.
 
bool find (Q const &val)
 Find the key val.
 
size_t size () const
 Returns item count in the set.
 
bool empty () const
 Checks if the set is empty.
 
void clear ()
 Clear the set (non-atomic)
 
iterator begin ()
 Returns a forward iterator addressing the first element in a split-list.
 
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.
 
const_iterator end () const
 Returns an const iterator that addresses the location succeeding the last element in a split-list.
 

Detailed Description

template<class T, class Traits = split_list::type_traits>
class cds::container::SplitListSet< cds::gc::nogc, T, Traits >

Split-ordered list set (template specialization for gc::nogc)

This specialization is intended for so-called persistent usage when no item reclamation may be performed. The class does not support deleting of list item.

See SplitListSet for description of template parameters.

The interface of the specialization is a slightly different.

Constructor & Destructor Documentation

template<class T , class Traits = split_list::type_traits>
cds::container::SplitListSet< cds::gc::nogc, T, Traits >::SplitListSet ( )
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_ducket_table which selects by intrusive::split_list::dynamic_bucket_table option.

template<class T , class Traits = split_list::type_traits>
cds::container::SplitListSet< cds::gc::nogc, T, Traits >::SplitListSet ( size_t  nItemCount,
size_t  nLoadFactor = 1 
)
inline

Initialize split-ordered list.

Parameters
nItemCountestimate average of item count
nLoadFactorload factor - average item count per bucket. Small integer up to 10, default is 1.

Member Function Documentation

template<class T , class Traits = split_list::type_traits>
iterator cds::container::SplitListSet< cds::gc::nogc, T, Traits >::begin ( )
inline

Returns a forward iterator addressing the first element in a set.

For empty set

begin() == end()
template<class T , class Traits = split_list::type_traits>
template<typename... Args>
iterator cds::container::SplitListSet< cds::gc::nogc, T, Traits >::emplace ( Args &&...  args)
inline

Inserts data of type value_type constructed with std::forward<Args>(args)...

Return an iterator pointing to inserted item if success end() otherwise

This function is available only for compiler that supports variadic template and move semantics

template<class T , class Traits = split_list::type_traits>
bool cds::container::SplitListSet< cds::gc::nogc, T, Traits >::empty ( ) const
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.

template<class T , class Traits = split_list::type_traits>
iterator cds::container::SplitListSet< cds::gc::nogc, T, Traits >::end ( )
inline

Returns an iterator that addresses the location succeeding the last element in a set.

Do not use the value returned by end function to access any item. The returned value can be used only to control reaching the end of the set. For empty set

begin() == end()
template<class T , class Traits = split_list::type_traits>
template<typename Q >
std::pair<iterator, bool> cds::container::SplitListSet< cds::gc::nogc, T, Traits >::ensure ( const Q &  val)
inline

Ensures that the item val exists in the set.

The operation inserts new item created from val if the key val is not found in the set. Otherwise, the function returns an iterator that points to item found. The value_type should be constructible from a value of type Q.

Returns std::pair<iterator, bool> where first is an iterator pointing to item found or inserted, second is true if new item has been added or false if the item already is in the set.

template<class T , class Traits = split_list::type_traits>
template<typename Q >
iterator cds::container::SplitListSet< cds::gc::nogc, T, Traits >::find ( const Q &  key)
inline

Find the key val.

The function searches the item with key equal to key and returns an iterator pointed to item found if the key is found, and end() otherwise

template<class T , class Traits = split_list::type_traits>
template<typename Q >
iterator cds::container::SplitListSet< cds::gc::nogc, T, Traits >::insert ( const Q &  val)
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


The documentation for this class was generated from the following file:

cds 1.3.0 Developed by Maxim Khiszinsky aka khizmax 2007 - 2012
Autogenerated Sat Dec 29 2012 19:12:33 by Doxygen 1.8.3