/*! \file seriesstepper.h * \brief a stepper class for aff::Series (prototypes) * * ---------------------------------------------------------------------------- * * $Id: seriesstepper.h,v 1.1 2002-12-20 10:18:43 forbrig Exp $ * \author Thomas Forbriger * \date 20/12/2002 * * a stepper class for aff::Series (prototypes) * * \note * This file is automatically included through aff/series.h * * Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) * * REVISIONS and CHANGES * - 20/12/2002 V1.0 Thomas Forbriger * * ============================================================================ */ // include guard #ifndef AFF_SERIESSTEPPER_H_VERSION #define AFF_SERIESSTEPPER_H_VERSION \ "AFF_SERIESSTEPPER_H V1.0" #define AFF_SERIESSTEPPER_H_CVSID \ "$Id: seriesstepper.h,v 1.1 2002-12-20 10:18:43 forbrig Exp $" #include namespace aff { namespace util { /*! \brief A stepper for aff::Series * * If we provide a stepper class, The aff::Iterator template can work with * the aff::Series. * * This class cycles through the offset range of an aff::Series. It is used * internally within aff::Series::operator=() for value assignment. And it * is used within the aff::Iterator and aff::Browser classes. You normally * will not use it directly. */ class SeriesStepper { //! only non-copy constructor SeriesStepper(const Tsubscript& first, const Tsubscript& last, const Tsize& base): Mfirst_offset(first-base), Mlast_offset(last-base), Mbase(base), Mcurrent(first-base), Mvalid(true) { } //! return current index value for Representation access const Tsubscript& current() const { return(Mcurrent); } //! return current index vector for array access Tsubscript index() const { return(Mcurrent+Mbase); } //! increment offset - return reference to itself SeriesStepper& incr(); //! decrement offset - return reference to itself SeriesStepper& decr(); //! returns true if there are more elements in incr-direction bool more() const { return(McurrentMfirst_offset); } //! valid if not passed end or beginning const bool& valid() const { return(Mvalid); } //! set current element index to the first - return reference to itself SeriesStepper& tofirst(); //! set current element index to the last - return reference to itself SeriesStepper& tolast(); private: //! store current bounds to reduce execution time Tsubscript Mfirst_offset, Mlast_offset; //! hold reference to shape Tsize Mbase; //! hold current position offset to memory Tsubscript Mcurrent; //! true while not passed start or end bool Mvalid; }; // class SeriesStepper } // namespace util } // namespace aff #endif // AFF_SERIESSTEPPER_H_VERSION (includeguard) /* ----- END OF seriesstepper.h ----- */