1 #if !defined(PARAMETER_H_INCLUDED_)
2 #define PARAMETER_H_INCLUDED_
6 #endif // _MSC_VER > 1000
27 static const int Boolean;
28 static const int Integer;
29 static const int Float;
30 static const int Double;
33 Parameter(
const string & name,
const string & description,
double value,
int type,
int key);
34 Parameter(
const string & name,
const string & description,
bool * value,
int key);
35 Parameter(
const string & name,
const string & description,
int * value,
int key);
36 Parameter(
const string & name,
const string & description,
float * value,
int key);
37 Parameter(
const string & name,
const string & description,
double* value,
int key);
45 bool getBoolValue()
const;
46 int getIntValue()
const;
47 float getFloatValue()
const;
48 double getDoubleValue()
const;
51 void setValue(
bool value);
52 void setValue(
int value);
53 void setValue(
float value);
54 void setValue(
double value);
55 void set(
const string & name,
const string & description,
double value,
int type=Double,
int key=0);
56 void set(
const string & name,
const string & description,
bool * value,
int key=0);
57 void set(
const string & name,
const string & description,
int * value,
int key=0);
58 void set(
const string & name,
const string & description,
float * value,
int key=0);
59 void set(
const string & name,
const string & description,
double* value,
int key=0);
75 _key = parameter._key;
76 _type = parameter._type;
77 _value = parameter._value;
81 inline int Parameter::getKey()
const
86 inline int Parameter::getType()
const
91 inline bool Parameter::getBoolValue()
const
94 return *
static_cast<bool*
>(_exValue);
99 inline int Parameter::getIntValue()
const
102 return *
static_cast<int*
>(_exValue);
107 inline float Parameter::getFloatValue()
const
110 return *
static_cast<float*
>(_exValue);
112 return float(_value);
115 inline double Parameter::getDoubleValue()
const
118 return *
static_cast<double*
>(_exValue);
123 inline void Parameter::setKey(
int key)
128 inline void Parameter::setValue(
bool value)
135 case 0: *
static_cast<bool*
>(_exValue) = value;
break;
136 case 1: *
static_cast<int*
>(_exValue) = (
int) value;
break;
137 case 2: *
static_cast<float*
>(_exValue) = (
float)value;
break;
138 case 3: *
static_cast<double*
>(_exValue) = (
double)value;
break;
145 inline void Parameter::setValue(
int value)
152 case 0: *
static_cast<bool*
>(_exValue) = value>0;
break;
153 case 1: *
static_cast<int*
>(_exValue) = value;
break;
154 case 2: *
static_cast<float*
>(_exValue) = (
float)value;
break;
155 case 3: *
static_cast<double*
>(_exValue) = (
double)value;
break;
162 inline void Parameter::setValue(
float value)
169 case 0: *
static_cast<bool*
>(_exValue) = value>0;
break;
170 case 1: *
static_cast<int*
>(_exValue) = (
int) value;
break;
171 case 2: *
static_cast<float*
>(_exValue) = value;
break;
172 case 3: *
static_cast<double*
>(_exValue) = (
double)value;
break;
180 inline void Parameter::setValue(
double value)
187 case 0: *
static_cast<bool*
>(_exValue) = value>0;
break;
188 case 1: *
static_cast<int*
>(_exValue) = (
int) value;
break;
189 case 2: *
static_cast<float*
>(_exValue) = (
float)value;
break;
190 case 3: *
static_cast<double*
>(_exValue) = value;
break;
197 inline void Parameter::set(
const string & name,
198 const string & description,
204 _description = description;
211 inline void Parameter::set(
const string & name,
const string & description,
bool * value,
int key)
214 _description = description;
220 inline void Parameter::set(
const string & name,
const string & description,
int * value,
int key)
223 _description = description;
230 inline void Parameter::set(
const string & name,
const string & description,
float * value,
int key)
233 _description = description;
241 inline void Parameter::set(
const string & name,
const string & description,
double* value,
int key)
244 _description = description;
251 #endif // !defined(PARAMETER_H_INCLUDED_)