00001 #ifndef gridripper_util_ParameterPreprocessor_h 00002 #define gridripper_util_ParameterPreprocessor_h 00003 00004 #include <gridripper/config.h> 00005 #include <gridripper/lang/IllegalArgumentException.h> 00006 #include <map> 00007 00008 namespace gridripper { 00009 00010 class Parameters; 00011 00012 namespace util { 00013 00014 using namespace std; 00015 00022 class ParameterPreprocessor 00023 { 00024 private: 00025 map<string,int> intCache; 00026 map<string,GReal_t> realCache; 00027 00028 public: 00034 virtual int processInt(const string& name) const 00035 throw(IllegalArgumentException&); 00036 00042 virtual GReal_t processReal(const string& name) const 00043 throw(IllegalArgumentException&); 00044 00046 virtual ParameterPreprocessor* clonePreprocessor() const =0; 00047 00053 int getInt(const string& name) const throw(IllegalArgumentException&); 00054 00060 GReal_t getReal(const string& name) const throw(IllegalArgumentException&); 00061 00062 virtual ~ParameterPreprocessor() { } 00063 00064 protected: 00070 void store(const string& name, int v); 00071 00077 void store(const string& name, GReal_t v); 00078 }; 00079 00086 class DummyParameterPreprocessor: public ParameterPreprocessor 00087 { 00088 ParameterPreprocessor* clonePreprocessor() const { 00089 return new DummyParameterPreprocessor(); 00090 } 00091 }; 00092 00093 } } // namespace gridripper::util 00094 00095 #endif /* gridripper_util_ParameterPreprocessor_h */