Stxxl
1.4.0
|
Implements dynamically resizable buffered writing and prefetched reading pool. More...
#include <read_write_pool.h>
Public Types | |
typedef BlockType | block_type |
typedef block_type::bid_type | bid_type |
typedef unsigned_type | size_type |
Public Member Functions | |
read_write_pool (size_type init_size_prefetch=1, size_type init_size_write=1) | |
Constructs pool. | |
_STXXL_DEPRECATED (read_write_pool(prefetch_pool_type &p_pool, write_pool_type &w_pool)) | |
void | swap (read_write_pool &obj) |
virtual | ~read_write_pool () |
Waits for completion of all ongoing requests and frees memory. | |
size_type | size_write () const |
Returns number of blocks owned by the write_pool. | |
size_type | size_prefetch () const |
Returns number of blocks owned by the prefetch_pool. | |
void | resize_write (size_type new_size) |
Resizes size of the pool. | |
void | resize_prefetch (size_type new_size) |
Resizes size of the pool. | |
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 | add (block_type *&block) |
bool | hint (bid_type bid) |
Gives a hint for prefetching a block. | |
bool | invalidate (bid_type bid) |
request_ptr | read (block_type *&block, bid_type bid) |
Reads block. If this block is cached block is not read but passed from the cache. | |
Protected Types | |
typedef write_pool< block_type > | write_pool_type |
typedef prefetch_pool< block_type > | prefetch_pool_type |
Protected Attributes | |
write_pool_type * | w_pool |
prefetch_pool_type * | p_pool |
bool | delete_pools |
Implements dynamically resizable buffered writing and prefetched reading pool.
Definition at line 28 of file read_write_pool.h.
typedef block_type::bid_type stxxl::read_write_pool< BlockType >::bid_type |
Definition at line 32 of file read_write_pool.h.
typedef BlockType stxxl::read_write_pool< BlockType >::block_type |
Definition at line 31 of file read_write_pool.h.
typedef prefetch_pool<block_type> stxxl::read_write_pool< BlockType >::prefetch_pool_type [protected] |
Definition at line 37 of file read_write_pool.h.
typedef unsigned_type stxxl::read_write_pool< BlockType >::size_type |
Definition at line 33 of file read_write_pool.h.
typedef write_pool<block_type> stxxl::read_write_pool< BlockType >::write_pool_type [protected] |
Definition at line 36 of file read_write_pool.h.
stxxl::read_write_pool< BlockType >::read_write_pool | ( | size_type | init_size_prefetch = 1 , |
size_type | init_size_write = 1 |
||
) | [inline, explicit] |
Constructs pool.
init_size_prefetch | initial number of blocks in the prefetch pool |
init_size_write | initial number of blocks in the write pool |
Definition at line 47 of file read_write_pool.h.
virtual stxxl::read_write_pool< BlockType >::~read_write_pool | ( | ) | [inline, virtual] |
Waits for completion of all ongoing requests and frees memory.
Definition at line 66 of file read_write_pool.h.
stxxl::read_write_pool< BlockType >::_STXXL_DEPRECATED | ( | read_write_pool< BlockType >(prefetch_pool_type &p_pool, write_pool_type &w_pool) | ) | [inline] |
Definition at line 54 of file read_write_pool.h.
void stxxl::read_write_pool< BlockType >::add | ( | block_type *& | block | ) | [inline] |
Definition at line 121 of file read_write_pool.h.
Referenced by main().
bool stxxl::read_write_pool< BlockType >::hint | ( | bid_type | bid | ) | [inline] |
Gives a hint for prefetching a block.
bid | address of a block to be prefetched |
true
if there was a free block to do prefetch and prefetching was scheduled, false
otherwise read
method) calling hint
function has no effect Definition at line 135 of file read_write_pool.h.
Referenced by main(), and stxxl::priority_queue_local::ext_merger< BlockType_, Cmp_, Arity_, AllocStr_ >::multi_merge().
bool stxxl::read_write_pool< BlockType >::invalidate | ( | bid_type | bid | ) | [inline] |
Definition at line 140 of file read_write_pool.h.
request_ptr stxxl::read_write_pool< BlockType >::read | ( | block_type *& | block, |
bid_type | bid | ||
) | [inline] |
Reads block. If this block is cached block is not read but passed from the cache.
block | block object, where data to be read to. If block was cached block 's ownership goes to the pool and block from cache is returned in block value. |
bid | address of the block |
block
parameter must be allocated dynamically using new
. Definition at line 151 of file read_write_pool.h.
Referenced by main(), and stxxl::priority_queue_local::ext_merger< BlockType_, Cmp_, Arity_, AllocStr_ >::multi_merge().
void stxxl::read_write_pool< BlockType >::resize_prefetch | ( | size_type | new_size | ) | [inline] |
Resizes size of the pool.
new_size | new size of the pool after the call |
Definition at line 89 of file read_write_pool.h.
Referenced by stxxl::random_shuffle().
void stxxl::read_write_pool< BlockType >::resize_write | ( | size_type | new_size | ) | [inline] |
Resizes size of the pool.
new_size | new size of the pool after the call |
Definition at line 82 of file read_write_pool.h.
Referenced by stxxl::random_shuffle().
size_type stxxl::read_write_pool< BlockType >::size_prefetch | ( | ) | const [inline] |
Returns number of blocks owned by the prefetch_pool.
Definition at line 78 of file read_write_pool.h.
size_type stxxl::read_write_pool< BlockType >::size_write | ( | ) | const [inline] |
Returns number of blocks owned by the write_pool.
Definition at line 75 of file read_write_pool.h.
Referenced by stxxl::priority_queue_local::ext_merger< BlockType_, Cmp_, Arity_, AllocStr_ >::insert_segment().
block_type* stxxl::read_write_pool< BlockType >::steal | ( | ) | [inline] |
Take out a block from the pool.
Definition at line 116 of file read_write_pool.h.
Referenced by stxxl::priority_queue_local::ext_merger< BlockType_, Cmp_, Arity_, AllocStr_ >::insert_segment(), and main().
void stxxl::read_write_pool< BlockType >::swap | ( | read_write_pool< BlockType > & | obj | ) | [inline] |
Definition at line 58 of file read_write_pool.h.
References stxxl::read_write_pool< BlockType >::delete_pools, stxxl::read_write_pool< BlockType >::p_pool, std::swap(), and stxxl::read_write_pool< BlockType >::w_pool.
Referenced by std::swap().
request_ptr stxxl::read_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 102 of file read_write_pool.h.
Referenced by stxxl::priority_queue_local::ext_merger< BlockType_, Cmp_, Arity_, AllocStr_ >::insert_segment(), and main().
bool stxxl::read_write_pool< BlockType >::delete_pools [protected] |
Definition at line 41 of file read_write_pool.h.
Referenced by stxxl::read_write_pool< BlockType >::swap().
prefetch_pool_type* stxxl::read_write_pool< BlockType >::p_pool [protected] |
Definition at line 40 of file read_write_pool.h.
Referenced by stxxl::read_write_pool< BlockType >::swap().
write_pool_type* stxxl::read_write_pool< BlockType >::w_pool [protected] |
Definition at line 39 of file read_write_pool.h.
Referenced by stxxl::read_write_pool< BlockType >::swap().