code::SentinelDouble Class Reference

List of all members.

Detailed Description

Sentinel values are values that represent some condition.

You can use sentinel values only for setting/getting values to floating point numbers, and to do equal/not-equal operations. This class ensures that sentinels are used such that round-off errors are handled.

     SentinelDouble MissingTemperature( -999, 0.1 );
     double v = getTemperature();
     if ( v != MissingTemperature ){
       return ( 1.4*v + 32 );
     } else
       return 72;
     

See also:
Constants::MissingData
Author:
Lakshman
Version:
Id
code_Constants.h,v 1.23 2009/06/02 20:17:38 lakshman Exp


Public Member Functions

 SentinelDouble (int value_in, double tolerance_in)
 the input value has to be an integer value.
 SentinelDouble ()
 For STL use only -- variables remain uninitialized!
 operator const int & () const
 WARNING! this is meant for use simply to set values i.e.

Friends

template<class T>
bool operator== (const SentinelDouble &a, T b)
 overload comparision for char, short, int, float and double
template<class T>
bool operator== (T b, const SentinelDouble &a)
template<class T>
bool operator!= (const SentinelDouble &a, T b)
template<class T>
bool operator!= (T b, const SentinelDouble &a)


Constructor & Destructor Documentation

code::SentinelDouble::SentinelDouble ( int  value_in,
double  tolerance_in 
) [inline]

the input value has to be an integer value.

This class allows comparisions with doubles in a tolerant way.

code::SentinelDouble::SentinelDouble (  )  [inline]

For STL use only -- variables remain uninitialized!


Member Function Documentation

code::SentinelDouble::operator const int & (  )  const [inline]

WARNING! this is meant for use simply to set values i.e.

double m = Constants::MissingData Do not use m for future comparisions. Use the value wrapped within the class (Constants::MissingData) for all comparisions.


Friends And Related Function Documentation

template<class T>
bool operator!= ( b,
const SentinelDouble a 
) [friend]

template<class T>
bool operator!= ( const SentinelDouble a,
b 
) [friend]

template<class T>
bool operator== ( b,
const SentinelDouble a 
) [friend]

template<class T>
bool operator== ( const SentinelDouble a,
b 
) [friend]

overload comparision for char, short, int, float and double


Generated on Fri May 4 13:40:12 2012 for WDSS-IIw2 by  doxygen 1.4.7