00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "freSetupParameterTraits.h"
00024
00025
00026 namespace FREE
00027 {
00028
00032
00033
00034
00035 bool
00036 SetupParameterTraits::
00037 ValueIsValid (double dValue) const
00038 {
00039 if (this->IsBoundedBelow())
00040 {
00041 if (dValue<m_dLowerBound) return false;
00042 }
00043 if (this->IsBoundedAbove())
00044 {
00045 if (dValue>m_dUpperBound) return false;
00046 }
00047 if (m_dQuantisation)
00048 {
00049 double dTemp = dValue/m_dQuantisation;
00050 if (dTemp - floor(dTemp) != 0) return false;
00051 }
00052
00053 return true;
00054 };
00055
00056 SetupParameterTraits::
00057 SetupParameterTraits(double dInitialValue, ParameterType parameterType,
00058 double dLowerBound, bool bBoundedBelow,
00059 double dUpperBound, bool bBoundedAbove,
00060 double dQuantisation)
00061 {
00062 m_dInitialValue = dInitialValue;
00063 m_ParameterType = parameterType;
00064 m_dLowerBound = dLowerBound;
00065 m_bBoundedBelow = bBoundedBelow;
00066 m_dUpperBound = dUpperBound;
00067 m_bBoundedBelow = bBoundedAbove;
00068 if (dQuantisation<0.0) throwExceptionMacro("Error, negativ quantisation passed. Only values greater or equal 0 are allowed.");
00069 m_dQuantisation = dQuantisation;
00070 };
00071
00072 }