13 #ifndef STXXL_MNG_READ_WRITE_POOL_HEADER
14 #define STXXL_MNG_READ_WRITE_POOL_HEADER
25 template <
typename BlockType>
30 typedef typename block_type::bid_type
bid_type;
53 : w_pool(&w_pool), p_pool(&p_pool), delete_pools(false)
58 std::swap(w_pool, obj.
w_pool);
59 std::swap(p_pool, obj.
p_pool);
82 w_pool->resize(new_size);
89 p_pool->resize(new_size);
106 if (p_pool->invalidate(bid))
107 p_pool->hint(bid, *w_pool);
116 return w_pool->steal();
136 return p_pool->hint(bid, *w_pool);
142 return p_pool->invalidate(bid);
159 return p_pool->read(block, bid, *w_pool);
166 return p_pool->find(bid);
172 return p_pool->poll(bid);
186 return p_pool->steal();
192 return p_pool->in_prefetching(bid);
198 return p_pool->free_size();
204 return p_pool->busy_size();
214 template <
class BlockType>
223 #endif // !STXXL_MNG_READ_WRITE_POOL_HEADER
bool invalidate(bid_type bid)
Cancel a hint request in case the block is no longer desired.
read_write_pool(size_type init_size_prefetch=1, size_type init_size_write=1)
Constructs pool.
void add_prefetch(block_type *&block)
Add block to prefetch pool.
bool hint(bid_type bid)
Gives a hint for prefetching a block.
unsigned_type free_size_prefetch() const
Returns the number of free prefetching blocks.
prefetch_pool< block_type > prefetch_pool_type
void swap(read_write_pool &obj)
request_ptr read(block_type *&block, bid_type bid)
Reads block.
unsigned_type busy_size_prefetch() const
Returns the number of busy prefetching blocks.
#define STXXL_DEPRECATED(x)
~read_write_pool()
Waits for completion of all ongoing requests and frees memory.
bool in_prefetching(bid_type bid)
Checks if a block is in the hinted block set.
Implements dynamically resizable buffered writing pool.
Implements dynamically resizable prefetching pool.
void add(block_type *&block)
Add block to write pool.
Implements dynamically resizable buffered writing and prefetched reading pool.
request_ptr find_hint(bid_type bid)
Returns the request pointer for a hinted block, or an invalid NULL request in case it was not request...
write_pool< block_type > write_pool_type
read_write_pool(prefetch_pool_type &p_pool, write_pool_type &w_pool)
request_ptr write(block_type *&block, bid_type bid)
Passes a block to the pool for writing.
void resize_prefetch(size_type new_size)
Resizes size of the pool.
#define STXXL_BEGIN_NAMESPACE
block_type * steal_prefetch()
Take out a block from the prefetch pool, one unhinted free block must be available.
block_type * steal()
Take out a block from the pool.
choose_int_types< my_pointer_size >::unsigned_type unsigned_type
size_type size_prefetch() const
Returns number of blocks owned by the prefetch_pool.
block_type::bid_type bid_type
bool poll_hint(bid_type bid)
Returns true if the blocks was hinted and the request is finished.
prefetch_pool_type * p_pool
void resize_write(size_type new_size)
Resizes size of the pool.
size_type size_write() const
Returns number of blocks owned by the write_pool.
#define STXXL_END_NAMESPACE