00001 /* 00002 * Main authors: 00003 * Tias Guns <tias.guns@cs.kuleuven.be> 00004 * 00005 * Copyright: 00006 * Tias Guns, 2008 00007 * 00008 * Revision information: 00009 * $Id: textoption.hh 231 2009-06-04 09:51:59Z tias $ 00010 * 00011 * This file is part of Fim_cp, Frequent Itemset Mining using 00012 * Constraint Programming, and uses Gecode. 00013 * 00014 * Permission is hereby granted, free of charge, to any person obtaining 00015 * a copy of this software and associated documentation files (the 00016 * "Software"), to deal in the Software without restriction, including 00017 * without limitation the rights to use, copy, modify, merge, publish, 00018 * distribute, sublicense, and/or sell copies of the Software, and to 00019 * permit persons to whom the Software is furnished to do so, subject to 00020 * the following conditions: 00021 * 00022 * The above copyright notice and this permission notice shall be 00023 * included in all copies or substantial portions of the Software. 00024 * 00025 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00026 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00027 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00028 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 00029 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 00030 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 00031 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00032 * 00033 */ 00034 #ifndef __FIMCP_COMMON_TEXTOPTION_HH__ 00035 #define __FIMCP_COMMON_TEXTOPTION_HH__ 00036 00037 #include <gecode/driver.hh> 00038 using namespace Gecode::Driver; 00039 00040 /** 00041 * \brief Text-valued option 00042 * 00043 */ 00044 class TextOption : public BaseOption { 00045 protected: 00046 const char* cur; ///< current value 00047 public: 00048 /// Initialize for option \a o and explanation \a e and default value \a v 00049 TextOption(const char* o, const char* e, const char* v); 00050 /// Set default value to \a v 00051 void value(const char* val); 00052 /// Return current option value 00053 const char* value(void) const; 00054 /// Parse option at first position 00055 virtual bool parse(int& argc, char* argv[]); 00056 /// Print help text 00057 virtual void help(void); 00058 /// Destructor 00059 virtual ~TextOption(void); 00060 }; 00061 00062 inline 00063 TextOption::TextOption(const char* o, const char* e, const char* v) 00064 : BaseOption(o,e), cur(v) {} 00065 00066 inline void 00067 TextOption::value(const char* v) { 00068 cur = v; 00069 } 00070 inline const char* 00071 TextOption::value(void) const { 00072 return cur; 00073 } 00074 00075 #endif
1.6.3