cds  2.3.2
cds::container::FCDeque< T, Deque, Traits > Class Template Reference

Flat-combining deque. More...

#include <cds/container/fcdeque.h>

Public Types

typedef T value_type
 Value type.
 
typedef Deque deque_type
 Sequential deque class.
 
typedef Traits traits
 Deque type traits.
 
typedef traits::stat stat
 Internal statistics type.
 

Public Member Functions

 FCDeque ()
 Initializes empty deque object.
 
 FCDeque (unsigned int nCompactFactor, unsigned int nCombinePassCount)
 Initializes empty deque object and gives flat combining parameters. More...
 
bool push_front (value_type const &val)
 Inserts a new element at the beginning of the deque container. More...
 
bool push_front (value_type &&val)
 Inserts a new element at the beginning of the deque container (move semantics) More...
 
bool push_back (value_type const &val)
 Inserts a new element at the end of the deque container. More...
 
bool push_back (value_type &&val)
 Inserts a new element at the end of the deque container (move semantics) More...
 
bool pop_front (value_type &val)
 Removes the first element in the deque container. More...
 
bool pop_back (value_type &val)
 Removes the last element in the deque container. More...
 
void clear ()
 Clears the deque.
 
template<typename Func >
void apply (Func f)
 Exclusive access to underlying deque object. More...
 
template<typename Func >
void apply (Func f) const
 Exclusive access to underlying deque object. More...
 
size_t size () const
 Returns the number of elements in the deque. More...
 
bool empty () const
 Checks if the deque 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 Deque = std::deque<T>, typename Traits = fcdeque::traits>
class cds::container::FCDeque< T, Deque, Traits >

Flat-combining deque.

Flat combining sequential deque. The class can be considered as a concurrent FC-based wrapper for std::deque.

Template parameters:

  • T - a value type stored in the deque
  • Deque - sequential deque implementation, for example, std::deque<T> (the default) or boost::container::deque
  • Trats - type traits of flat combining, default is fcdeque::traits. fcdeque::make_traits metafunction can be used to construct specialized fcdeque::traits

Constructor & Destructor Documentation

◆ FCDeque()

template<typename T , class Deque = std::deque<T>, typename Traits = fcdeque::traits>
cds::container::FCDeque< T, Deque, Traits >::FCDeque ( unsigned int  nCompactFactor,
unsigned int  nCombinePassCount 
)
inline

Initializes empty deque 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

◆ apply() [1/2]

template<typename T , class Deque = std::deque<T>, typename Traits = fcdeque::traits>
template<typename Func >
void cds::container::FCDeque< T, Deque, Traits >::apply ( Func  f)
inline

Exclusive access to underlying deque object.

The functor f can do any operation with underlying deque_type in exclusive mode. For example, you can iterate over the deque. Func signature is:

void f( deque_type& deque );

◆ apply() [2/2]

template<typename T , class Deque = std::deque<T>, typename Traits = fcdeque::traits>
template<typename Func >
void cds::container::FCDeque< T, Deque, Traits >::apply ( Func  f) const
inline

Exclusive access to underlying deque object.

The functor f can do any operation with underlying deque_type in exclusive mode. For example, you can iterate over the deque. Func signature is:

void f( deque_type const& deque );

◆ empty()

template<typename T , class Deque = std::deque<T>, typename Traits = fcdeque::traits>
bool cds::container::FCDeque< T, Deque, Traits >::empty ( ) const
inline

Checks if the deque is empty.

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

◆ pop_back()

template<typename T , class Deque = std::deque<T>, typename Traits = fcdeque::traits>
bool cds::container::FCDeque< T, Deque, Traits >::pop_back ( value_type val)
inline

Removes the last element in the deque container.

The function returns false if the deque is empty, true otherwise. If the deque is empty val is not changed.

Parameters
valTarget to be received the copy of removed element

◆ pop_front()

template<typename T , class Deque = std::deque<T>, typename Traits = fcdeque::traits>
bool cds::container::FCDeque< T, Deque, Traits >::pop_front ( value_type val)
inline

Removes the first element in the deque container.

The function returns false if the deque is empty, true otherwise. If the deque is empty val is not changed.

Parameters
valTarget to be received the copy of removed element

◆ push_back() [1/2]

template<typename T , class Deque = std::deque<T>, typename Traits = fcdeque::traits>
bool cds::container::FCDeque< T, Deque, Traits >::push_back ( value_type const &  val)
inline

Inserts a new element at the end of the deque container.

The function always returns true

Parameters
valValue to be copied to inserted element

◆ push_back() [2/2]

template<typename T , class Deque = std::deque<T>, typename Traits = fcdeque::traits>
bool cds::container::FCDeque< T, Deque, Traits >::push_back ( value_type &&  val)
inline

Inserts a new element at the end of the deque container (move semantics)

The function always returns true

Parameters
valValue to be moved to inserted element

◆ push_front() [1/2]

template<typename T , class Deque = std::deque<T>, typename Traits = fcdeque::traits>
bool cds::container::FCDeque< T, Deque, Traits >::push_front ( value_type const &  val)
inline

Inserts a new element at the beginning of the deque container.

The function always returns true

Parameters
valValue to be copied to inserted element

◆ push_front() [2/2]

template<typename T , class Deque = std::deque<T>, typename Traits = fcdeque::traits>
bool cds::container::FCDeque< T, Deque, Traits >::push_front ( value_type &&  val)
inline

Inserts a new element at the beginning of the deque container (move semantics)

The function always returns true

Parameters
valValue to be moved to inserted element

◆ size()

template<typename T , class Deque = std::deque<T>, typename Traits = fcdeque::traits>
size_t cds::container::FCDeque< T, Deque, Traits >::size ( ) const
inline

Returns the number of elements in the deque.

Note that size() == 0 is not mean that the deque 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.2 Developed by Maxim Khizhinsky aka khizmax and other contributors 2007 - 2017
Autogenerated Sun Dec 31 2017 12:10:19 by Doxygen 1.8.13