KFoundation
v2.1
A Better Foundation Library for C++
|
Used to iterate over all points in a given range. More...
#include <kfoundation/RangeIterator.h>
Public Member Functions | |
RangeIterator (const Tuple &upperBound) | |
Constructor, the resulting object iterates points from origin to the given upper bound (exclusive). | |
RangeIterator (const Tuple &lowerBound, const Tuple &upperBound) | |
Constructor, the resulting object iterates points from the given lower bound (inclusive) to the given upper bound (exclusive). | |
RangeIterator (const Range &range) | |
Copy constructor. | |
~RangeIterator () | |
Deconstructor. | |
const RangeIterator & | first () |
Resets this iterator. | |
const RangeIterator & | next () |
Moves on to the next point. | |
bool | hasMore () const |
Checks if there are more points to iterator. | |
![]() | |
Tuple () | |
Default constructor, creates a tuple of size 0. | |
Tuple (kf_int8_t size) | |
Constructor, creates a tuple of the given size. | |
Tuple (const Tuple &other) | |
Copy constructor. | |
kf_int8_t | getSize () const |
Returns the size of this tuple. | |
kf_int32_t & | at (const kf_int8_t index) |
Returns the value of the element at the given index. | |
kf_int32_t | at (const kf_int8_t index) const |
Returns the value of the element at the given index. | |
void | set (const Tuple &other) |
Setter, sets the elements of this tuple to the ones of the given parameter. | |
bool | equals (const Tuple &other) const |
Checks if this tuple equals to the given parameter. | |
kf_int32_t | sumAll () const |
Returns the sum of all the elements. | |
kf_int64_t | productAll () const |
Returns the product of all elements. | |
Tuple | max (const Tuple &other) const |
Returns the value of the element with the highest value. | |
Tuple | min (const Tuple &other) const |
Returns the value of the element with the lowest value. | |
Tuple | negate () const |
Negates all the elements. More... | |
Tuple | operator- () const |
Additive inverse operator. More... | |
Tuple | operator+ (const Tuple &other) const |
Addition operator. More... | |
Tuple | operator- (const Tuple &other) const |
Substraction operator. More... | |
Tuple | operator+ (const int n) const |
Adds the given scalar to all elements of this tuple. More... | |
Tuple | operator- (const int n) const |
Substracts the given scalar from all elements of this tuple. More... | |
Tuple | operator* (const int n) const |
Multiplies all elements of this tuple by the given number. More... | |
Tuple | operator* (const Tuple &other) const |
Multiplies all elements of this tuple by the given number. More... | |
Tuple | operator/ (const int n) const |
Divides all elements of this tuple by the given number. More... | |
Tuple | operator/ (const Tuple &other) const |
Divides each element of this tuple by corresponding element of the given tuple. More... | |
Tuple | operator% (const Tuple &other) const |
Calculates remainder of each element of this tuple divided by corresponding element of the given tuple. More... | |
bool | operator== (const Tuple &other) const |
Equality operator. | |
void | printToStream (Ref< OutputStream > os) const |
Implements compatibility with Streamer interface. | |
![]() | |
virtual RefConst< UString > | toString () const |
Converts the result of invocation of printToStream(ostream&) to a std::string object. | |
Additional Inherited Members | |
![]() | |
static Tuple | one (kf_int8_t size) |
Returns a unity tuple of the given size. | |
static Tuple | zero (kf_int8_t size) |
Returns a zero tuple of the given size. | |
Used to iterate over all points in a given range.
The begining of the range is inclusive and the end of it is exclusive. Usage:
Range r(Tupel2D(10, 10), Tuple2D(20, 30)); for(RangeIterator(r); r.hasMore(); r.next()) { Tuple point = r; ... do somethinf with r ... }