dlr::common::ApproximatelyEqualFunctor< Type > Class Template Reference

Functor template for comparing two values to determine equivalence within a specified precision. More...

#include <functional.h>

Collaboration diagram for dlr::common::ApproximatelyEqualFunctor< Type >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ApproximatelyEqualFunctor (const Type &epsilon=static_cast< Type >(0))
 The constructor sets the threshold for what is considered approximately equal.
bool operator() (const Type &argument0, const Type &argument1)
 The application operator returns true if the difference between its two arguments is less than epsilon and greater than -(epsilon), where epsilon is specified in the constructor.
template<>
bool operator() (const bool &argument0, const bool &argument1)
template<>
bool operator() (const size_t &argument0, const size_t &argument1)

Protected Attributes

Type m_epsilon
 This protected member function stores the comparison tolerance.

Detailed Description

template<class Type>
class dlr::common::ApproximatelyEqualFunctor< Type >

Functor template for comparing two values to determine equivalence within a specified precision.

This is just like std::equal<>, except that it has the additional capability of allowing for numerical precision in its comparisons.

Definition at line 264 of file dlrCommon/functional.h.


Constructor & Destructor Documentation

template<class Type>
dlr::common::ApproximatelyEqualFunctor< Type >::ApproximatelyEqualFunctor ( const Type &  epsilon = static_cast<Type>(0)  )  [inline]

The constructor sets the threshold for what is considered approximately equal.

For example, if the constructor argument is 1.0E-6, then two values will be considered equal if the absolute value of their difference is less than or equal to 1.0E-6.

Parameters:
epsilon This argument sets the largest difference that will be considered equivalent.

Definition at line 278 of file dlrCommon/functional.h.


Member Function Documentation

template<class Type>
bool dlr::common::ApproximatelyEqualFunctor< Type >::operator() ( const Type &  argument0,
const Type &  argument1 
) [inline]

The application operator returns true if the difference between its two arguments is less than epsilon and greater than -(epsilon), where epsilon is specified in the constructor.

Parameters:
argument0 This argument will be compared with the second argument.
argument1 This argument will be compared with the first argument.
Returns:
The return value is true if the values are approximately equal, false otherwise.

Definition at line 296 of file dlrCommon/functional.h.

References dlr::common::ApproximatelyEqualFunctor< Type >::m_epsilon.


Member Data Documentation

template<class Type>
Type dlr::common::ApproximatelyEqualFunctor< Type >::m_epsilon [protected]

This protected member function stores the comparison tolerance.

Definition at line 304 of file dlrCommon/functional.h.

Referenced by dlr::common::ApproximatelyEqualFunctor< Type >::operator()().


The documentation for this class was generated from the following file:
Generated on Mon Jul 9 20:34:20 2007 for dlrLibs Utility Libraries by  doxygen 1.5.2