Stxxl
1.4.0
|
Implements dynamically resizable buffered writing pool. More...
#include <write_pool.h>
Classes | |
struct | busy_entry |
Public Types | |
typedef BlockType | block_type |
typedef block_type::bid_type | bid_type |
typedef std::list< block_type * > ::iterator | free_blocks_iterator |
typedef std::list< busy_entry > ::iterator | busy_blocks_iterator |
Public Member Functions | |
write_pool (unsigned_type init_size=1) | |
Constructs pool. | |
void | swap (write_pool &obj) |
virtual | ~write_pool () |
Waits for completion of all ongoing write requests and frees memory. | |
unsigned_type | size () const |
Returns number of owned blocks. | |
request_ptr | write (block_type *&block, bid_type bid) |
Passes a block to the pool for writing. | |
block_type * | steal () |
Take out a block from the pool. | |
request_ptr | steal_request (bid_type bid) |
void | add (block_type *&block) |
Protected Member Functions | |
void | check_all_busy () |
Protected Attributes | |
std::list< block_type * > | free_blocks |
std::list< busy_entry > | busy_blocks |
Implements dynamically resizable buffered writing pool.
Definition at line 38 of file write_pool.h.
typedef block_type::bid_type stxxl::write_pool< BlockType >::bid_type |
Definition at line 42 of file write_pool.h.
typedef BlockType stxxl::write_pool< BlockType >::block_type |
Definition at line 41 of file write_pool.h.
typedef std::list<busy_entry>::iterator stxxl::write_pool< BlockType >::busy_blocks_iterator |
Definition at line 59 of file write_pool.h.
typedef std::list<block_type *>::iterator stxxl::write_pool< BlockType >::free_blocks_iterator |
Definition at line 58 of file write_pool.h.
stxxl::write_pool< BlockType >::write_pool | ( | unsigned_type | init_size = 1 | ) | [inline, explicit] |
Constructs pool.
init_size | initial number of blocks in the pool |
Definition at line 70 of file write_pool.h.
References STXXL_VERBOSE_WPOOL.
virtual stxxl::write_pool< BlockType >::~write_pool | ( | ) | [inline, virtual] |
Waits for completion of all ongoing write requests and frees memory.
Definition at line 86 of file write_pool.h.
References STXXL_VERBOSE_WPOOL.
void stxxl::write_pool< BlockType >::add | ( | block_type *& | block | ) | [inline] |
Definition at line 248 of file write_pool.h.
References STXXL_VERBOSE_WPOOL.
Referenced by stxxl::prefetch_pool< BlockType >::hint(), main(), and stxxl::prefetch_pool< BlockType >::read().
void stxxl::write_pool< BlockType >::check_all_busy | ( | ) | [inline, protected] |
Definition at line 256 of file write_pool.h.
References STXXL_VERBOSE_WPOOL.
unsigned_type stxxl::write_pool< BlockType >::size | ( | ) | const [inline] |
Returns number of owned blocks.
Definition at line 111 of file write_pool.h.
block_type* stxxl::write_pool< BlockType >::steal | ( | ) | [inline] |
Take out a block from the pool.
Definition at line 142 of file write_pool.h.
References STXXL_VERBOSE_WPOOL, and stxxl::wait_any().
Referenced by main().
request_ptr stxxl::write_pool< BlockType >::steal_request | ( | bid_type | bid | ) | [inline] |
Definition at line 227 of file write_pool.h.
References STXXL_VERBOSE_WPOOL.
Referenced by stxxl::prefetch_pool< BlockType >::hint(), and stxxl::prefetch_pool< BlockType >::read().
void stxxl::write_pool< BlockType >::swap | ( | write_pool< BlockType > & | obj | ) | [inline] |
Definition at line 79 of file write_pool.h.
References stxxl::write_pool< BlockType >::busy_blocks, stxxl::write_pool< BlockType >::free_blocks, and std::swap().
Referenced by std::swap().
request_ptr stxxl::write_pool< BlockType >::write | ( | block_type *& | block, |
bid_type | bid | ||
) | [inline] |
Passes a block to the pool for writing.
block | block to write. Ownership of the block goes to the pool. block must be allocated dynamically with using new . |
bid | location, where to write |
block
must be allocated dynamically with using new
. Definition at line 119 of file write_pool.h.
References STXXL_VERBOSE_WPOOL.
Referenced by main().
std::list<busy_entry> stxxl::write_pool< BlockType >::busy_blocks [protected] |
Definition at line 65 of file write_pool.h.
Referenced by stxxl::write_pool< BlockType >::swap().
std::list<block_type *> stxxl::write_pool< BlockType >::free_blocks [protected] |
Definition at line 63 of file write_pool.h.
Referenced by stxxl::write_pool< BlockType >::swap().