Stxxl  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
stxxl::queue< ValTp, BlkSz, AllocStr, SzTp > Class Template Reference

External FIFO queue container. More...

#include <queue.h>

Inheritance diagram for stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >:
Inheritance graph
[legend]
Collaboration diagram for stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { block_size = BlkSz }
typedef ValTp value_type
typedef AllocStr alloc_strategy_type
typedef SzTp size_type
typedef typed_block
< block_size, value_type
block_type
typedef BID< block_sizebid_type

Public Member Functions

 queue (int D=-1)
 Constructs empty queue with own write and prefetch block pool.
 queue (unsigned_type w_pool_size, unsigned_type p_pool_size, int blocks2prefetch_=-1)
 Constructs empty queue with own write and prefetch block pool.
 _STXXL_DEPRECATED (queue(write_pool< block_type > &w_pool, prefetch_pool< block_type > &p_pool, int blocks2prefetch_=-1))
 Constructs empty queue.
 queue (pool_type &pool_, int blocks2prefetch_=-1)
 Constructs empty queue.
void swap (queue &obj)
void set_prefetch_aggr (int_type blocks2prefetch_)
 Defines the number of blocks to prefetch (front side) This method should be called whenever the prefetch pool is resized.
unsigned_type get_prefetch_aggr () const
 Returns the number of blocks prefetched from the front side.
void push (const value_type &val)
 Adds an element in the queue.
void pop ()
 Removes element from the queue.
size_type size () const
 Returns the size of the queue.
bool empty () const
 Returns true if queue is empty.
value_typeback ()
 Returns a mutable reference at the back of the queue.
const value_typeback () const
 Returns a const reference at the back of the queue.
value_typefront ()
 Returns a mutable reference at the front of the queue.
const value_typefront () const
 Returns a const reference at the front of the queue.
 ~queue ()

Private Types

typedef read_write_pool
< block_type
pool_type

Private Member Functions

void init (int blocks2prefetch_=-1)

Private Attributes

size_type size_
bool delete_pool
pool_typepool
block_typefront_block
block_typeback_block
value_typefront_element
value_typeback_element
alloc_strategy_type alloc_strategy
unsigned_type alloc_count
std::deque< bid_typebids
block_managerbm
unsigned_type blocks2prefetch

Detailed Description

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
class stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >

External FIFO queue container.

Template Parameters:
ValTptype of the contained objects (POD with no references to internal memory)
BlkSzsize of the external memory block in bytes, default is STXXL_DEFAULT_BLOCK_SIZE(ValTp)
AllocStrparallel disk allocation strategy, default is STXXL_DEFAULT_ALLOC_STRATEGY
SzTpsize data type, default is stxxl::uint64

Definition at line 51 of file queue.h.


Member Typedef Documentation

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
typedef AllocStr stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::alloc_strategy_type

Definition at line 55 of file queue.h.

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
typedef BID<block_size> stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::bid_type

Definition at line 62 of file queue.h.

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
typedef typed_block<block_size, value_type> stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::block_type

Definition at line 61 of file queue.h.

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
typedef read_write_pool<block_type> stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::pool_type [private]

Definition at line 65 of file queue.h.

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
typedef SzTp stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::size_type

Definition at line 56 of file queue.h.

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
typedef ValTp stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::value_type

Definition at line 54 of file queue.h.


Member Enumeration Documentation

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
anonymous enum
Enumerator:
block_size 

Definition at line 57 of file queue.h.


Constructor & Destructor Documentation

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::queue ( int  D = -1) [inline, explicit]

Constructs empty queue with own write and prefetch block pool.

Parameters:
Dnumber of parallel disks, defaulting to the configured number of scratch disks, memory consumption will be 2 * D + 2 blocks (first and last block, D blocks as write cache, D block for prefetching)

Definition at line 86 of file queue.h.

References D(), init(), and STXXL_VERBOSE_QUEUE.

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::queue ( unsigned_type  w_pool_size,
unsigned_type  p_pool_size,
int  blocks2prefetch_ = -1 
) [inline, explicit]

Constructs empty queue with own write and prefetch block pool.

Parameters:
w_pool_sizenumber of blocks in the write pool, must be at least 2, recommended at least 3
p_pool_sizenumber of blocks in the prefetch pool, recommended at least 1
blocks2prefetch_defines the number of blocks to prefetch (front side), default is number of block in the prefetch pool

Definition at line 105 of file queue.h.

References init(), and STXXL_VERBOSE_QUEUE.

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::queue ( pool_type pool_,
int  blocks2prefetch_ = -1 
) [inline]

Constructs empty queue.

