Implements dynamically resizable buffered writing and prefetched reading pool. More...
#include <read_write_pool.h>
Inherits noncopyable.

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.
| 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 |
| virtual read_write_pool< BlockType >::~read_write_pool | ( | ) | [inline, virtual] |
Waits for completion of all ongoing requests and frees memory.
| bool 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 References prefetch_pool< BlockType >::hint().
Referenced by queue< ValTp, BlkSz, AllocStr, SzTp >::pop(), and queue< ValTp, BlkSz, AllocStr, SzTp >::push().
| request_ptr 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 . References prefetch_pool< BlockType >::read().
Referenced by queue< ValTp, BlkSz, AllocStr, SzTp >::pop().
| void 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 |
References prefetch_pool< BlockType >::resize().
| void 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 |
| size_type read_write_pool< BlockType >::size_prefetch | ( | ) | const [inline] |
Returns number of blocks owned by the prefetch_pool.
References prefetch_pool< BlockType >::size().
Referenced by queue< ValTp, BlkSz, AllocStr, SzTp >::set_prefetch_aggr().
| size_type read_write_pool< BlockType >::size_write | ( | ) | const [inline] |
Returns number of blocks owned by the write_pool.
References write_pool< BlockType >::size().
| block_type* read_write_pool< BlockType >::steal | ( | ) | [inline] |
Take out a block from the pool.
References write_pool< BlockType >::steal().
Referenced by queue< ValTp, BlkSz, AllocStr, SzTp >::push().
| request_ptr 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 . References prefetch_pool< BlockType >::hint(), and write_pool< BlockType >::write().
Referenced by queue< ValTp, BlkSz, AllocStr, SzTp >::push().
1.7.1