|
Stxxl
1.3.2
|
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. More... | |
| _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. More... | |
| size_type | size_write () const |
| Returns number of blocks owned by the write_pool. More... | |
| size_type | size_prefetch () const |
| Returns number of blocks owned by the prefetch_pool. More... | |
| void | resize_write (size_type new_size) |
| Resizes size of the pool. More... | |
| void | resize_prefetch (size_type new_size) |
| Resizes size of the pool. More... | |
| request_ptr | write (block_type *&block, bid_type bid) |
| Passes a block to the pool for writing. More... | |
| block_type * | steal () |
| Take out a block from the pool. More... | |
| void | add (block_type *&block) |
| bool | hint (bid_type bid) |
| Gives a hint for prefetching a block. More... | |
| 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. More... | |
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.
|
inlineexplicit |
Constructs pool.
| init_size_prefetch | initial number of blocks in the prefetch pool |
| init_size_write | initial number of blocks in the write pool |
|
inlinevirtual |
Waits for completion of all ongoing requests and frees memory.
|
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().
|
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().
|
inline |
Resizes size of the pool.
| new_size | new size of the pool after the call |
References prefetch_pool< BlockType >::resize().
|
inline |
Resizes size of the pool.
| new_size | new size of the pool after the call |
References write_pool< BlockType >::resize().
|
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().
|
inline |
Returns number of blocks owned by the write_pool.
References write_pool< BlockType >::size().
|
inline |
Take out a block from the pool.
References write_pool< BlockType >::steal().
Referenced by queue< ValTp, BlkSz, AllocStr, SzTp >::push().
|
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.8.5