00001 #ifndef _DOUBLE_PARAM_DEF_H 00002 #define _DOUBLE_PARAM_DEF_H 00003 /******************************************************************************* 00004 * ALMA - Atacama Large Millimiter Array 00005 * (c) Associated Universities Inc., 2002 00006 * (c) European Southern Observatory, 2002 00007 * Copyright by ESO (in the framework of the ALMA collaboration) 00008 * and Cosylab 2002, All rights reserved 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with this library; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 * 00024 * "@(#) $Id: DoubleParamDef.h,v 1.4 2006/11/29 23:01:26 sharring Exp $" 00025 * 00026 * who when what 00027 * -------- -------- ---------------------------------------------- 00028 * sharring 10/27/04 created 00029 */ 00030 00031 #ifndef __cplusplus 00032 #error This is a C++ include file and cannot be used from plain C 00033 #endif 00034 00035 #include <ParamDef.h> 00036 #include <memory> 00037 #include <string> 00038 #include <vector> 00039 00040 using std::auto_ptr; 00041 using std::string; 00042 using std::vector; 00043 00046 namespace Parameters { 00047 00051 class DoubleParamDef: public Parameters::ParamDef 00052 { 00053 public: 00057 DoubleParamDef(); 00058 00062 DoubleParamDef(const string & nameVal, const string & helpVal,const string & promptVal, 00063 bool isRequired, auto_ptr< double > defaultVal, auto_ptr< string > strDefault, auto_ptr< string > unitsVal, 00064 auto_ptr< double > maxVal, auto_ptr< double > minVal, auto_ptr< vector<double> > validVals); 00065 00069 virtual ~DoubleParamDef(); 00070 00071 /* 00072 * Accessor for the default value. 00073 * @return the default value as a auto_ptr to a double 00074 * if defined for this pdef, then the auto_ptr will 00075 * point to something meaningful, else null. 00076 */ 00077 auto_ptr<double> getDefault(); 00078 00079 /* 00080 * Accessor for the default string value. 00081 * @return the default string value as a auto_ptr to a string 00082 * if defined for this pdef, then the auto_ptr will 00083 * point to something meaningful, else null. 00084 */ 00085 auto_ptr<string> getStringDefault(); 00086 00087 /* 00088 * Accessor for the units. 00089 * @return the units as a auto_ptr to a string 00090 * if defined for this pdef, then the auto_ptr will 00091 * point to something meaningful, else null. 00092 */ 00093 auto_ptr<string> getUnits(); 00094 00095 /* 00096 * Accessor for the max value. 00097 * @return the max value as a auto_ptr to a double 00098 * if defined for this pdef, then the auto_ptr will 00099 * point to something meaningful, else null. 00100 */ 00101 auto_ptr<double> getMax(); 00102 00103 /* 00104 * Accessor for the min value. 00105 * @return the min value as a auto_ptr to a double 00106 * if defined for this pdef, then the auto_ptr will 00107 * point to something meaningful, else null. 00108 */ 00109 auto_ptr<double> getMin(); 00110 00111 /* 00112 * Accessor for the valid values. 00113 * @return the valid values as a auto_ptr to a vector of doubles 00114 * if defined for this pdef, then the auto_ptr will 00115 * point to something meaningful, else null. 00116 */ 00117 auto_ptr< vector< double > > getValidValues(); 00118 00119 /* 00120 * Accessor for the flag indicating if there is a default value 00121 * @return the flag indicating if there is a default value 00122 */ 00123 bool getHasDefault(); 00124 00125 /* 00126 * Accessor for the flag indicating if there is a default string value 00127 * @return the flag indicating if there is a default string value 00128 */ 00129 bool getHasStringDefault(); 00130 00131 /* 00132 * Accessor for the flag indicating if there is a units 00133 * @return the flag indicating if there are units 00134 */ 00135 bool getHasUnits(); 00136 00137 /* 00138 * Accessor for the flag indicating if there is a max value 00139 * @return the flag indicating if there is a max value 00140 */ 00141 bool getHasMax(); 00142 00143 /* 00144 * Accessor for the flag indicating if there is a min value 00145 * @return the flag indicating if there is a min value 00146 */ 00147 bool getHasMin(); 00148 00149 /* 00150 * Accessor for the flag indicating if there is a valid values 00151 * @return the flag indicating if there is a valid values 00152 */ 00153 bool getHasValidValues(); 00154 00155 private: 00156 double defaultValue_m; 00157 string defaultString_m; 00158 string units_m; 00159 double max_m; 00160 double min_m; 00161 vector<double> validValues_m; 00162 00163 bool hasDefault_m; 00164 bool hasStringDefault_m; 00165 bool hasUnits_m; 00166 bool hasMax_m; 00167 bool hasMin_m; 00168 bool hasValidValues_m; 00169 }; 00170 00171 } 00172 #endif