AFF --- A container for numbers (array) by Friederich and Forbriger.
stridedstepper.h
Go to the documentation of this file.
1 
47 // include guard
48 #ifndef AFF_STRIDEDSTEPPER_H_VERSION
49 
50 #define AFF_STRIDEDSTEPPER_H_VERSION \
51  "AFF_STRIDEDSTEPPER,H_H V1.3"
52 
53 #include<aff/lib/strided.h>
54 
55 namespace aff {
56 namespace util {
57 
65 {
66  public:
73  //
75  StridedStepper(const Strided& strided);
77  const Tsubscript& current() const { return(Mcurrent); }
79  const TIndexVec& index() const { return(Mindex); }
81  const Tsubscript& index(const Tdim& i) const { return(Mindex[i]); }
87  bool more() const
88  { return(Mcurrent<Mlast_offset); }
90  bool less() const
91  { return(Mcurrent>Mfirst_offset); }
93  const bool& valid() const
94  { return(Mvalid); }
97  {
100  Mvalid=true;
101  return(*this);
102  }
105  {
106  Mindex=Mshape.last();
108  Mvalid=true;
109  return(*this);
110  }
111  private:
113  const Tshape& Mshape;
121  bool Mvalid;
124 
125 }; // StridedStepper
126 
127 } // namespace util
128 
129 } // namespace aff
130 
131 #endif // AFF_STRIDEDSTEPPER_H_VERSION (includeguard)
132 
133 /* ----- END OF stridedstepper.h ----- */
StridedStepper & decr()
decrement offset - return reference to itself
Root namespace of library.
Definition: array.h:148
Shape for a rectangular array layout.
Definition: strided.h:117
Tshape::TIndexVec TIndexVec
type of stride array
aff::Strided Tshape
Type of Shape corresponding class.
StridedStepper(const Strided &strided)
only non-copy constructor
Tsubscript Mfirst_offset
store current bounds to reduce execution time
Tsubscript Mcurrent
hold current position offset to memory
const Tsubscript & index(const Tdim &i) const
return current index vector for array access
bool more() const
returns true if there are more elements in incr-direction
Tsubscript last_offset() const
last mapped position
Definition: strided.h:191
StridedStepper & incr()
increment offset - return reference to itself
const TIndexVec & index() const
return current index vector for array access
const Tsubscript & first(const Tsubscript &i) const
first index of dimension
Definition: strided.h:194
A very basic rigid array class (with deep inline copy).
Definition: simplearray.h:94
TIndexVec Mindex
hold current index vector
StridedStepper & tolast()
set current element index to the last - return reference to itself
shape of s strided array (prototypes)
TSizeVec Mcarry
hold carry values
Tshape::TSizeVec TSizeVec
type of limit arrays
const Tsubscript & current() const
return current index value for Representation access
Tsubscript first_offset() const
first mapped position
Definition: strided.h:188
unsigned short int Tdim
Type to hold an array dimensionality.
Definition: types.h:49
StridedStepper & tofirst()
set current element index to the first - return reference to itself
A stepper for all strided shapes.
ptrdiff_t Tsubscript
Type to hold an array&#39;s subscript value.
Definition: types.h:53
const bool & valid() const
valid if not passed end or beginning
bool less() const
returns true if there are more elements in decr-direction
const Tshape & Mshape
hold reference to shape
const Tsubscript & last(const Tsubscript &i) const
last index of dimension
Definition: strided.h:197