00001 // This file is part of ff3d - http://www.freefem.org/ff3d 00002 // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino 00003 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 2, or (at your option) 00007 // any later version. 00008 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software Foundation, 00016 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 00018 // $Id: Parameter.hpp,v 1.2 2007/06/09 10:37:06 delpinux Exp $ 00019 00020 #ifndef _PARAMETER_HPP_ 00021 #define _PARAMETER_HPP_ 00022 00023 #include <string> 00024 00025 #include <Types.hpp> 00026 00027 #include <ReferenceCounting.hpp> 00028 #include <IdentifierSet.hpp> 00029 00038 class Parameter 00039 { 00040 public: 00041 enum Type { 00042 Double, 00043 Integer, 00044 String, 00045 Enum 00046 }; 00047 00048 protected: 00049 Type __type; 00050 00051 private: 00052 const char* __label; 00053 00054 const char* __description; 00055 00056 virtual std::ostream& put(std::ostream&) const = 0; 00057 00058 public: 00059 virtual void get(IdentifierSet& I) = 0; 00060 00061 virtual void reset() = 0; 00062 00063 virtual void set(const real_t d) = 0; 00064 virtual void set(const int i) = 0; 00065 virtual void set(const char*) = 0; 00066 00067 void set(const std::string& s) { 00068 set(s.c_str()); 00069 } 00070 00071 00072 virtual const std::string typeName() const = 0; 00073 00074 const Type& type() const 00075 { 00076 return __type; 00077 } 00078 00079 friend std::ostream& operator << (std::ostream& os, 00080 const Parameter& P) 00081 { 00082 return P.put(os); 00083 } 00084 00085 const char* label() const; 00086 00087 Parameter(const Parameter& pv) 00088 : __type(pv.__type), 00089 __label(pv.__label) 00090 { 00091 ; 00092 } 00093 00094 Parameter(const Parameter::Type t, const char* label) 00095 : __type(t), 00096 __label(label) 00097 { 00098 ; 00099 } 00100 00101 virtual ~Parameter() 00102 { 00103 ; 00104 } 00105 }; 00106 00107 #endif // _PARAMETER_HPP_ 00108
1.5.6