00001 /*************************************************************************** 00002 ** 00003 ** This file is part of DinverCore. 00004 ** 00005 ** This file may be distributed and/or modified under the terms of the 00006 ** GNU General Public License version 2 or 3 as published by the Free 00007 ** Software Foundation and appearing in the file LICENSE.GPL included 00008 ** in the packaging of this file. 00009 ** 00010 ** This file is distributed in the hope that it will be useful, but WITHOUT 00011 ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00013 ** more details. 00014 ** 00015 ** You should have received a copy of the GNU General Public License 00016 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 ** 00018 ** See http://www.geopsy.org for more information. 00019 ** 00020 ** Created : 2009-05-06 00021 ** Authors: 00022 ** Marc Wathelet 00023 ** Marc Wathelet (LGIT, Grenoble, France) 00024 ** 00025 ***************************************************************************/ 00026 00027 #ifndef REALSPACE_H 00028 #define REALSPACE_H 00029 00030 #include <QGpCoreTools.h> 00031 #include "Parameter.h" 00032 #include "DinverCoreDLLExport.h" 00033 00034 namespace DinverCore { 00035 00036 class DINVERCORE_EXPORT RealSpace : public XMLClass 00037 { 00038 TRANSLATIONS( "RealSpace" ) 00039 public: 00040 RealSpace() {} 00041 virtual ~RealSpace(); 00042 00043 virtual const QString& xml_tagName() const {return xmlRealSpaceTag;} 00044 static const QString xmlRealSpaceTag; 00045 00046 bool operator==(const RealSpace& o) const; 00047 bool operator!=(const RealSpace& o) const {return !operator==(o);} 00048 00049 uint checksum() const; 00050 00051 void setParameterNamePrefix(const QString& p) {_parameterNamePrefix=p;} 00052 Parameter * addParameter(QString name, QString unit, double min, double max, 00053 ParameterGrid::Scale scale, double precision); 00054 Parameter * addParameter(Parameter * p); 00055 void setVariableParameters(); 00056 void clearParameters(); 00057 00058 int variableParameterCount() const {return _variableParameters.count();} 00059 int allParameterCount() const {return _allParameters.count();} 00060 double possibleCount() const; 00061 00062 const Parameter * parameter(int index) const {return _allParameters[index];} 00063 Parameter * parameter(int index) {return _allParameters[index];} 00064 const Parameter * variableParameter(int index) const {return _variableParameters[index];} 00065 Parameter * variableParameter(int index) {return _variableParameters[index];} 00066 Parameter * parameter(QString name); 00067 00068 inline bool isOk() const; 00069 inline bool isOkDebug() const; 00070 bool isOkDebugVerbose() const; 00071 void conditionDiagnostic() const; 00072 void humanInfo() const; 00073 00074 void addCondition(AbstractCondition * c); 00075 bool adjustRanges(); 00076 void printModel(); 00077 private: 00078 // List of all parameters including the fixed ones 00079 QVector<Parameter *> _allParameters; 00080 // List of not fixed parameters 00081 QVector<Parameter *> _variableParameters; 00082 // Kept here only for clean delete 00083 QVector<AbstractCondition *> _conditions; 00084 QString _parameterNamePrefix; 00085 protected: 00086 virtual void xml_writeChildren(XML_WRITECHILDREN_ARGS) const; 00087 virtual XMLMember xml_member(XML_MEMBER_ARGS); 00088 virtual void xml_polish(XML_POLISH_ARGS); 00089 }; 00090 00091 inline bool RealSpace::isOk() const 00092 { 00093 foreach(Parameter * p, _allParameters) { 00094 if( !p->isOk()) return false; 00095 } 00096 return true; 00097 } 00098 00099 inline bool RealSpace::isOkDebug() const 00100 { 00101 foreach(Parameter * p, _allParameters) { 00102 if( !p->isOkDebug()) return false; 00103 } 00104 return true; 00105 } 00106 00107 } // namespace DinverCore 00108 00109 #endif // REALSPACE_H