00001 #ifndef __RealParameter__ 00002 #define __RealParameter__ 00003 00004 00023 #include <stdio.h> 00024 00025 #include "AbsParameter.hpp" 00026 00027 00028 class RealParameter : public AbsParameter 00029 { 00030 private: 00031 00032 double currentValue; 00033 double defaultValue; 00034 00035 int currentCardinality; 00036 double* setValues; 00037 00038 double minValue; 00039 double maxValue; 00040 00041 public: 00042 00043 RealParameter(char* aname, double avalue, int acardinality=1, bool arangeFlag=false ) 00044 :AbsParameter(aname, Real, acardinality, arangeFlag ) 00045 { 00046 currentValue= avalue; 00047 defaultValue= avalue; 00048 00049 setValues= new double[acardinality]; 00050 00051 minValue= avalue; 00052 maxValue= avalue; 00053 00054 currentCardinality= 0; 00055 } 00056 00057 virtual ~RealParameter(){delete[] setValues;} 00058 00059 virtual int getCurrentCardinality(){ return currentCardinality; } 00060 00061 // as real 00062 virtual void addReal(double value); 00063 00064 virtual double getReal(){ return currentValue; } 00065 virtual double getDefaultReal(){ return defaultValue; } 00066 virtual double getMinReal(){ return minValue; } 00067 virtual double getMaxReal(){ return maxValue; } 00068 virtual double getReal(int index){ return setValues[index]; } 00069 00070 virtual void setReal(double val){ currentValue= val; } 00071 virtual void setDefaultReal(double val){ defaultValue= val; } 00072 virtual void setRangeReal(double low, double high){ minValue= low; maxValue= high;} 00073 virtual void setReal(int index, double val){ setValues[index]= val; } 00074 00075 // as bool 00076 virtual bool getBool(){return false;} 00077 virtual bool getDefaultBool(){return false;} 00078 00079 virtual void setBool(bool val){} 00080 virtual void setDefaultBool(bool val){} 00081 00082 // as integer 00083 virtual int getInteger(){return -1;} 00084 virtual int getDefaultInteger(){return -1;} 00085 virtual int getMinInteger(){return -1;} 00086 virtual int getMaxInteger(){return -1;} 00087 virtual int getInteger(int index){return -1;} 00088 00089 virtual void setInteger(int val){} 00090 virtual void setDefaultInteger(int val){} 00091 virtual void setRangeInteger(int low, int high){} 00092 virtual void setInteger(int index, int val){} 00093 00094 // as string 00095 virtual char* getString(){return 0;} 00096 virtual char* getDefaultString(){return 0;} 00097 virtual char* getString(int index){return 0;} 00098 00099 virtual void setString(char* val){} 00100 virtual void setDefaultString(char* val){} 00101 virtual void setString(int index, char* val){} 00102 00103 virtual char* shortDescription(); 00104 virtual char* description(); 00105 00106 virtual void report(FILE* file){} 00107 }; 00108 00109 00110 #endif