cds  2.2.0
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.
 
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

§ 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.2.0 Developed by Maxim Khizhinsky aka khizmax 2007 - 2017
Autogenerated Wed Jan 4 2017 08:49:34 by Doxygen 1.8.12