Loading...
Searching...
No Matches
DoubleParameter Class Reference
Inheritance diagram for DoubleParameter:
[legend]
Collaboration diagram for DoubleParameter:
[legend]

## Public Member Functions

| DoubleParameter (char c, const char *desc, double &v)
virtual void | Status ()
DoubleParameter & | SetPrecision (int precision)
Public Member Functions inherited from Parameter
| Parameter (char c, const char *desc, void *v)
virtual bool | Read (int argc, char **argv, int argn)
virtual void | addParamsToString (String &params)
void | SetWarningBuffer (String &buffer)
void | warning (const char *format,...)

## Protected Member Functions

virtual void | Translate (const char *value)
virtual bool | TranslateExtras (const char *value, const char *extras)

## Protected Attributes

int | precision
Protected Attributes inherited from Parameter
char | ch
char * | description
void * | var
String * | warnings
bool | myNoPhoneHome
String | myVersion

## Additional Inherited Members

Static Public Member Functions inherited from Parameter
static void | SetNameLen (int len)
static void | SetStatusLen (int len)
Static Protected Member Functions inherited from Parameter
static bool | CheckInteger (const char *value)
static bool | CheckDouble (const char *value)
Static Protected Attributes inherited from Parameter
static const char | PARAM_STR_SEP = ','
static int | nameCol = 30
static int | statusCol = 15

## Detailed Description

Definition at line 141 of file Parameters.h.

## Constructor & Destructor Documentation

## DoubleParameter()

DoubleParameter::DoubleParameter | ( | char | c,
|  | const char * | desc,
|  | double & | v )

Definition at line 130 of file Parameters.cpp.

: Parameter(c, desc, &v)
{
precision = 2;
}

## Member Function Documentation

## SetPrecision()

DoubleParameter & DoubleParameter::SetPrecision | ( | int | precision | ) |

inline

Definition at line 148 of file Parameters.h.

{
this->precision = precision;
return *this;
}

## Status()

void DoubleParameter::Status | ( |  | ) |

virtual

Implements Parameter.

Definition at line 154 of file Parameters.cpp.

{
double absolute_value = fabs(* (double *) var);
if (*(double *) var == _NAN_)
fprintf(stderr, "%*s : %*s (-%c99.999)\n", nameCol, description,
statusCol, "NAN", ch);
else if (absolute_value >= 0.00095)
fprintf(stderr, "%*s : % *.*f (-%c99.999)\n", nameCol, description,
statusCol, precision, * (double *) var, ch);
else if (absolute_value <= 1e-15)
fprintf(stderr, "%*s : % *.0f (-%c99.999)\n", nameCol, description,
statusCol, * (double *) var, ch);
else
fprintf(stderr, "%*s : %*.0e (-%c99.999)\n", nameCol, description,
statusCol, *(double *) var, ch);
}

## Translate()

void DoubleParameter::Translate | ( | const char * | value | ) |

protected virtual

Implements Parameter.

Definition at line 136 of file Parameters.cpp.

{
if (value[0])
*(double *) var = atof(value);
else
*(double *) var = _NAN_;
}

## TranslateExtras()

bool DoubleParameter::TranslateExtras | ( | const char * | value,
|  | const char * | extras )

protected virtual

Reimplemented from Parameter.

Definition at line 144 of file Parameters.cpp.

{
if (value[0] != 0 || !CheckDouble(extras))
return false;
Translate(extras);
return true;
}

## Member Data Documentation

## precision

int DoubleParameter::precision

protected

Definition at line 159 of file Parameters.h.

The documentation for this class was generated from the following files:

- general/Parameters.h
- general/Parameters.cpp