Jpp
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
software
JTools
JDistance.hh
Go to the documentation of this file.
1
#ifndef __JTOOLS__JDISTANCE__
2
#define __JTOOLS__JDISTANCE__
3
4
#include <limits>
5
6
#include "
JLang/JClass.hh
"
7
8
/**
9
* \author mdejong
10
*/
11
12
namespace
JTOOLS {}
13
namespace
JPP {
using namespace
JTOOLS; }
14
15
namespace
JTOOLS {
16
17
/**
18
* Template class for distance evaluation.
19
*
20
* This class should be specialised for data types when the distance
21
* between two values is not equal to the arithmetic minus operation.
22
*/
23
template
<
class
JAbscissa_t>
24
struct
JDistance
{
25
26
typedef
typename
JLANG::JClass<JAbscissa_t>::argument_type
argument_type
;
27
28
29
/**
30
* Get distance between values.
31
*
32
* The distance should be negative, zero or positive if the first value
33
* is respectively larger, equal or smaller compared to the second value.
34
*
35
* \param first first value
36
* \param second second value
37
* \return distance
38
*/
39
inline
double
operator()
(
argument_type
first,
argument_type
second)
const
40
{
41
return
second - first;
42
}
43
44
static
double
precision
;
45
};
46
47
48
/**
49
* Default precision.
50
*/
51
template
<
class
JAbscissa_t>
52
double
JDistance<JAbscissa_t>::precision
= std::numeric_limits<double>::min();
53
}
54
55
#endif
JTOOLS::JDistance
Template class for distance evaluation.
Definition:
JDistance.hh:24
JTOOLS::JDistance::precision
static double precision
Default precision.
Definition:
JDistance.hh:44
JLANG::JClass::argument_type
JArgument< T >::argument_type argument_type
Definition:
JClass.hh:64
JClass.hh
JTOOLS::JDistance::operator()
double operator()(argument_type first, argument_type second) const
Get distance between values.
Definition:
JDistance.hh:39
JTOOLS::JDistance::argument_type
JLANG::JClass< JAbscissa_t >::argument_type argument_type
Definition:
JDistance.hh:26
Generated by
1.8.5