DUNE PDELab (git)

parametertreeparser.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5#ifndef DUNE_PARAMETER_PARSER_HH
6#define DUNE_PARAMETER_PARSER_HH
7
12#include <istream>
13#include <string>
14#include <vector>
15
18
19namespace Dune {
20
28 class HelpRequest : public Exception {};
29
35 {
36
37 static std::string ltrim(const std::string& s);
38 static std::string rtrim(const std::string& s);
39
40 public:
41
85
96 static void readINITree(std::istream& in, ParameterTree& pt,
97 bool overwrite);
98
105 static Dune::ParameterTree readINITree(std::istream& in);
106
107
120 static void readINITree(std::istream& in, ParameterTree& pt,
121 const std::string srcname = "stream",
122 bool overwrite = true);
123
124
135 static void readINITree(std::string file, ParameterTree& pt, bool overwrite = true);
136
143 static Dune::ParameterTree readINITree(const std::string& file);
144
146
158 static void readOptions(int argc, char* argv [], ParameterTree& pt);
159
177 static void readNamedOptions(int argc, char* argv[],
178 ParameterTree& pt,
179 std::vector<std::string> keywords,
180 unsigned int required = std::numeric_limits<unsigned int>::max(),
181 bool allow_more = true,
182 bool overwrite = true,
183 std::vector<std::string> help = std::vector<std::string>());
184
185 private:
186 static std::string generateHelpString(std::string progname, std::vector<std::string> keywords, unsigned int required, std::vector<std::string> help);
187 };
188
189} // end namespace Dune
190
191#endif // DUNE_PARAMETER_PARSER_HH
Base class for Dune-Exceptions.
Definition: exceptions.hh:96
exception thrown if the user wants to see help string
Definition: parametertreeparser.hh:28
report parser error while reading ParameterTree
Definition: parametertreeparser.hh:22
Parsers to set up a ParameterTree from various input sources.
Definition: parametertreeparser.hh:35
static void readOptions(int argc, char *argv[], ParameterTree &pt)
parse command line options and build hierarchical ParameterTree structure
Definition: parametertreeparser.cc:155
static void readINITree(std::istream &in, ParameterTree &pt, bool overwrite)
parse C++ stream
Definition: parametertreeparser.cc:70
static void readNamedOptions(int argc, char *argv[], ParameterTree &pt, std::vector< std::string > keywords, unsigned int required=std::numeric_limits< unsigned int >::max(), bool allow_more=true, bool overwrite=true, std::vector< std::string > help=std::vector< std::string >())
read [named] command line options and build hierarchical ParameterTree structure
Definition: parametertreeparser.cc:171
Hierarchical structure of string parameters.
Definition: parametertree.hh:37
Default exception class for range errors.
Definition: exceptions.hh:254
A few common exception classes.
constexpr auto max
Function object that returns the greater of the given values.
Definition: hybridutilities.hh:484
Dune namespace.
Definition: alignedallocator.hh:13
A hierarchical structure of string parameters.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 23, 23:29, 2024)