1 #if !defined(CONSTRAINEDPARAMETER_H__5B75CCD2_01CA_4993_8BD6_836465B6A0E1__INCLUDED_)
2 #define CONSTRAINEDPARAMETER_H__5B75CCD2_01CA_4993_8BD6_836465B6A0E1__INCLUDED_
7 #endif // _MSC_VER > 1000
16 double value,
double defaultValue,
17 double min,
double max,
int type=Double,
int key=0);
19 bool * value,
bool defaultValue,
int key=0);
21 int * value,
int defaultValue,
int min,
int max,
int key=0);
23 float* value,
float defaultValue,
float min,
float max,
int key=0);
25 double * value,
double defaultValue,
double min,
double max,
int key=0);
32 double getMinimum()
const;
33 double getMaximum()
const;
34 double getDefault()
const;
35 void setMinimum(
double min);
36 void setMaximum(
double max);
37 void setDefault(
double value);
38 void setValue(
double value);
39 void set(
const string & name,
const string & description,
40 double value,
double defaultValue,
double min,
double max,
int type=Double,
int key=0);
41 void set(
const string & name,
const string & description,
bool*value,
bool defaultValue,
int key=0);
42 void set(
const string & name,
const string & description,
int *value,
int defaultValue,
int min,
int max,
int key=0);
43 void set(
const string & name,
const string & description,
float*value,
float defaultValue,
float min,
float max,
int key=0);
44 void set(
const string & name,
const string & description,
double*value,
double defaultValue,
double min,
double max,
int key=0);
59 _key = parameter._key;
60 _type = parameter._type;
61 _value = parameter._value;
62 _minimum = parameter._minimum;
63 _maximum = parameter._maximum;
64 _default = parameter._default;
68 inline double ConstrainedParameter::getMinimum()
const
73 inline double ConstrainedParameter::getMaximum()
const
78 inline double ConstrainedParameter::getDefault()
const
83 inline void ConstrainedParameter::setMinimum(
double min)
88 if (_default<_minimum)
92 inline void ConstrainedParameter::setMaximum(
double max)
97 if (_default>_maximum)
101 inline void ConstrainedParameter::setDefault(
double value)
105 else if (value>_maximum)
111 inline void ConstrainedParameter::setValue(
double value)
114 Parameter::setValue(_minimum);
115 else if (value>_maximum)
116 Parameter::setValue(_maximum);
118 Parameter::setValue(value);
129 inline void ConstrainedParameter::set(
const string & name,
130 const string & description,
138 Parameter::set(name,description,value,type,key);
140 if (type==Double || type==Integer)
144 setDefault(defaultValue);
151 _default = (defaultValue!=0);
157 inline void ConstrainedParameter::set(
const string & name,
const string & description,
158 bool*value,
bool defaultValue,
int key)
160 Parameter::set(name,description,value,key);
161 _default = defaultValue;
166 inline void ConstrainedParameter::set(
const string & name,
const string & description,
167 int *value,
int defaultValue,
int min,
int max,
int key)
169 Parameter::set(name,description,value,key);
170 _default = defaultValue;
175 inline void ConstrainedParameter::set(
const string & name,
const string & description,
176 float*value,
float defaultValue,
float min,
float max,
int key)
178 Parameter::set(name,description,value,key);
179 _default = defaultValue;
184 inline void ConstrainedParameter::set(
const string & name,
const string & description,
185 double*value,
double defaultValue,
double min,
double max,
int key)
187 Parameter::set(name,description,value,key);
188 _default = defaultValue;
193 #endif // !defined(CONSTRAINEDPARAMETER_H__5B75CCD2_01CA_4993_8BD6_836465B6A0E1__INCLUDED_)