00001 #ifndef _STRING_PARAM_DEF_H 00002 #define _STRING_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: StringParamDef.h,v 1.3 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 <memory> 00036 #include <string> 00037 #include <vector> 00038 #include <ParamDef.h> 00039 00041 using std::string; 00042 using std::vector; 00043 using std::auto_ptr; 00044 00045 namespace Parameters { 00046 00050 class StringParamDef: public Parameters::ParamDef 00051 { 00052 public: 00056 StringParamDef(); 00057 00061 StringParamDef(const string & nameVal, const string & helpVal, const string & promptVal, 00062 bool isRequired, auto_ptr< string > defaultVal, auto_ptr< vector < string > > validVals); 00063 00067 virtual ~StringParamDef(); 00068 00069 /* 00070 * Accessor for the default value. 00071 * @return the default value as an auto_ptr to a string 00072 * if defined for this pdef, then the auto_ptr will 00073 * point to something meaningful, else null. 00074 */ 00075 auto_ptr<string> getDefault(); 00076 00077 /* 00078 * Accessor for the valid values. 00079 * @return the valid values as an auto_ptr to a vector of strings 00080 * if defined for this pdef, then the auto_ptr will 00081 * point to something meaningful, else null. 00082 */ 00083 auto_ptr< vector< string > > getValidValues(); 00084 00085 /* 00086 * Accessor for the flag indicating if there is a default value. 00087 * @return the flag indicating if there is a default value 00088 */ 00089 bool getHasDefault(); 00090 00091 /* 00092 * Accessor for the flag indicating if there is a valid values. 00093 * @return the flag indicating if there is a valid values 00094 */ 00095 bool getHasValidValues(); 00096 00097 private: 00098 string defaultValue_m; 00099 vector< string > validValues_m; 00100 bool hasDefault_m; 00101 bool hasValidValues_m; 00102 }; 00103 00104 } 00105 #endif