1 /* -*- c++ -*- */ 2 #ifndef PARAMETER_H 3 #define PARAMETER_H 4 5 #include "Value.h" 6 #include "simpleTypes.h" 7 8 namespace ProtoMol { 9 //________________________________________________________ Parameter 10 struct Parameter { 11 /** 12 * Container struct for parameters providing wide range 13 * of constructors. 14 */ 15 16 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 17 // Constructors, destructors, assignment 18 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 19 public: 20 Parameter(); 21 22 Parameter(const std::string& k, const Value& val); 23 Parameter(const std::string& k, const Value& val, const Value& def); 24 template<typename T> ParameterParameter25 Parameter(const std::string& k, const Value& val, T def):keyword(k),value(val),defaultValue(val) {defaultValue.set(def);} 26 Parameter(const char* k, const Value& val); 27 Parameter(const char* k, const Value& val, const Value& def); 28 template<typename T> ParameterParameter29 Parameter(const char* k, const Value& val, T def):keyword(std::string(k)),value(val),defaultValue(val) {defaultValue.set(def);} 30 31 Parameter(const std::string& k, const Value& val, const Text& t); 32 Parameter(const std::string& k, const Value& val, const Value& def, const Text& t); 33 template<typename T> ParameterParameter34 Parameter(const std::string& k, const Value& val, T def, const Text& t):keyword(k),value(val),defaultValue(val),text(t.text) {defaultValue.set(def);} 35 Parameter(const char* k, const Value& val, const Text& t); 36 Parameter(const char* k, const Value& val, const Value& def, const Text& t); 37 template<typename T> ParameterParameter38 Parameter(const char* k, const Value& val, T def, const Text& t):keyword(std::string(k)),value(val),defaultValue(val),text(t.text) {defaultValue.set(def);} 39 // template<typename T> 40 // Parameter(const std::string& k, T val):keyword(k),value(val),defaultValue(val,Value::undefined) {} 41 // template<typename T> 42 // Parameter(const std::string& k, T val, T def):keyword(k),value(val),defaultValue(def) {} 43 // template<typename T, typename C> 44 // Parameter(const std::string& k, T val, const C& con):keyword(k),value(val,con),defaultValue(val,con,Value::undefined) {} 45 // template<typename T, typename C> 46 // Parameter(const std::string& k, T val, T def, const C& con):keyword(k),value(val,con),defaultValue(def,con) {} 47 48 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 49 // data members 50 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 51 public: 52 /// the keyword of the parameter 53 std::string keyword; 54 /// the value of the parameter 55 Value value; 56 /// optional default value of the parameter 57 Value defaultValue; 58 /// optional help text of the parameter 59 std::string text; 60 }; 61 62 } 63 #endif /* PARAMETER_H */ 64