cds  2.3.1
cds::intrusive::FCQueue< T, Container, Traits > Class Template Reference

Flat-combining intrusive queue. More...

#include <cds/intrusive/fcqueue.h>

Public Types

typedef T value_type
 Value type.
 
typedef Container container_type
 Sequential container type.
 
typedef Traits traits
 Queue traits.
 
typedef traits::disposer disposer
 The disposer functor. The disposer is used only in clear() function.
 
typedef traits::stat stat
 Internal statistics type.
 

Public Member Functions

 FCQueue ()
 Initializes empty queue object.
 
 FCQueue (unsigned int nCompactFactor, unsigned int nCombinePassCount)
 Initializes empty queue object and gives flat combining parameters. More...
 
bool enqueue (value_type &val)
 Inserts a new element at the end of the queue. More...
 
bool push (value_type &val)
 Inserts a new element at the end of the queue (a synonym for enqueue)
 
value_typedequeue ()
 Removes the next element from the queue. More...
 
value_typepop ()
 Removes the next element from the queue (a synonym for dequeue)
 
void clear (bool bDispose=false)
 Clears the queue. More...
 
size_t size () const
 Returns the number of elements in the queue. More...
 
bool empty () const
 Checks if the queue is empty. More...
 
stat const & statistics () const
 Internal statistics.
 

Static Public Attributes

static constexpr const bool c_bEliminationEnabled = traits::enable_elimination
 true if elimination is enabled
 

Protected Types

typedef cds::algo::flat_combining::kernel< fc_record, traitsfc_kernel
 Flat combining kernel.
 

Detailed Description

template<typename T, class Container = boost::intrusive::list<T>, typename Traits = fcqueue::traits>
class cds::intrusive::FCQueue< T, Container, Traits >

Flat-combining intrusive queue.

Flat combining sequential intrusive queue.

Template parameters:

  • T - a value type stored in the queue
  • Container - sequential intrusive container with push_back and pop_front functions. Default is boost::intrusive::list
  • Traits - type traits of flat combining, default is fcqueue::traits. fcqueue::make_traits metafunction can be used to construct fcqueue::traits specialization

Constructor & Destructor Documentation

◆ FCQueue()

template<typename T , class Container = boost::intrusive::list<T>, typename Traits = fcqueue::traits>
cds::intrusive::FCQueue< T, Container, Traits >::FCQueue ( unsigned int  nCompactFactor,
unsigned int  nCombinePassCount 
)
inline

Initializes empty queue object and gives flat combining parameters.

Parameters
nCompactFactorFlat combining: publication list compacting factor
nCombinePassCountFlat combining: number of combining passes for combiner thread

Member Function Documentation

◆ clear()

template<typename T , class Container = boost::intrusive::list<T>, typename Traits = fcqueue::traits>
void cds::intrusive::FCQueue< T, Container, Traits >::clear ( bool  bDispose = false)
inline

Clears the queue.

If bDispose is true, the disposer provided in Traits class' template parameter will be called for each removed element.

◆ dequeue()

template<typename T , class Container = boost::intrusive::list<T>, typename Traits = fcqueue::traits>
value_type* cds::intrusive::FCQueue< T, Container, Traits >::dequeue ( )
inline

Removes the next element from the queue.

If the queue is empty the function returns nullptr

◆ empty()

template<typename T , class Container = boost::intrusive::list<T>, typename Traits = fcqueue::traits>
bool cds::intrusive::FCQueue< T, Container, Traits >::empty ( ) const
inline

Checks if the queue is empty.

If the combining is in process the function waits while it is done.

◆ enqueue()

template<typename T , class Container = boost::intrusive::list<T>, typename Traits = fcqueue::traits>
bool cds::intrusive::FCQueue< T, Container, Traits >::enqueue ( value_type val)
inline

Inserts a new element at the end of the queue.

The function always returns true.

◆ size()

template<typename T , class Container = boost::intrusive::list<T>, typename Traits = fcqueue::traits>
size_t cds::intrusive::FCQueue< T, Container, Traits >::size ( ) const
inline

Returns the number of elements in the queue.

Note that size() == 0 is not mean that the queue is empty because combining record can be in process. To check emptiness use empty function.


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

cds 2.3.1 Developed by Maxim Khizhinsky aka khizmax 2007 - 2017
Autogenerated Fri Sep 1 2017 08:47:20 by Doxygen 1.8.13