Home Libraries Author Links

stm::inputrange_iterator< BufRangeT, ContextT > Class Template Reference
[FilesysAids: File System Aids]

List of all members.


Detailed Description

template<class BufRangeT, class ContextT>
class stm::inputrange_iterator< BufRangeT, ContextT >

Input iterator class template reading successive byte ranges from the input range of the ContextT object for which it was constructed.

After it is constructed, and everytime ++ is used, the iterator reads and stores a value of BufRangeT which shall be an iterator range class directly or indirectly derived from byte_iterator_range providing a constructor with signature

     BufRangeT (const byte *first, const byte *last, ContextT &context).
This constructor is used to construct the BufRangeT objects non-end-of-range inputrange_iterator objects refer to. Its arguments first and last specify the base object boost::iterator_range<const byte *> range with which and the argument context the input range is accessible.

ContextT shall have a type member inputrange_type designating a specialization of the class template inputrange or a directly or indirectly derived class therefrom and have a member funtion

                        inputrange_type &input ()
returning a reference to the ContextT object's input range.

If the end of the ContextT object's input range is reached, the iterator becomes equal to the end-of-range iterator value. The default constructor always constructs an end-of-range inputrange_iterator object, which is the only legitimate iterator to be used for the end condition. The result of operator* on an end-of-range is not defined. For any other iterator value a const BufRangeT& is returned, referring to a subrange at the beginning of the unprocessed range of input buffer of the ContexT object's input range. The result of operator-> on an end-of-range is not defined. For any other iterator value a const BufRangeT* is returned. It is impossible to store things into inputrange_iterator objects.

The main peculiarity of inputrange_iterator is the fact that ++ operators are not equality preserving, that is, i == j does not guarantee at all that ++i == ++j. Every time ++ is used a new BufRangeT object is read.

The practical consequence of this fact is that inputrange_iterator objects can be used only for one-pass algorithms, which actually makes perfect sense, since for multi-pass algorithms it is always more appropriate to use in memory data structures.

Two end-of-range iterators are always equal. An end-of-range iterator is not equal to a non-end-of-range iterator. Two non-end-of-range iterators are equal when they are constructed from the same ContextT object.

Definition at line 862 of file filesysaids.hpp.


Public Types

typedef BufRangeT bufrange_type
 Template type parameter BufRangeT.
typedef ContextT context_type
 Template parameter ContextT.
typedef
context_type::inputrange_type 
inputrange_type
 Input range type.

Public Member Functions

 inputrange_iterator ()
 Default constructor yielding the end-of-range object.
 inputrange_iterator (context_type &context)
 Constructor yielding the first inputrange_iterator object for context.
 inputrange_iterator (const inputrange_iterator< BufRangeT, ContextT > &that)
 Copy constructor.
 ~inputrange_iterator ()
 Destructor.
const bufrange_typeoperator * () const
 Dereference operator.
const bufrange_typeoperator-> () const
 Member access operator.
inputrange_iterator< BufRangeT,
ContextT > & 
operator++ ()
 Preincrement operator.
inputrange_iterator< BufRangeT,
ContextT > 
operator++ (int)
 Postincrement operator.
bool equal (const inputrange_iterator< BufRangeT, ContextT > &that) const
 Equality comparison operator.

Member Typedef Documentation

template<class BufRangeT, class ContextT>
typedef BufRangeT stm::inputrange_iterator< BufRangeT, ContextT >::bufrange_type

Template type parameter BufRangeT.

Definition at line 878 of file filesysaids.hpp.

template<class BufRangeT, class ContextT>
typedef ContextT stm::inputrange_iterator< BufRangeT, ContextT >::context_type

Template parameter ContextT.

Definition at line 881 of file filesysaids.hpp.

template<class BufRangeT, class ContextT>
typedef context_type::inputrange_type stm::inputrange_iterator< BufRangeT, ContextT >::inputrange_type

Input range type.

Definition at line 884 of file filesysaids.hpp.


Constructor & Destructor Documentation

template<class BufRangeT, class ContextT>
stm::inputrange_iterator< BufRangeT, ContextT >::inputrange_iterator (  ) 

Default constructor yielding the end-of-range object.

The only operations that can be done with such an object are assignment, comparison and destruction.

template<class BufRangeT, class ContextT>
stm::inputrange_iterator< BufRangeT, ContextT >::inputrange_iterator ( context_type context  ) 

Constructor yielding the first inputrange_iterator object for context.

template<class BufRangeT, class ContextT>
stm::inputrange_iterator< BufRangeT, ContextT >::inputrange_iterator ( const inputrange_iterator< BufRangeT, ContextT > &  that  ) 

Copy constructor.

template<class BufRangeT, class ContextT>
stm::inputrange_iterator< BufRangeT, ContextT >::~inputrange_iterator (  ) 

Destructor.


Member Function Documentation

template<class BufRangeT, class ContextT>
const bufrange_type& stm::inputrange_iterator< BufRangeT, ContextT >::operator * (  )  const

Dereference operator.

template<class BufRangeT, class ContextT>
const bufrange_type* stm::inputrange_iterator< BufRangeT, ContextT >::operator-> (  )  const

Member access operator.

template<class BufRangeT, class ContextT>
inputrange_iterator<BufRangeT, ContextT>& stm::inputrange_iterator< BufRangeT, ContextT >::operator++ (  ) 

Preincrement operator.

template<class BufRangeT, class ContextT>
inputrange_iterator<BufRangeT, ContextT> stm::inputrange_iterator< BufRangeT, ContextT >::operator++ ( int   ) 

Postincrement operator.

template<class BufRangeT, class ContextT>
bool stm::inputrange_iterator< BufRangeT, ContextT >::equal ( const inputrange_iterator< BufRangeT, ContextT > &  that  )  const

Equality comparison operator.


© Copyright Tom Michaelis 2002-2007

Distributed under the SysToMath Software License (See the accompanying file license.txt or a copy at www.SysToMath.com).