This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Indoor/math/stats/Minimum.h
kazu 51c0945e12 statistic helper classes
test-cases
modified grid importance for better trap-detection
2016-10-01 13:17:14 +02:00

41 lines
612 B
C++

#ifndef STATS_MINIMUM_H
#define STATS_MINIMUM_H
namespace Stats {
template <typename Scalar> class Minimum {
private:
const Scalar START = +999999999;
Scalar curMin;
public:
/** ctor */
Minimum() : curMin(START) {
;
}
/** is a valid minimum available? */
inline bool isValid() const {
return curMin != START;
}
/** add a new value */
void add(const Scalar val) {
if (val < curMin) {curMin = val;}
}
/** get the current value */
Scalar get() const {
Assert::notEqual(curMin, START, "add() values first!");
return curMin;
}
};
}
#endif // STATS_MINIMUM_H