AFF --- A container for numbers (array) by Friederich and Forbriger.
seriesstepper.h
Go to the documentation of this file.
1 
42 // include guard
43 #ifndef AFF_SERIESSTEPPER_H_VERSION
44 
45 #define AFF_SERIESSTEPPER_H_VERSION \
46  "AFF_SERIESSTEPPER_H V1.2"
47 
48 #include<aff/lib/types.h>
49 
50 namespace aff {
51 namespace util {
52 
64  {
65  public:
67  SeriesStepper(const LinearShape& shape):
68  Mfirst_offset(shape.offset(shape.first())),
69  Mlast_offset(shape.offset(shape.last())),
70  Mbase(shape.base()),
71  Mcurrent(Mfirst_offset), Mvalid(true) { }
73  const Tsubscript& current() const { return(Mcurrent); }
75  Tsubscript index() const { return(Mcurrent+Mbase); }
81  bool more() const
82  { return(Mcurrent<Mlast_offset); }
84  bool less() const
85  { return(Mcurrent>Mfirst_offset); }
87  const bool& valid() const
88  { return(Mvalid); }
93  private:
101  bool Mvalid;
102  }; // class SeriesStepper
103 
104 } // namespace util
105 } // namespace aff
106 
107 #endif // AFF_SERIESSTEPPER_H_VERSION (includeguard)
108 
109 /* ----- END OF seriesstepper.h ----- */
Root namespace of library.
Definition: array.h:148
bool more() const
returns true if there are more elements in incr-direction
Definition: seriesstepper.h:81
some typedefs we refer to
Tsubscript Mcurrent
hold current position offset to memory
Definition: seriesstepper.h:99
Tsubscript Mfirst_offset
store current bounds to reduce execution time
Definition: seriesstepper.h:95
SeriesStepper & incr()
increment offset - return reference to itself
Tsubscript Mbase
hold base to be able to return index value
Definition: seriesstepper.h:97
bool less() const
returns true if there are more elements in decr-direction
Definition: seriesstepper.h:84
SeriesStepper & tolast()
set current element index to the last - return reference to itself
const bool & valid() const
valid if not passed end or beginning
Definition: seriesstepper.h:87
SeriesStepper & decr()
decrement offset - return reference to itself
Shape for class aff::Series.
Definition: linearshape.h:78
bool Mvalid
true while not passed start or end
A stepper for aff::Series.
Definition: seriesstepper.h:63
Tsubscript index() const
return current index vector for array access
Definition: seriesstepper.h:75
SeriesStepper & tofirst()
set current element index to the first - return reference to itself
ptrdiff_t Tsubscript
Type to hold an array&#39;s subscript value.
Definition: types.h:53
SeriesStepper(const LinearShape &shape)
only non-copy constructor
Definition: seriesstepper.h:67
const Tsubscript & current() const
return current index value for Representation access
Definition: seriesstepper.h:73