ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/src/io/Globals.hpp
(Generate patch)

Comparing trunk/OOPSE-2.0/src/io/Globals.hpp (file contents):
Revision 2364 by tim, Thu Oct 13 22:26:47 2005 UTC vs.
Revision 2372 by tim, Mon Oct 17 00:51:16 2005 UTC

# Line 66 | Line 66 | template<typename T> static RepType convert(T v)      
66   template<typename T> static bool    convert(T v, RepType& r){return false;} // !NB everything is ok
67   template<typename T> static RepType convert(T v)            {RepType tmp; convert(v,tmp);return tmp;}
68    static bool convert(RepType v, RepType& r) { r = v; return true;}
69 +  static char* getParamType() { return "std::string";}  
70   };
71   //bool
72   template<>                    
# Line 86 | Line 87 | struct ParameterTraits<bool>{
87      
88       return result;
89    }
90 +  static char* getParamType() { return "bool";}  
91   };
92  
93   //int  
# Line 95 | Line 97 | struct ParameterTraits<int>{
97      template<typename T> static bool    convert(T, RepType&){return false;}
98      template<typename T> static RepType convert(T v)        {RepType tmp; convert(v,tmp);return tmp;}
99      static bool convert(RepType v, RepType& r)            { r=v; return true;}
100 +    static char* getParamType() { return "int";}  
101   };
102  
103   //double
# Line 105 | Line 108 | struct ParameterTraits<double>{
108      template<typename T> static RepType convert(T v)        {RepType tmp; convert(v,tmp);return tmp;}
109      static bool convert(RepType v, RepType& r)            {r=v; return true;}
110      static bool convert(int v, RepType& r)                {r = static_cast<double>(v); return true;}
111 +    static char* getParamType() { return "double";}    
112   };
113  
114  
# Line 121 | Line 125 | class ParameterBase {
125      virtual bool setData(std::string) = 0;
126      virtual bool setData(int) = 0;
127      virtual bool setData(double) = 0;
128 <    
128 >    virtual char* getParamType() = 0;
129    protected:
130      std::string keyword_;
131      bool optional_;
# Line 139 | Line 143 | class Parameter : public ParameterBase{
143      virtual bool setData(std::string sval) {
144          return internalSetData<std::string>(sval);
145      }
146 <    virtual bool setData(int ial) {
147 <        return internalSetData<int>(ial);
146 >    virtual bool setData(int ival) {
147 >        return internalSetData<int>(ival);
148      }
149      
150      virtual bool setData(double dval) {
151          return internalSetData<double>(dval);
152      }
153  
154 +    virtual char* getParamType() { return ParameterTraits<ParamType>::getParamType();}
155     private:
156       template<class T> bool internalSetData(T data) {
157          ParamType tmp;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines