queso-0.53.0
BoostInputOptionsParser.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // QUESO - a library to support the Quantification of Uncertainty
5 // for Estimation, Simulation and Optimization
6 //
7 // Copyright (C) 2008-2015 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #ifndef UQ_BOOST_INPUT_OPTIONS_H
26 #define UQ_BOOST_INPUT_OPTIONS_H
27 
28 #include <string>
29 #include <queso/ScopedPtr.h>
30 #include <queso/BaseInputOptionsParser.h>
31 
32 namespace boost
33 {
34  namespace program_options
35  {
36  class options_description;
37  class variables_map;
38  }
39 }
40 
41 namespace QUESO {
42 
44 {
45 public:
47  BoostInputOptionsParser(const std::string & filename);
48 
50 
55 
57 
60  virtual ~BoostInputOptionsParser();
61 
63 
66  void scanInputFile();
67 
69 
75  template <class T>
76  void registerOption(std::string name, T defaultValue, std::string description);
77 
79  void registerOption(std::string name, std::string description);
80 
82  template <class T>
83  void getOption(std::string & name, T & value);
84 
86  friend std::ostream & operator<<(std::ostream & os,
87  const BoostInputOptionsParser & parser);
88 
89 protected:
90  const std::string & m_filename;
91  typename ScopedPtr<boost::program_options::options_description>::Type m_optionsDescription;
92  typename ScopedPtr<boost::program_options::variables_map>::Type m_optionsMap;
93 
94 private:
96 };
97 
98 } // End namespace QUESO
99 
100 #endif // UQ_BOOST_INPUT_OPTIONS_H
virtual ~BoostInputOptionsParser()
Destructor.
ScopedPtr< boost::program_options::variables_map >::Type m_optionsMap
friend std::ostream & operator<<(std::ostream &os, const BoostInputOptionsParser &parser)
Helpful stream operator for printing the parser state.
void scanInputFile()
This is the method that parses the input file.
void registerOption(std::string name, T defaultValue, std::string description)
Call this to register an option with the parser.
ScopedPtr< boost::program_options::options_description >::Type m_optionsDescription
BoostInputOptionsParser()
Default constructor that sets m_filename to &quot;&quot;.
void getOption(std::string &name, T &value)
Get option name from the parser and set value to the parsed value.

Generated on Thu Jun 11 2015 13:52:31 for queso-0.53.0 by  doxygen 1.8.5