libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
jmmcg::LIBJMMCG_VER_NAMESPACE::front_batch< Colln, I > Struct Template Reference

An adaptor for collections that batches up to I items being atomically removed from the collection, Colln. More...

#include <batch.hpp>

Inheritance diagram for jmmcg::LIBJMMCG_VER_NAMESPACE::front_batch< Colln, I >:
[legend]

Public Types

typedef Colln base_t
 
typedef base_t::thread_traits thread_traits
 
typedef Colln container_type
 
typedef container_type::value_ret_type value_ret_type
 
typedef container_type::exception_type exeception_type
 

Public Member Functions

constexpr front_batch () noexcept(noexcept(base_t()))
 
 front_batch (typename base_t::have_work_type::atomic_t &a) noexcept(noexcept(base_t(std::declval< base_t >())))
 
 front_batch (front_batch const &fb) noexcept(noexcept(base_t(std::declval< front_batch >())))
 
front_batch &__fastcall FORCE_INLINE operator= (front_batch const &fb) noexcept(noexcept(base_t::operator=(std::declval< front_batch >())))
 
value_ret_type __fastcall pop_front_nochk_nolk () noexcept(true) FORCE_INLINE
 The items are batched when popped from the queue. More...
 

Static Public Attributes

static constexpr unsigned long max_size =I
 The maximum number of items to batch. More...
 

Detailed Description

template<class Colln, unsigned long I>
struct jmmcg::LIBJMMCG_VER_NAMESPACE::front_batch< Colln, I >

An adaptor for collections that batches up to I items being atomically removed from the collection, Colln.

This means that as items are removed from the collection, they are potentially added to the last item that was removed from the collection. This implies that the Colln::value_type is some kind of collection to which that work may be added.

Definition at line 33 of file batch.hpp.

Member Typedef Documentation

◆ base_t

template<class Colln , unsigned long I>
typedef Colln jmmcg::LIBJMMCG_VER_NAMESPACE::front_batch< Colln, I >::base_t

Definition at line 35 of file batch.hpp.

◆ container_type

template<class Colln , unsigned long I>
typedef Colln jmmcg::LIBJMMCG_VER_NAMESPACE::front_batch< Colln, I >::container_type

Definition at line 37 of file batch.hpp.

◆ exeception_type

template<class Colln , unsigned long I>
typedef container_type::exception_type jmmcg::LIBJMMCG_VER_NAMESPACE::front_batch< Colln, I >::exeception_type

Definition at line 39 of file batch.hpp.

◆ thread_traits

template<class Colln , unsigned long I>
typedef base_t::thread_traits jmmcg::LIBJMMCG_VER_NAMESPACE::front_batch< Colln, I >::thread_traits

Definition at line 36 of file batch.hpp.

◆ value_ret_type

template<class Colln , unsigned long I>
typedef container_type::value_ret_type jmmcg::LIBJMMCG_VER_NAMESPACE::front_batch< Colln, I >::value_ret_type

Definition at line 38 of file batch.hpp.

Constructor & Destructor Documentation

◆ front_batch() [1/3]

template<class Colln , unsigned long I>
constexpr jmmcg::LIBJMMCG_VER_NAMESPACE::front_batch< Colln, I >::front_batch ( )
inlineconstexprnoexcept

Definition at line 43 of file batch.hpp.

◆ front_batch() [2/3]

template<class Colln , unsigned long I>
jmmcg::LIBJMMCG_VER_NAMESPACE::front_batch< Colln, I >::front_batch ( typename base_t::have_work_type::atomic_t &  a)
inlineexplicitnoexcept

Definition at line 45 of file batch.hpp.

◆ front_batch() [3/3]

template<class Colln , unsigned long I>
jmmcg::LIBJMMCG_VER_NAMESPACE::front_batch< Colln, I >::front_batch ( front_batch< Colln, I > const &  fb)
inlinenoexcept

Definition at line 47 of file batch.hpp.

Member Function Documentation

◆ operator=()

template<class Colln , unsigned long I>
front_batch& __fastcall FORCE_INLINE jmmcg::LIBJMMCG_VER_NAMESPACE::front_batch< Colln, I >::operator= ( front_batch< Colln, I > const &  fb)
inlinenoexcept

Definition at line 49 of file batch.hpp.

◆ pop_front_nochk_nolk()

template<class Colln , unsigned long I>
front_batch< Colln, I >::value_ret_type jmmcg::LIBJMMCG_VER_NAMESPACE::front_batch< Colln, I >::pop_front_nochk_nolk
inlinenoexcept

The items are batched when popped from the queue.

This is used to return a collection of items from the signalled_work_queue, in the order in which they were inserted. At least one item will be returned, and if there are sufficient items in the signalled_work_queue, then max_size items will be returned. This implies that the thread that extracts items from the queue does the work in batching them.

Returns
A batch of either one or max_size items.

Definition at line 23 of file batch_impl.hpp.

References jmmcg::LIBJMMCG_VER_NAMESPACE::front_batch< Colln, I >::max_size.

Member Data Documentation

◆ max_size

template<class Colln , unsigned long I>
constexpr unsigned long jmmcg::LIBJMMCG_VER_NAMESPACE::front_batch< Colln, I >::max_size =I
staticconstexpr

The maximum number of items to batch.

Definition at line 34 of file batch.hpp.

Referenced by jmmcg::LIBJMMCG_VER_NAMESPACE::front_batch< Colln, I >::pop_front_nochk_nolk().


The documentation for this struct was generated from the following files: