STXXL  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stxxl::queue< ValueType, BlockSize, AllocStr, SizeType > Class Template Reference

Detailed Description

template<class ValueType, unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
class stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >

External FIFO queue container.
Introduction to queue container: see STXXL Queue tutorial
Design and Internals of queue container: see Queue.

Template Parameters
ValueTypetype of the contained objects (POD with no references to internal memory)
BlockSizesize of the external memory block in bytes, default is STXXL_DEFAULT_BLOCK_SIZE(ValueType)
AllocStrparallel disk allocation strategy, default is STXXL_DEFAULT_ALLOC_STRATEGY
SizeTypesize data type, default is stxxl::uint64
Examples:
examples/containers/queue1.cpp, and examples/containers/queue2.cpp.

Definition at line 52 of file queue.h.

+ Inheritance diagram for stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >:
+ Collaboration diagram for stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >:

Public Types

enum  { block_size = BlockSize }
 
typedef AllocStr alloc_strategy_type
 
typedef BID< block_sizebid_type
 
typedef typed_block
< block_size, value_type
block_type
 
typedef SizeType size_type
 
typedef ValueType value_type
 

Public Member Functions

Constructors/Destructors
 queue (int_type D=-1)
 Constructs empty queue with own write and prefetch block pool. More...
 
 queue (unsigned_type w_pool_size, unsigned_type p_pool_size, int blocks2prefetch_=-1)
 Constructs empty queue with own write and prefetch block pool. More...
 
 queue (write_pool< block_type > &w_pool, prefetch_pool< block_type > &p_pool, int blocks2prefetch_=-1)
 Constructs empty queue. More...
 
 queue (pool_type &pool_, int blocks2prefetch_=-1)
 Constructs empty queue. More...
 
 ~queue ()
 
Modifiers
void swap (queue &obj)
 
void push (const value_type &val)
 Adds an element in the queue. More...
 
void pop ()
 Removes element from the queue. More...
 
Miscellaneous
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. More...
 
unsigned_type get_prefetch_aggr () const
 Returns the number of blocks prefetched from the front side. More...
 
Operators
value_typeback ()
 Returns a mutable reference at the back of the queue. More...
 
const value_typeback () const
 Returns a const reference at the back of the queue. More...
 
value_typefront ()
 Returns a mutable reference at the front of the queue. More...
 
const value_typefront () const
 Returns a const reference at the front of the queue. More...
 
Capacity
size_type size () const
 Returns the size of the queue. More...
 
bool empty () const
 Returns true if queue is empty. More...
 

Private Types

typedef read_write_pool
< block_type
pool_type
 

Private Member Functions

void init (int blocks2prefetch_=-1)
 
- Private Member Functions inherited from stxxl::noncopyable
 noncopyable ()
 

Private Attributes

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

Member Typedef Documentation

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
typedef AllocStr stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::alloc_strategy_type

Definition at line 56 of file queue.h.

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
typedef BID<block_size> stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::bid_type

Definition at line 63 of file queue.h.

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
typedef typed_block<block_size, value_type> stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::block_type

Definition at line 62 of file queue.h.

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
typedef read_write_pool<block_type> stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::pool_type
private

Definition at line 66 of file queue.h.

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
typedef SizeType stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::size_type

Definition at line 57 of file queue.h.

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
typedef ValueType stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::value_type

Definition at line 55 of file queue.h.

Member Enumeration Documentation

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
anonymous enum
Enumerator
block_size 

Definition at line 58 of file queue.h.

Constructor & Destructor Documentation

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::queue ( int_type  D = -1)
inlineexplicit

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 90 of file queue.h.

References STXXL_VERBOSE_QUEUE.

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::queue ( unsigned_type  w_pool_size,
unsigned_type  p_pool_size,
int  blocks2prefetch_ = -1 
)
inlineexplicit

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 109 of file queue.h.

References STXXL_VERBOSE_QUEUE.

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::queue ( 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 129 of file queue.h.

References STXXL_VERBOSE_QUEUE.

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::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 147 of file queue.h.

References STXXL_VERBOSE_QUEUE.

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::~queue ( )
inline

Definition at line 382 of file queue.h.

Member Function Documentation

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
value_type& stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::back ( )
inline

Returns a mutable reference at the back of the queue.

Definition at line 350 of file queue.h.

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
const value_type& stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::back ( ) const
inline

Returns a const reference at the back of the queue.

Definition at line 357 of file queue.h.

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
bool stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::empty ( ) const
inline

Returns true if queue is empty.

Definition at line 409 of file queue.h.

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
value_type& stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::front ( )
inline

Returns a mutable reference at the front of the queue.

Definition at line 364 of file queue.h.

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
const value_type& stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::front ( ) const
inline

Returns a const reference at the front of the queue.

Definition at line 371 of file queue.h.

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
unsigned_type stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::get_prefetch_aggr ( ) const
inline

Returns the number of blocks prefetched from the front side.

Definition at line 221 of file queue.h.

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
void stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::init ( int  blocks2prefetch_ = -1)
inlineprivate

Definition at line 182 of file queue.h.

References STXXL_ERRMSG, and STXXL_MSG.

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
void stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::pop ( )
inline

Removes element from the queue.

Definition at line 289 of file queue.h.

References FMT_BID, STXXL_VERBOSE1, STXXL_VERBOSE_QUEUE, and UNLIKELY.

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
void stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::push ( const value_type val)
inline

Adds an element in the queue.

Examples:
examples/containers/queue1.cpp.

Definition at line 231 of file queue.h.

References FMT_BID, STXXL_VERBOSE1, STXXL_VERBOSE_QUEUE, and UNLIKELY.

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
void stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::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 212 of file queue.h.

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
size_type stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::size ( ) const
inline

Returns the size of the queue.

Definition at line 403 of file queue.h.

Member Data Documentation

template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
unsigned_type stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::alloc_count
private
template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
alloc_strategy_type stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::alloc_strategy
private
template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
block_type* stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::back_block
private
template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
value_type* stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::back_element
private
template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
std::deque<bid_type> stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::bids
private
template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
unsigned_type stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::blocks2prefetch
private
template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
block_manager* stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::bm
private
template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
bool stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::delete_pool
private
template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
block_type* stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::front_block
private
template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
value_type* stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::front_element
private
template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
size_type stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::m_size
private
template<class ValueType , unsigned BlockSize = STXXL_DEFAULT_BLOCK_SIZE(ValueType), class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY, class SizeType = stxxl::uint64>
pool_type* stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::pool
private

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