00001 #ifndef __MUTEVAR_H 00002 #define __MUTEVAR_H 00003 00005 00014 class MuteVar 00015 { 00016 bool isBool; 00017 bool isInt; 00018 bool isLBStrict; 00019 bool isUBStrict; 00020 bool isRelaxed; 00021 float value; 00022 float lowerBound; 00023 float upperBound; 00024 00025 public: 00026 typedef enum VarType{FLOAT=0,INT,BOOL}; 00027 00029 MuteVar( MuteVar::VarType type = MuteVar::FLOAT, 00030 float _value = 0.0f, 00031 float _lB = 0.0f, 00032 float _uB = 0.0f ) 00033 :isBool(type==MuteVar::BOOL),isInt(type==MuteVar::INT), 00034 isLBStrict(false),isUBStrict(false),isRelaxed(false), 00035 value(_value),lowerBound(_lB),upperBound(_uB) 00036 {} 00037 00039 MuteVar(const MuteVar & _mv) 00040 { 00041 *this = _mv; 00042 } 00043 00045 MuteVar & operator= (const MuteVar & _mv) 00046 { 00047 isBool = _mv.isBool; 00048 isInt = _mv.isInt; 00049 isLBStrict = _mv.isLBStrict; 00050 isUBStrict = _mv.isUBStrict; 00051 isRelaxed = _mv.isRelaxed; 00052 value = _mv.value; 00053 lowerBound = _mv.lowerBound; 00054 upperBound = _mv.upperBound; 00055 return *this; 00056 }; 00057 00059 MuteVar & operator= (float _value) 00060 { 00061 value = _value; 00062 return *this; 00063 }; 00064 00068 float GetValue() const {return value;} 00072 float GetLowerBound() const {return lowerBound;} 00076 float GetUpperBound() const {return upperBound;} 00080 bool IsLowerBoundStrict() const {return isLBStrict;} 00084 bool IsUpperBoundStrict() const {return isUBStrict;} 00085 00089 VarType GetType() const 00090 { 00091 if(isBool) return MuteVar::BOOL; 00092 if(isInt) return MuteVar::INT; 00093 return MuteVar::FLOAT; 00094 } 00095 00099 void SetType( MuteVar::VarType type) 00100 { 00101 isBool = false; 00102 isInt = false; 00103 isBool = (type==MuteVar::BOOL); 00104 isInt = (type==MuteVar::INT); 00105 } 00106 00110 void SetLowerBound( float _value) { lowerBound = _value;} 00114 void SetUpperBound( float _value) { upperBound = _value;} 00118 void SetIsLBStrict( bool _value = true ) { isLBStrict = _value; } 00122 void SetIsUBStrict( bool _value = true ) { isUBStrict = _value; } 00123 00124 bool IsRelaxed() const { return isRelaxed;} 00125 void SetRelaxed( bool _isRelaxed = true ) { isRelaxed = _isRelaxed;} 00126 00127 ~MuteVar() 00128 { 00129 } 00130 00131 }; 00132 00133 #endif