Frobby  0.9.5
Parameter.h
Go to the documentation of this file.
1 /* Frobby: Software for monomial ideal computations.
2  Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see http://www.gnu.org/licenses/.
16 */
17 #ifndef PARAMETER_GUARD
18 #define PARAMETER_GUARD
19 
20 #include <string>
21 #include <utility>
22 
24 class Parameter {
25  public:
26  Parameter(const string& name, const string& description);
27  virtual ~Parameter();
28 
29  const string& getName() const {return _name;}
30  const string& getDescription() const {return _description;}
31  string getArgumentType() const {return doGetArgumentType();}
32  string getValueAsString() const {return doGetValueAsString();}
33 
34  void appendToDescription(const char* str);
35 
36  void processArguments(const char** args, size_t argCount);
37 
38  private:
39  virtual string doGetArgumentType() const = 0;
40  virtual string doGetValueAsString() const = 0;
41  virtual pair<size_t, size_t> doGetArgumentCountRange() const = 0;
42  virtual void doProcessArguments(const char** args, size_t argCount) = 0;
43 
44  void checkCorrectParameterCount(unsigned int from,
45  unsigned int to,
46  const char** params,
47  unsigned int paramCount);
48 
49  string _name;
50  string _description;
51 };
52 
53 #endif
virtual void doProcessArguments(const char **args, size_t argCount)=0
virtual string doGetValueAsString() const =0
string _description
Definition: Parameter.h:50
void processArguments(const char **args, size_t argCount)
Definition: Parameter.cpp:35
const string & getName() const
Definition: Parameter.h:29
string _name
Definition: Parameter.h:49
virtual string doGetArgumentType() const =0
virtual pair< size_t, size_t > doGetArgumentCountRange() const =0
const string & getDescription() const
Definition: Parameter.h:30
virtual ~Parameter()
Definition: Parameter.cpp:28
string getArgumentType() const
Definition: Parameter.h:31
void appendToDescription(const char *str)
Definition: Parameter.cpp:31
string getValueAsString() const
Definition: Parameter.h:32
Parameter(const string &name, const string &description)
Definition: Parameter.cpp:22
void checkCorrectParameterCount(unsigned int from, unsigned int to, const char **params, unsigned int paramCount)
Definition: Parameter.cpp:43