00001 00002 /****************************************************************************** 00003 * 00004 * file: Constraint.h 00005 * 00006 * Copyright (c) 2005, Michael E. Smoot 00007 * All rights reverved. 00008 * 00009 * See the file COPYING in the top directory of this distribution for 00010 * more information. 00011 * 00012 * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 00013 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00014 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00015 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00016 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00017 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00018 * DEALINGS IN THE SOFTWARE. 00019 * 00020 *****************************************************************************/ 00021 00022 #ifndef TCLAP_CONSTRAINT_H 00023 #define TCLAP_CONSTRAINT_H 00024 00025 #include <string> 00026 #include <vector> 00027 #include <list> 00028 #include <iostream> 00029 #include <iomanip> 00030 #include <algorithm> 00031 00032 namespace TCLAP { 00033 00034 /** 00035 * The interface that defines the interaction between the Arg and Constraint. 00036 */ 00037 template<class T> 00038 class Constraint 00039 { 00040 00041 public: 00042 /** 00043 * Returns a description of the Constraint. 00044 */ 00045 virtual std::string description() const =0; 00046 00047 /** 00048 * Returns the short ID for the Constraint. 00049 */ 00050 virtual std::string shortID() const =0; 00051 00052 /** 00053 * The method used to verify that the value parsed from the command 00054 * line meets the constraint. 00055 * \param value - The value that will be checked. 00056 */ 00057 virtual bool check(const T& value) const =0; 00058 00059 /** 00060 * Destructor. 00061 * Silences warnings about Constraint being a base class with virtual 00062 * functions but without a virtual destructor. 00063 */ 00064 virtual ~Constraint() { ; } 00065 }; 00066 00067 } //namespace TCLAP 00068 #endif