seriesstepper.cc 1.72 KB
Newer Older
thomas.forbriger's avatar
thomas.forbriger committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*! \file seriesstepper.cc
 * \brief a stepper class for aff::Series (implementation)
 * 
 * ----------------------------------------------------------------------------
 * 
 * $Id: seriesstepper.cc,v 1.1 2002-12-20 10:18:42 forbrig Exp $
 * \author Thomas Forbriger
 * \date 20/12/2002
 * 
 * a stepper class for aff::Series (implementation)
 * 
 * Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) 
 * 
 * REVISIONS and CHANGES 
 *  - 20/12/2002   V1.0   Thomas Forbriger
 * 
 * ============================================================================
 */
#define AFF_SERIESSTEPPER_CC_VERSION \
  "AFF_SERIESSTEPPER_CC   V1.0"
#define AFF_SERIESSTEPPER_CC_CVSID \
  "$Id: seriesstepper.cc,v 1.1 2002-12-20 10:18:42 forbrig Exp $"

#include <aff/lib/seriesstepper.h>

namespace aff {
namespace util {

  //! next element
  SeriesStepper& SeriesStepper::incr()
  {
    if (++Mcurrent>Mlast_offset) 
    { 
      Mcurrent=Mfirst_offset;
      Mvalid=false;
    }
    return(*this);
  }

  /*----------------------------------------------------------------------*/

  //! previous element
  SeriesStepper& SeriesStepper::decr()
  {
    if (--Mcurrent<Mfirst_offset) 
    { 
      Mcurrent=Mlast_offset;
      Mvalid=false;
    }
    return(*this);
  }

  /*----------------------------------------------------------------------*/

  //! skip to first
  SeriesStepper& SeriesStepper::tofirst()
  {
    Mcurrent=Mfirst_offset;
    Mvalid=true;
    return(*this);
  }

  /*----------------------------------------------------------------------*/

  //! skip to last
  SeriesStepper& SeriesStepper::tolast()
  {
    Mcurrent=Mlast_offset;
    Mvalid=true;
    return(*this);
  }


} // namespace util
} // namespace aff

/* ----- END OF seriesstepper.cc ----- */