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

Detailed Description

template<class BlockType, class BidContainer>
class stxxl::hash_map::buffered_writer< BlockType, BidContainer >

Buffered writing of values. New Blocks are allocated as needed.

Definition at line 302 of file util.h.

+ Inheritance diagram for stxxl::hash_map::buffered_writer< BlockType, BidContainer >:
+ Collaboration diagram for stxxl::hash_map::buffered_writer< BlockType, BidContainer >:

Public Types

enum  { block_size = block_type::size, subblock_size = subblock_type::size }
 
typedef BidContainer bid_container_type
 
typedef BlockType block_type
 
typedef block_type::value_type subblock_type
 
typedef subblock_type::value_type value_type
 
typedef stxxl::buffered_writer
< block_type
writer_type
 

Public Member Functions

 buffered_writer (bid_container_type *c, int_type buffer_size, int_type batch_size)
 Create a new buffered writer. More...
 
 ~buffered_writer ()
 
void append (const value_type &value)
 Write given value. More...
 
template<class StreamType >
void append_from_stream (StreamType &stream)
 Write all values from given stream. More...
 
void finish_subblock ()
 Continue writing at the beginning of the next subblock. TODO more efficient. More...
 
void flush ()
 Flushes not yet written blocks. More...
 
internal_size_type i_block ()
 Index of current block. More...
 
internal_size_type i_subblock ()
 Index of current subblock. More...
 

Private Attributes

bid_container_typebids_
 sequence of allocated blocks (to be expanded as needed) More...
 
block_typeblock_
 current buffer-block More...
 
unsigned_type i_block_
 current block's index More...
 
unsigned_type i_value_
 current value's index in the range of [0..#values per block[ More...
 
unsigned_type increase_
 number of blocks to allocate in a row More...
 
writer_type writer_
 buffered writer More...
 

Additional Inherited Members

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

Member Typedef Documentation

template<class BlockType , class BidContainer >
typedef BidContainer stxxl::hash_map::buffered_writer< BlockType, BidContainer >::bid_container_type

Definition at line 306 of file util.h.

template<class BlockType , class BidContainer >
typedef BlockType stxxl::hash_map::buffered_writer< BlockType, BidContainer >::block_type

Definition at line 305 of file util.h.

template<class BlockType , class BidContainer >
typedef block_type::value_type stxxl::hash_map::buffered_writer< BlockType, BidContainer >::subblock_type

Definition at line 308 of file util.h.

template<class BlockType , class BidContainer >
typedef subblock_type::value_type stxxl::hash_map::buffered_writer< BlockType, BidContainer >::value_type

Definition at line 309 of file util.h.

template<class BlockType , class BidContainer >
typedef stxxl::buffered_writer<block_type> stxxl::hash_map::buffered_writer< BlockType, BidContainer >::writer_type

Definition at line 311 of file util.h.

Member Enumeration Documentation

template<class BlockType , class BidContainer >
anonymous enum
Enumerator
block_size 
subblock_size 

Definition at line 313 of file util.h.

Constructor & Destructor Documentation

template<class BlockType , class BidContainer >
stxxl::hash_map::buffered_writer< BlockType, BidContainer >::buffered_writer ( bid_container_type c,
int_type  buffer_size,
int_type  batch_size 
)
inline

Create a new buffered writer.

Parameters
cwrite values to these blocks (c holds the bids)
buffer_sizeNumber of write-buffers to use
batch_sizebulk buffered writing

Definition at line 339 of file util.h.

template<class BlockType , class BidContainer >
stxxl::hash_map::buffered_writer< BlockType, BidContainer >::~buffered_writer ( )
inline

Definition at line 350 of file util.h.

Member Function Documentation

template<class BlockType , class BidContainer >
void stxxl::hash_map::buffered_writer< BlockType, BidContainer >::append ( const value_type value)
inline

Write given value.

Definition at line 367 of file util.h.

References stxxl::singleton< block_manager >::get_instance(), and stxxl::block_manager::new_blocks().

template<class BlockType , class BidContainer >
template<class StreamType >
void stxxl::hash_map::buffered_writer< BlockType, BidContainer >::append_from_stream ( StreamType &  stream)
inline

Write all values from given stream.

Definition at line 357 of file util.h.

template<class BlockType , class BidContainer >
void stxxl::hash_map::buffered_writer< BlockType, BidContainer >::finish_subblock ( )
inline

Continue writing at the beginning of the next subblock. TODO more efficient.

Definition at line 395 of file util.h.

template<class BlockType , class BidContainer >
void stxxl::hash_map::buffered_writer< BlockType, BidContainer >::flush ( )
inline

Flushes not yet written blocks.

Definition at line 402 of file util.h.

References stxxl::singleton< block_manager >::get_instance(), and stxxl::block_manager::new_blocks().

template<class BlockType , class BidContainer >
internal_size_type stxxl::hash_map::buffered_writer< BlockType, BidContainer >::i_block ( )
inline

Index of current block.

Definition at line 418 of file util.h.

template<class BlockType , class BidContainer >
internal_size_type stxxl::hash_map::buffered_writer< BlockType, BidContainer >::i_subblock ( )
inline

Index of current subblock.

Definition at line 421 of file util.h.

Member Data Documentation

template<class BlockType , class BidContainer >
bid_container_type* stxxl::hash_map::buffered_writer< BlockType, BidContainer >::bids_
private

sequence of allocated blocks (to be expanded as needed)

Definition at line 325 of file util.h.

template<class BlockType , class BidContainer >
block_type* stxxl::hash_map::buffered_writer< BlockType, BidContainer >::block_
private

current buffer-block

Definition at line 322 of file util.h.

template<class BlockType , class BidContainer >
unsigned_type stxxl::hash_map::buffered_writer< BlockType, BidContainer >::i_block_
private

current block's index

Definition at line 328 of file util.h.

template<class BlockType , class BidContainer >
unsigned_type stxxl::hash_map::buffered_writer< BlockType, BidContainer >::i_value_
private

current value's index in the range of [0..#values per block[

Definition at line 330 of file util.h.

template<class BlockType , class BidContainer >
unsigned_type stxxl::hash_map::buffered_writer< BlockType, BidContainer >::increase_
private

number of blocks to allocate in a row

Definition at line 332 of file util.h.

template<class BlockType , class BidContainer >
writer_type stxxl::hash_map::buffered_writer< BlockType, BidContainer >::writer_
private

buffered writer

Definition at line 320 of file util.h.


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