Implements dynamically resizable buffered writing pool. More...
#include <write_pool.h>
Public Member Functions | |
write_pool (unsigned_type init_size=1) | |
Constructs pool. | |
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. | |
void | resize (unsigned_type new_size) |
Resizes size of the pool. |
Implements dynamically resizable buffered writing pool.
write_pool< BlockType >::write_pool | ( | unsigned_type | init_size = 1 |
) | [inline, explicit] |
Constructs pool.
init_size | initial number of blocks in the pool |
virtual write_pool< BlockType >::~write_pool | ( | ) | [inline, virtual] |
Waits for completion of all ongoing write requests and frees memory.
void write_pool< BlockType >::resize | ( | unsigned_type | new_size | ) | [inline] |
Resizes size of the pool.
new_size | new size of the pool after the call |
Referenced by queue< ValTp, BlkSz, AllocStr, SzTp >::queue().
unsigned_type write_pool< BlockType >::size | ( | ) | const [inline] |
Returns number of owned blocks.
Referenced by queue< ValTp, BlkSz, AllocStr, SzTp >::queue(), write_pool< block_type >::resize(), and write_pool< block_type >::steal().
block_type* write_pool< BlockType >::steal | ( | ) | [inline] |
Take out a block from the pool.
Referenced by queue< ValTp, BlkSz, AllocStr, SzTp >::push(), queue< ValTp, BlkSz, AllocStr, SzTp >::queue(), and write_pool< block_type >::resize().
request_ptr 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
. Referenced by queue< ValTp, BlkSz, AllocStr, SzTp >::push().