sgdk::ZeroChecker<> Class Template Reference
[Floating Point Checker Module]

#include <swiss_gd_knife/math/zero_checker.hpp>

List of all members.


Detailed Description

template<>
class sgdk::ZeroChecker<>

This class checks if its input values are within a user-defined "zero range".


Template parameters

Parameter Description Default
RealNumber The type of the input value that this class will check. float


Model of


Type requirements



Public Member Functions

 ZeroChecker (const RealNumber zero_tolerance=0.00001f)
 The default constructor.
 ZeroChecker (const ZeroChecker &copy)
 The copy constructor.
ZeroCheckeroperator= (const ZeroChecker &copy)
 The assignment operator.
bool isZero (const RealNumber zero) const
RealNumber getZeroTolerance () const
void setZeroTolerance (const RealNumber zero_tolerance)


Constructor & Destructor Documentation

sgdk::ZeroChecker<>::ZeroChecker const RealNumber  zero_tolerance = 0.00001f  )  [inline, explicit]
 

Constructs a new ZeroChecker, whereupon a subsequent isZero() call returns true if and only if the input parameter to that call is in the range [-|zero_tolerance|, |zero_tolerance|].

Parameters:
zero_tolerance the limit of the zero range. The default value is 0.00001f.
See also:
setZeroTolerance()

sgdk::ZeroChecker<>::ZeroChecker const ZeroChecker<> &  copy  )  [inline]
 

Constructs a new ZeroChecker whose zero range is the same as that of the one being copied at this point in time.

Parameters:
copy the ZeroChecker being copied.


Member Function Documentation

ZeroChecker& sgdk::ZeroChecker<>::operator= const ZeroChecker<> &  copy  )  [inline]
 

Sets this ZeroChecker to be internally equivalent to the copy.

Parameters:
copy the ZeroChecker being copied.
Returns:
a reference to this ZeroChecker.

bool sgdk::ZeroChecker<>::isZero const RealNumber  zero  )  const [inline]
 

Returns true if the input value is in the range [-getZeroTolerance(), getZeroTolerance()], false otherwise.

Parameters:
zero the input value.
Returns:
true if the input value is in the zero range, false otherwise.

RealNumber sgdk::ZeroChecker<>::getZeroTolerance  )  const [inline]
 

Returns the upper limit of the range specified either during construction or by the last setZeroTolerance() call, whichever occured last.

Returns:
the upper limit of the zero range.
See also:
isZero()

void sgdk::ZeroChecker<>::setZeroTolerance const RealNumber  zero_tolerance  )  [inline]
 

Sets a subsequent isZero() call to return true if the input parameter to that call is in the range [-|zero_tolerance|, |zero_tolerance|].

Parameters:
zero_tolerance the limit of the zero range.
See also:
ZeroChecker()


Swiss GD Knife is hosted by SourceForge.net.