Parameters:
pool_block write/prefetch pool
blocks2prefetch_defines the number of blocks to prefetch (front side), default is number of blocks in the prefetch pool
Warning:
Number of blocks in the write pool must be at least 2, recommended at least 3
Number of blocks in the prefetch pool recommended at least 1

Definition at line 143 of file queue.h.

References init(), and STXXL_VERBOSE_QUEUE.

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::~queue ( ) [inline]

Definition at line 367 of file queue.h.


Member Function Documentation

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::_STXXL_DEPRECATED ( queue< ValTp, BlkSz, AllocStr, SzTp >(write_pool< block_type > &w_pool, prefetch_pool< block_type > &p_pool, int blocks2prefetch_=-1)  ) [inline]

Constructs empty queue.

Parameters:
w_poolwrite pool
p_poolprefetch pool
blocks2prefetch_defines the number of blocks to prefetch (front side), default is number of blocks in the prefetch pool
Warning:
Number of blocks in the write pool must be at least 2, recommended at least 3
Number of blocks in the prefetch pool recommended at least 1

Definition at line 124 of file queue.h.

References init(), and STXXL_VERBOSE_QUEUE.

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
value_type& stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::back ( ) [inline]

Returns a mutable reference at the back of the queue.

Definition at line 340 of file queue.h.

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
const value_type& stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::back ( ) const [inline]

Returns a const reference at the back of the queue.

Definition at line 347 of file queue.h.

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
bool stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::empty ( ) const [inline]

Returns true if queue is empty.

Definition at line 334 of file queue.h.

Referenced by main().

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
value_type& stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::front ( ) [inline]

Returns a mutable reference at the front of the queue.

Definition at line 354 of file queue.h.

Referenced by main().

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
const value_type& stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::front ( ) const [inline]

Returns a const reference at the front of the queue.

Definition at line 361 of file queue.h.

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
unsigned_type stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::get_prefetch_aggr ( ) const [inline]

Returns the number of blocks prefetched from the front side.

Definition at line 207 of file queue.h.

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
void stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::init ( int  blocks2prefetch_ = -1) [inline, private]

Definition at line 171 of file queue.h.

References STXXL_MSG.

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
void stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::pop ( ) [inline]

Removes element from the queue.

Definition at line 271 of file queue.h.

References FMT_BID, STXXL_VERBOSE_QUEUE, and UNLIKELY.

Referenced by main().

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
void stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::push ( const value_type val) [inline]

Adds an element in the queue.

Definition at line 213 of file queue.h.

References FMT_BID, STXXL_VERBOSE_QUEUE, and UNLIKELY.

Referenced by main().

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
void stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::set_prefetch_aggr ( int_type  blocks2prefetch_) [inline]

Defines the number of blocks to prefetch (front side) This method should be called whenever the prefetch pool is resized.

Parameters:
blocks2prefetch_defines the number of blocks to prefetch (front side), a negative value means to use the number of blocks in the prefetch pool

Definition at line 198 of file queue.h.

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
size_type stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::size ( ) const [inline]

Returns the size of the queue.

Definition at line 328 of file queue.h.

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
void stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::swap ( queue< ValTp, BlkSz, AllocStr, SzTp > &  obj) [inline]

Member Data Documentation

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
unsigned_type stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::alloc_count [private]

Definition at line 75 of file queue.h.

Referenced by stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::swap().

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
alloc_strategy_type stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::alloc_strategy [private]

Definition at line 74 of file queue.h.

Referenced by stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::swap().

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
block_type* stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::back_block [private]

Definition at line 71 of file queue.h.

Referenced by stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::swap().

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
value_type* stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::back_element [private]

Definition at line 73 of file queue.h.

Referenced by stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::swap().

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
std::deque<bid_type> stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::bids [private]

Definition at line 76 of file queue.h.

Referenced by stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::swap().

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
unsigned_type stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::blocks2prefetch [private]

Definition at line 78 of file queue.h.

Referenced by stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::swap().

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
block_manager* stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::bm [private]

Definition at line 77 of file queue.h.

Referenced by stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::swap().

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
bool stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::delete_pool [private]

Definition at line 68 of file queue.h.

Referenced by stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::swap().

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
block_type* stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::front_block [private]

Definition at line 70 of file queue.h.

Referenced by stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::swap().

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
value_type* stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::front_element [private]

Definition at line 72 of file queue.h.

Referenced by stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::swap().

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
pool_type* stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::pool [private]

Definition at line 69 of file queue.h.

Referenced by stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::swap().

template<class ValTp, unsigned BlkSz = STXXL_DEFAULT_BLOCK_SIZE(ValTp), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SzTp = stxxl::uint64>
size_type stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::size_ [private]

Definition at line 67 of file queue.h.

Referenced by stxxl::queue< ValTp, BlkSz, AllocStr, SzTp >::swap().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines