STXXL  1.4-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stxxl::vector_bufwriter< VectorIteratorType > Class Template Reference

Detailed Description

template<typename VectorIteratorType>
class stxxl::vector_bufwriter< VectorIteratorType >

Buffered sequential writer to a vector using overlapped I/O.

This buffered writer can be used to write a large sequential region of a vector using overlapped I/O. The object is created from an iterator range, which can then be written to using operator << (), or with operator * () and operator ++ ().

The buffered writer is given one iterator in the constructor. When writing, this iterator advances in the vector and will enlarge the vector once it reaches the end(). The vector size is doubled each time; nevertheless, it is better to preinitialize the vector's size using stxxl::vector::resize().

See Efficient Sequential Reading and Writing to Vectors

Definition at line 268 of file vector.h.

+ Inheritance diagram for stxxl::vector_bufwriter< VectorIteratorType >:
+ Collaboration diagram for stxxl::vector_bufwriter< VectorIteratorType >:

Public Types

typedef
iterator::bids_container_iterator 
bids_container_iterator
 block identifier iterator of the vector More...
 
typedef iterator::block_type block_type
 block type used in the vector More...
 
typedef buf_ostream
< block_type,
bids_container_iterator
buf_ostream_type
 construct output buffered stream used for overlapped writing More...
 
typedef VectorIterator iterator
 template parameter: the vector iterator type More...
 
typedef iterator::value_type value_type
 value type of the output vector More...
 
typedef iterator::const_iterator vector_const_iterator
 
typedef iterator::iterator vector_iterator
 iterator type of vector More...
 
typedef iterator::vector_type vector_type
 type of the output vector More...
 

Public Member Functions

 vector_bufwriter (vector_iterator begin, unsigned_type nbuffers=0)
 Create overlapped writer beginning at the given iterator. More...
 
 vector_bufwriter (vector_type &vec, unsigned_type nbuffers=0)
 Create overlapped writer for the vector's beginning. More...
 
 ~vector_bufwriter ()
 Finish writing and flush output back to vector. More...
 
void finish ()
 Finish writing and flush output back to vector. More...
 
value_typeoperator* ()
 Return mutable reference to item at the position of the internal iterator. More...
 
vector_bufwriteroperator++ ()
 Advance internal iterator. More...
 
vector_bufwriteroperator<< (const value_type &v)
 Write value to the current position and advance the internal iterator. More...
 

Protected Attributes

buf_ostream_typem_bufout
 buffered output stream used to overlapped I/O. More...
 
vector_const_iterator m_end
 iterator to the current end of the vector. More...
 
bool m_grown
 boolean whether the vector was grown, will shorten at finish(). More...
 
vector_iterator m_iter
 internal iterator into the vector. More...
 
unsigned_type m_nbuffers
 number of blocks to use as buffers. More...
 
vector_const_iterator m_prevblk
 iterator into vector of the last block accessed (used to issue updates when the block is switched). More...
 

Additional Inherited Members

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

Member Typedef Documentation

template<typename VectorIteratorType >
typedef iterator::bids_container_iterator stxxl::vector_bufwriter< VectorIteratorType >::bids_container_iterator

block identifier iterator of the vector

Definition at line 2384 of file vector.h.

template<typename VectorIteratorType >
typedef iterator::block_type stxxl::vector_bufwriter< VectorIteratorType >::block_type

block type used in the vector

Definition at line 2381 of file vector.h.

template<typename VectorIteratorType >
typedef buf_ostream<block_type, bids_container_iterator> stxxl::vector_bufwriter< VectorIteratorType >::buf_ostream_type

construct output buffered stream used for overlapped writing

Definition at line 2391 of file vector.h.

template<typename VectorIteratorType >
typedef VectorIterator stxxl::vector_bufwriter< VectorIteratorType >::iterator

template parameter: the vector iterator type

Definition at line 2372 of file vector.h.

template<typename VectorIteratorType >
typedef iterator::value_type stxxl::vector_bufwriter< VectorIteratorType >::value_type

value type of the output vector

Definition at line 2378 of file vector.h.

template<typename VectorIteratorType >
typedef iterator::const_iterator stxxl::vector_bufwriter< VectorIteratorType >::vector_const_iterator

Definition at line 2388 of file vector.h.

template<typename VectorIteratorType >
typedef iterator::iterator stxxl::vector_bufwriter< VectorIteratorType >::vector_iterator

iterator type of vector

Definition at line 2387 of file vector.h.

template<typename VectorIteratorType >
typedef iterator::vector_type stxxl::vector_bufwriter< VectorIteratorType >::vector_type

type of the output vector

Definition at line 2375 of file vector.h.

Constructor & Destructor Documentation

template<typename VectorIteratorType >
stxxl::vector_bufwriter< VectorIteratorType >::vector_bufwriter ( vector_iterator  begin,
unsigned_type  nbuffers = 0 
)
inline

Create overlapped writer beginning at the given iterator.

Parameters
beginiterator to position were to start writing in vector
nbuffersnumber of buffers used for overlapped I/O (>= 2D recommended)

Definition at line 2417 of file vector.h.

template<typename VectorIteratorType >
stxxl::vector_bufwriter< VectorIteratorType >::vector_bufwriter ( vector_type vec,
unsigned_type  nbuffers = 0 
)
inline

Create overlapped writer for the vector's beginning.

Parameters
vecvector to write
nbuffersnumber of buffers used for overlapped I/O (>= 2D recommended)

Definition at line 2434 of file vector.h.

template<typename VectorIteratorType >
stxxl::vector_bufwriter< VectorIteratorType >::~vector_bufwriter ( )
inline

Finish writing and flush output back to vector.

Definition at line 2449 of file vector.h.

Member Function Documentation

template<typename VectorIteratorType >
void stxxl::vector_bufwriter< VectorIteratorType >::finish ( )
inline

Finish writing and flush output back to vector.

Definition at line 2546 of file vector.h.

template<typename VectorIteratorType >
value_type& stxxl::vector_bufwriter< VectorIteratorType >::operator* ( )
inline

Return mutable reference to item at the position of the internal iterator.

Definition at line 2456 of file vector.h.

References UNLIKELY.

template<typename VectorIteratorType >
vector_bufwriter& stxxl::vector_bufwriter< VectorIteratorType >::operator++ ( )
inline

Advance internal iterator.

Definition at line 2525 of file vector.h.

References LIKELY.

template<typename VectorIteratorType >
vector_bufwriter& stxxl::vector_bufwriter< VectorIteratorType >::operator<< ( const value_type v)
inline

Write value to the current position and advance the internal iterator.

Definition at line 2537 of file vector.h.

References operator++().

Member Data Documentation

template<typename VectorIteratorType >
buf_ostream_type* stxxl::vector_bufwriter< VectorIteratorType >::m_bufout
protected

buffered output stream used to overlapped I/O.

Definition at line 2408 of file vector.h.

template<typename VectorIteratorType >
vector_const_iterator stxxl::vector_bufwriter< VectorIteratorType >::m_end
protected

iterator to the current end of the vector.

Definition at line 2398 of file vector.h.

template<typename VectorIteratorType >
bool stxxl::vector_bufwriter< VectorIteratorType >::m_grown
protected

boolean whether the vector was grown, will shorten at finish().

Definition at line 2401 of file vector.h.

template<typename VectorIteratorType >
vector_iterator stxxl::vector_bufwriter< VectorIteratorType >::m_iter
protected

internal iterator into the vector.

Definition at line 2395 of file vector.h.

template<typename VectorIteratorType >
unsigned_type stxxl::vector_bufwriter< VectorIteratorType >::m_nbuffers
protected

number of blocks to use as buffers.

Definition at line 2411 of file vector.h.

template<typename VectorIteratorType >
vector_const_iterator stxxl::vector_bufwriter< VectorIteratorType >::m_prevblk
protected

iterator into vector of the last block accessed (used to issue updates when the block is switched).

Definition at line 2405 of file vector.h.


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