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

Detailed Description

template<typename block_type>
class stxxl::buffered_writer< block_type >

Encapsulates asynchronous buffered block writing engine.

buffered_writer overlaps I/Os with filling of output buffer.

Definition at line 38 of file buf_writer.h.

+ Inheritance diagram for stxxl::buffered_writer< block_type >:
+ Collaboration diagram for stxxl::buffered_writer< block_type >:

Classes

struct  batch_entry
 
struct  batch_entry_cmp
 

Public Member Functions

 buffered_writer (unsigned_type write_buf_size, unsigned_type write_batch_size)
 Constructs an object. More...
 
virtual ~buffered_writer ()
 Flushes not yet written buffers and frees used memory. More...
 
void flush ()
 Flushes not yet written buffers. More...
 
block_type * get_free_block ()
 Returns free block from the internal buffer pool. More...
 
block_type * write (block_type *filled_block, const bid_type &bid)
 Submits block for writing. More...
 

Protected Types

typedef std::priority_queue
< batch_entry, std::vector
< batch_entry >
, batch_entry_cmp
batch_type
 
typedef block_type::bid_type bid_type
 

Protected Attributes

batch_type batch_write_blocks
 
std::vector< int_typebusy_write_blocks
 
std::vector< int_typefree_write_blocks
 
const unsigned_type nwriteblocks
 
bid_typewrite_bids
 
block_type * write_buffers
 
request_ptrwrite_reqs
 
const unsigned_type writebatchsize
 

Additional Inherited Members

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

Member Typedef Documentation

template<typename block_type>
typedef std::priority_queue<batch_entry, std::vector<batch_entry>, batch_entry_cmp> stxxl::buffered_writer< block_type >::batch_type
protected

Definition at line 67 of file buf_writer.h.

template<typename block_type>
typedef block_type::bid_type stxxl::buffered_writer< block_type >::bid_type
protected

Definition at line 41 of file buf_writer.h.

Constructor & Destructor Documentation

template<typename block_type>
stxxl::buffered_writer< block_type >::buffered_writer ( unsigned_type  write_buf_size,
unsigned_type  write_batch_size 
)
inline

Constructs an object.

Parameters
write_buf_sizenumber of write buffers to use
write_batch_sizenumber of blocks to accumulate in order to flush write requests (bulk buffered writing)

Definition at line 75 of file buf_writer.h.

template<typename block_type>
virtual stxxl::buffered_writer< block_type >::~buffered_writer ( )
inlinevirtual

Flushes not yet written buffers and frees used memory.

Definition at line 189 of file buf_writer.h.

Member Function Documentation

template<typename block_type>
void stxxl::buffered_writer< block_type >::flush ( )
inline

Flushes not yet written buffers.

Definition at line 157 of file buf_writer.h.

template<typename block_type>
block_type* stxxl::buffered_writer< block_type >::get_free_block ( )
inline

Returns free block from the internal buffer pool.

Returns
pointer to the block from the internal buffer pool

Definition at line 90 of file buf_writer.h.

template<typename block_type>
block_type* stxxl::buffered_writer< block_type >::write ( block_type *  filled_block,
const bid_type bid 
)
inline

Submits block for writing.

Parameters
filled_blockpointer to the block
Remarks
parameter filled_block must be value returned by get_free_block() or write() methods
Parameters
bidblock identifier, a place to write data of the filled_block
Returns
pointer to the new free block from the pool

Definition at line 130 of file buf_writer.h.

Member Data Documentation

template<typename block_type>
batch_type stxxl::buffered_writer< block_type >::batch_write_blocks
protected

Definition at line 68 of file buf_writer.h.

template<typename block_type>
std::vector<int_type> stxxl::buffered_writer< block_type >::busy_write_blocks
protected

Definition at line 50 of file buf_writer.h.

template<typename block_type>
std::vector<int_type> stxxl::buffered_writer< block_type >::free_write_blocks
protected

Definition at line 49 of file buf_writer.h.

template<typename block_type>
const unsigned_type stxxl::buffered_writer< block_type >::nwriteblocks
protected

Definition at line 43 of file buf_writer.h.

template<typename block_type>
bid_type* stxxl::buffered_writer< block_type >::write_bids
protected

Definition at line 45 of file buf_writer.h.

template<typename block_type>
block_type* stxxl::buffered_writer< block_type >::write_buffers
protected

Definition at line 44 of file buf_writer.h.

template<typename block_type>
request_ptr* stxxl::buffered_writer< block_type >::write_reqs
protected

Definition at line 46 of file buf_writer.h.

template<typename block_type>
const unsigned_type stxxl::buffered_writer< block_type >::writebatchsize
protected

Definition at line 47 of file buf_writer.h.


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