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

Detailed Description

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

Buffered sequential reverse reader from a vector using overlapped I/O.

This buffered reader can be used to read a large sequential region of a vector in_reverse using overlapped I/O. The object is created from an iterator range, which can then be read to using operator<<(), or with operator*() and operator++(), where ++ actually goes to the preceding element.

The interface also fulfills all requirements of a stream. Actually most of the code is identical to stream::vector_iterator2stream.

Note that this buffered reader is inefficient for reading small ranges. This is intentional, as one can just use operator[] on the vector for that.

See Efficient Sequential Reading and Writing to Vectors

Definition at line 265 of file vector.h.

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

Public Types

typedef
vector_iterator::bids_container_iterator 
bids_container_iterator
 block identifier iterator of the vector More...
 
typedef vector_iterator::block_type block_type
 block type used in the vector More...
 
typedef buf_istream_reverse
< block_type,
bids_container_iterator
buf_istream_type
 construct output buffered stream used for overlapped reading More...
 
typedef vector_type::size_type size_type
 size of remaining data More...
 
typedef vector_iterator::value_type value_type
 value type of the output vector More...
 
typedef VectorIterator vector_iterator
 template parameter: the vector iterator type More...
 
typedef
vector_iterator::vector_type 
vector_type
 type of the input vector More...
 

Public Member Functions

 vector_bufreader_reverse (vector_iterator begin, vector_iterator end, unsigned_type nbuffers=0)
 Create overlapped reader for the given iterator range. More...
 
 vector_bufreader_reverse (const vector_type &vec, unsigned_type nbuffers=0)
 Create overlapped reader for the whole vector's content. More...
 
 ~vector_bufreader_reverse ()
 Finish reading and free buffered reader. More...
 
bool empty () const
 Returns true once the whole range has been read. More...
 
const value_typeoperator* () const
 Return constant reference to current item. More...
 
vector_bufreader_reverseoperator++ ()
 Advance to next item (asserts if !empty()). More...
 
const value_typeoperator-> () const
 Return constant pointer to current item. More...
 
vector_bufreader_reverseoperator>> (value_type &v)
 Read current item into variable and advance to next one. More...
 
void rewind ()
 Rewind stream back to begin. Note that this recreates the buffered reader and is thus not cheap. More...
 
size_type size () const
 Return remaining size. More...
 

Protected Attributes

vector_iterator m_begin
 iterator to the beginning of the range. More...
 
buf_istream_typem_bufin
 buffered input stream used to overlapped I/O. More...
 
vector_iterator m_end
 iterator to the end of the range. More...
 
vector_iterator m_iter
 internal "current" iterator into the vector. More...
 
unsigned_type m_nbuffers
 number of blocks to use as buffers. More...
 

Additional Inherited Members

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

Member Typedef Documentation

template<typename VectorIteratorType >
typedef vector_iterator::bids_container_iterator stxxl::vector_bufreader_reverse< VectorIteratorType >::bids_container_iterator

block identifier iterator of the vector

Definition at line 2207 of file vector.h.

template<typename VectorIteratorType >
typedef vector_iterator::block_type stxxl::vector_bufreader_reverse< VectorIteratorType >::block_type

block type used in the vector

Definition at line 2201 of file vector.h.

template<typename VectorIteratorType >
typedef buf_istream_reverse<block_type, bids_container_iterator> stxxl::vector_bufreader_reverse< VectorIteratorType >::buf_istream_type

construct output buffered stream used for overlapped reading

Definition at line 2210 of file vector.h.

template<typename VectorIteratorType >
typedef vector_type::size_type stxxl::vector_bufreader_reverse< VectorIteratorType >::size_type

size of remaining data

Definition at line 2213 of file vector.h.

template<typename VectorIteratorType >
typedef vector_iterator::value_type stxxl::vector_bufreader_reverse< VectorIteratorType >::value_type

value type of the output vector

Definition at line 2198 of file vector.h.

template<typename VectorIteratorType >
typedef VectorIterator stxxl::vector_bufreader_reverse< VectorIteratorType >::vector_iterator

template parameter: the vector iterator type

Definition at line 2195 of file vector.h.

template<typename VectorIteratorType >
typedef vector_iterator::vector_type stxxl::vector_bufreader_reverse< VectorIteratorType >::vector_type

type of the input vector

Definition at line 2204 of file vector.h.

Constructor & Destructor Documentation

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

Create overlapped reader for the given iterator range.

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

Definition at line 2236 of file vector.h.

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

Create overlapped reader for the whole vector's content.

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

Definition at line 2253 of file vector.h.

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

Finish reading and free buffered reader.

Definition at line 2295 of file vector.h.

Member Function Documentation

template<typename VectorIteratorType >
bool stxxl::vector_bufreader_reverse< VectorIteratorType >::empty ( ) const
inline

Returns true once the whole range has been read.

Definition at line 2344 of file vector.h.

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

Return constant reference to current item.

Definition at line 2301 of file vector.h.

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

Advance to next item (asserts if !empty()).

Definition at line 2313 of file vector.h.

References UNLIKELY.

template<typename VectorIteratorType >
const value_type* stxxl::vector_bufreader_reverse< VectorIteratorType >::operator-> ( ) const
inline

Return constant pointer to current item.

Definition at line 2307 of file vector.h.

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

Read current item into variable and advance to next one.

Definition at line 2328 of file vector.h.

References operator++().

template<typename VectorIteratorType >
void stxxl::vector_bufreader_reverse< VectorIteratorType >::rewind ( )
inline

Rewind stream back to begin. Note that this recreates the buffered reader and is thus not cheap.

Definition at line 2268 of file vector.h.

template<typename VectorIteratorType >
size_type stxxl::vector_bufreader_reverse< VectorIteratorType >::size ( ) const
inline

Return remaining size.

Definition at line 2337 of file vector.h.

Member Data Documentation

template<typename VectorIteratorType >
vector_iterator stxxl::vector_bufreader_reverse< VectorIteratorType >::m_begin
protected

iterator to the beginning of the range.

Definition at line 2217 of file vector.h.

template<typename VectorIteratorType >
buf_istream_type* stxxl::vector_bufreader_reverse< VectorIteratorType >::m_bufin
protected

buffered input stream used to overlapped I/O.

Definition at line 2226 of file vector.h.

template<typename VectorIteratorType >
vector_iterator stxxl::vector_bufreader_reverse< VectorIteratorType >::m_end
protected

iterator to the end of the range.

Definition at line 2223 of file vector.h.

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

internal "current" iterator into the vector.

Definition at line 2220 of file vector.h.

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

number of blocks to use as buffers.

Definition at line 2229 of file vector.h.


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