STXXL  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stxxl::write_pool< BlockType > Class Template Reference

Detailed Description

template<class BlockType>
class stxxl::write_pool< BlockType >

Implements dynamically resizable buffered writing pool.

Definition at line 34 of file write_pool.h.

+ Inheritance diagram for stxxl::write_pool< BlockType >:
+ Collaboration diagram for stxxl::write_pool< BlockType >:

Classes

struct  busy_entry
 

Public Types

typedef block_type::bid_type bid_type
 
typedef BlockType block_type
 
typedef std::list< busy_entry >
::iterator 
busy_blocks_iterator
 
typedef std::list< block_type * >
::iterator 
free_blocks_iterator
 

Public Member Functions

 write_pool (unsigned_type init_size=1)
 Constructs pool. More...
 
virtual ~write_pool ()
 Waits for completion of all ongoing write requests and frees memory. More...
 
void add (block_type *&block)
 
block_typeget ()
 
request_ptr get_request (bid_type bid)
 
bool has_request (bid_type bid)
 
void resize (unsigned_type new_size)
 Resizes size of the pool. More...
 
unsigned_type size () const
 Returns number of owned blocks. More...
 
block_typesteal ()
 Take out a block from the pool. More...
 
block_typesteal (bid_type bid)
 
std::pair< block_type
*, request_ptr
steal_request (bid_type bid)
 
void swap (write_pool &obj)
 
request_ptr write (block_type *&block, bid_type bid)
 Passes a block to the pool for writing. More...
 

Protected Member Functions

void check_all_busy ()
 

Protected Attributes

std::list< busy_entrybusy_blocks
 
std::list< block_type * > free_blocks
 

Additional Inherited Members

- Private Member Functions inherited from stxxl::noncopyable
 noncopyable ()
 

Member Typedef Documentation

template<class BlockType>
typedef block_type::bid_type stxxl::write_pool< BlockType >::bid_type

Definition at line 38 of file write_pool.h.

template<class BlockType>
typedef BlockType stxxl::write_pool< BlockType >::block_type

Definition at line 37 of file write_pool.h.

template<class BlockType>
typedef std::list<busy_entry>::iterator stxxl::write_pool< BlockType >::busy_blocks_iterator

Definition at line 55 of file write_pool.h.

template<class BlockType>
typedef std::list<block_type*>::iterator stxxl::write_pool< BlockType >::free_blocks_iterator

Definition at line 54 of file write_pool.h.

Constructor & Destructor Documentation

template<class BlockType>
stxxl::write_pool< BlockType >::write_pool ( unsigned_type  init_size = 1)
inlineexplicit

Constructs pool.

Parameters
init_sizeinitial number of blocks in the pool

Definition at line 66 of file write_pool.h.

References STXXL_VERBOSE_WPOOL.

template<class BlockType>
virtual stxxl::write_pool< BlockType >::~write_pool ( )
inlinevirtual

Waits for completion of all ongoing write requests and frees memory.

Definition at line 82 of file write_pool.h.

References STXXL_VERBOSE_WPOOL.

Member Function Documentation

template<class BlockType>
void stxxl::write_pool< BlockType >::add ( block_type *&  block)
inline
template<class BlockType>
void stxxl::write_pool< BlockType >::check_all_busy ( )
inlineprotected

Definition at line 255 of file write_pool.h.

References STXXL_VERBOSE_WPOOL.

template<class BlockType>
block_type* stxxl::write_pool< BlockType >::get ( )
inline

Definition at line 163 of file write_pool.h.

template<class BlockType>
request_ptr stxxl::write_pool< BlockType >::get_request ( bid_type  bid)
inline

Definition at line 188 of file write_pool.h.

template<class BlockType>
bool stxxl::write_pool< BlockType >::has_request ( bid_type  bid)
inline
template<class BlockType>
void stxxl::write_pool< BlockType >::resize ( unsigned_type  new_size)
inline

Resizes size of the pool.

Parameters
new_sizenew size of the pool after the call

Definition at line 170 of file write_pool.h.

References STXXL_VERBOSE_WPOOL.

template<class BlockType>
unsigned_type stxxl::write_pool< BlockType >::size ( ) const
inline

Returns number of owned blocks.

Definition at line 110 of file write_pool.h.

template<class BlockType>
block_type* stxxl::write_pool< BlockType >::steal ( )
inline

Take out a block from the pool.

Returns
pointer to the block. Ownership of the block goes to the caller.

Definition at line 141 of file write_pool.h.

References STXXL_VERBOSE_WPOOL, and stxxl::wait_any().

template<class BlockType>
block_type* stxxl::write_pool< BlockType >::steal ( bid_type  bid)
inline

Definition at line 209 of file write_pool.h.

template<class BlockType>
std::pair<block_type*, request_ptr> stxxl::write_pool< BlockType >::steal_request ( bid_type  bid)
inline
template<class BlockType>
void stxxl::write_pool< BlockType >::swap ( write_pool< BlockType > &  obj)
inline
template<class BlockType>
request_ptr stxxl::write_pool< BlockType >::write ( block_type *&  block,
bid_type  bid 
)
inline

Passes a block to the pool for writing.

Parameters
blockblock to write. Ownership of the block goes to the pool. block must be allocated dynamically with using new .
bidlocation, where to write
Warning
block must be allocated dynamically with using new .
Returns
request object of the write operation

Definition at line 118 of file write_pool.h.

References STXXL_VERBOSE_WPOOL.

Member Data Documentation

template<class BlockType>
std::list<busy_entry> stxxl::write_pool< BlockType >::busy_blocks
protected

Definition at line 61 of file write_pool.h.

Referenced by stxxl::write_pool< BlockType >::swap().

template<class BlockType>
std::list<block_type*> stxxl::write_pool< BlockType >::free_blocks
protected

Definition at line 59 of file write_pool.h.

Referenced by stxxl::write_pool< BlockType >::swap().


The documentation for this class was generated from the following file: