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

Detailed Description

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

Encapsulates asynchronous buffered block writing engine.

buffered_writer overlaps I/Os with filling of output buffer.

Definition at line 36 of file buf_writer.h.

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

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...
 
 ~buffered_writer ()
 Flushes not yet written buffers and frees used memory. More...
 
void flush ()
 Flushes not yet written buffers. More...
 
block_typeget_free_block ()
 Returns free block from the internal buffer pool. More...
 
block_typewrite (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
 

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_typewrite_buffers
 
request_ptrwrite_reqs
 
const unsigned_type writebatchsize
 

Private Types

typedef block_type::bid_type bid_type
 
typedef BlockType block_type
 

Additional Inherited Members

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

Member Typedef Documentation

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

Definition at line 66 of file buf_writer.h.

template<typename BlockType>
typedef block_type::bid_type stxxl::buffered_writer< BlockType >::bid_type
private

Definition at line 39 of file buf_writer.h.

template<typename BlockType>
typedef BlockType stxxl::buffered_writer< BlockType >::block_type
private

Definition at line 38 of file buf_writer.h.

Constructor & Destructor Documentation

template<typename BlockType>
stxxl::buffered_writer< BlockType >::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 74 of file buf_writer.h.

template<typename BlockType>
stxxl::buffered_writer< BlockType >::~buffered_writer ( )
inline

Flushes not yet written buffers and frees used memory.

Definition at line 189 of file buf_writer.h.

Member Function Documentation

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

Flushes not yet written buffers.

Definition at line 157 of file buf_writer.h.

template<typename BlockType>
block_type* stxxl::buffered_writer< BlockType >::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 BlockType>
block_type* stxxl::buffered_writer< BlockType >::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 BlockType>
batch_type stxxl::buffered_writer< BlockType >::batch_write_blocks
protected

Definition at line 67 of file buf_writer.h.

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

Definition at line 49 of file buf_writer.h.

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

Definition at line 48 of file buf_writer.h.

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

Definition at line 42 of file buf_writer.h.

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

Definition at line 44 of file buf_writer.h.

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

Definition at line 43 of file buf_writer.h.

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

Definition at line 45 of file buf_writer.h.

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

Definition at line 46 of file buf_writer.h.


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