Frobby 0.10.0
Loading...
Searching...
No Matches
Parameter.h
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
24class 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