Frobby 0.10.0
Loading...
Searching...
No Matches
CliParams.h
1/* Frobby: Software for monomial ideal computations.
2 Copyright (C) 2009 University of Aarhus
3 Contact Bjarke Hammersholt Roune for license information (www.broune.com)
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see http://www.gnu.org/licenses/.
17*/
18#ifndef CLI_PARAMS_GUARD
19#define CLI_PARAMS_GUARD
20
21#include "Parameter.h"
22#include "ElementDeleter.h"
23#include <vector>
24#include <map>
25
26class ParameterGroup;
27
28class CliParams {
29 public:
30 typedef vector<Parameter*>::iterator iterator;
31 typedef vector<Parameter*>::const_iterator const_iterator;
32
33 CliParams();
34
35 const_iterator begin() const {return _params.begin();}
36 const_iterator end() const {return _params.end();}
37
39 void add(unique_ptr<Parameter> param);
40
41 void add(Parameter& param);
42 void add(ParameterGroup& params);
43
44 bool hasParam(const string& name) const;
45 const Parameter& getParam(const string& name) const;
46 Parameter& getParam(const string& name);
47
48 void parseCommandLine(unsigned int tokenCount, const char** tokens);
49 void processOption(const string& optionName,
50 const char** params,
51 unsigned int paramCount);
52
53 private:
54 vector<Parameter*> _params;
55 vector<Parameter*> _ownedParams;
56 ElementDeleter<vector<Parameter*> > _paramsDeleter;
57};
58
59bool getBool(const CliParams& params, const string& name);
60const string& getString(const CliParams& params, const string& name);
61unsigned int getInt(const CliParams& params, const string& name);
62
63void setBool(CliParams& params, const string& name, bool newValue);
64
65#endif
Definition CliParams.h:28
void add(unique_ptr< Parameter > param)
Definition CliParams.cpp:88
Definition ElementDeleter.h:50
Definition ParameterGroup.h:23
Definition Parameter.h:24