/usr/include/trilinos/OptionsFromStreamPack_CommandLineOptionsFromStreamProcessor.hpp is in libtrilinos-dev 10.4.0.dfsg-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | // @HEADER
// ***********************************************************************
//
// Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
// Copyright (2003) Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of the U.S. Government.
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
// Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
//
// ***********************************************************************
// @HEADER
#ifndef OPTIONS_FORM_STEAM_PACK_COMMANDLINE_OPTIONS_FROM_STREAM_PROCESSOR_HPP
#define OPTIONS_FORM_STEAM_PACK_COMMANDLINE_OPTIONS_FROM_STREAM_PROCESSOR_HPP
#include "OptionsFromStreamPack_OptionsFromStream.hpp"
#include "Teuchos_CommandLineProcessor.hpp"
#include "Teuchos_RCP.hpp"
#include "Teuchos_StandardMemberCompositionMacros.hpp"
namespace OptionsFromStreamPack {
/** \brief Reads from a file and/or parses from the commandline to initalize
* an <tt>OptionsFromStream</tt> object.
*
* ToDo: Finish documentation!
*/
class CommandLineOptionsFromStreamProcessor {
public:
/** \brief Construct with default values for the options file name and extra
* options.
*
* <b>Postconditions:</b><ul>
* <li><tt>this->get_options_file_name()==options_file_name</tt>
* <li><tt>this->get_extra_options_str()==extra_options_str</tt>
* </ul>
*
* <b>Suggestion:</b> Do not pass in arguments to the consturctor. Instead,
* construct the object and then call the setup frunction.
*/
CommandLineOptionsFromStreamProcessor(
const std::string &options_file_name_opt_name = "ofs-options-file"
,const std::string &options_file_name_opt_doc = "The name of the file containing input options for OptionsFromStream object."
,const std::string &options_file_name = ""
,const std::string &extra_options_str_opt_name = "ofs-extra-options"
,const std::string &extra_options_str_opt_doc = "Extra options in format \"OptGrp1{name1=val1,...,namen=valn}:OptGr2{name1=val1,...,namen=valn}:...\""
,const std::string &extra_options_str = ""
);
// RAB: 2006/01/27: Note, this value contains no semi-columns since this
// conflicts with Trilinos' runtests script. Therefore, I have to replace
// the ',' separators with ';' below!
// Note: we can leave off the last ',' since it turns out that the
// way the new OptionsFromStream::parse_options(...) is written that
// the last semicolon in an options group is not necessary!
/** \brief Set the <tt>OptionsFromStream</tt> object that will be used to
* fill options in to.
*
* Postconditions:<ul>
* <li><tt>this->get_options()==options.get()</tt>
* </ul>
*/
void set_options(
Teuchos::RCP<OptionsFromStream> const& options
);
/** \brief Just return the <tt>OptionsFromStream</tt> object in its current
* state.
*
* This function does not force the options to be processed.
*/
Teuchos::RCP<OptionsFromStream> get_options() const;
/** \brief Set the name of the commandline option name that specifies the
* options file name.
*
* <b>Postconditions:</b><ul>
* <li><tt>this->options_file_name_opt_name()==options_file_name_opt_name</tt>
* </ul>
*/
STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,options_file_name_opt_name);
/** \brief Set the documentation of the commandline option name that specifies the
* options file name.
*
* <b>Postconditions:</b><ul>
* <li><tt>this->options_file_name_opt_doc()==options_file_name_opt_doc</tt>
* </ul>
*/
STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,options_file_name_opt_doc);
/** \brief Set the options file name manually (which will be used for
* default value for "--${options_file_name_opt_name}=???" commandline option).
*
* <b>Postconditions:</b><ul>
* <li><tt>this->options_file_name()==options_file_name</tt>
* </ul>
*/
STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,options_file_name);
/** \brief Set the name of the commandline option name that specifies the
* extra options.
*
* <b>Postconditions:</b><ul>
* <li><tt>this->extra_options_str_opt_name()==extra_options_str_opt_name</tt>
* </ul>
*/
STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,extra_options_str_opt_name);
/** \brief Set the documentation of the commandline option name that
* specifies the extra options.
*
* <b>Postconditions:</b><ul>
* <li><tt>this->oextra_options_str_opt_doc()==extra_options_str_opt_doc</tt>
* </ul>
*/
STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,extra_options_str_opt_doc);
/** \brief Set the extra commandline options string (can be used for default value
* for "--${extra_options_str_opt_name}=???" commandline option).
*
* <b>Postconditions:</b><ul>
* <li><tt>this->get_extra_options_str()===extra_options_str</tt>
* </ul>
*/
STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,extra_options_str);
/** \brief Setup a comandline processor before it processes commandline
* options or reads form a file.
*
* Sets up two options on the commandline processor:<ul>
* <li><tt>--${this->options_file_name_opt_name()}</tt>: Sets the value returned from <tt>this->options_file_name()</tt>
* <li><tt>--${this->extra_options_str_opt_name()}</tt>: Sets the value returned from <tt>this->extra_options_str()</tt>
* </ul>
*/
void setup_commandline_processor(
Teuchos::CommandLineProcessor *clp
);
/** \brief Read the options file and/or process the commandline options.
*
* If <tt>this->options_file_name()!=""</tt>, then this file is read and
* processed first. Then, if <tt>this->extra_options_str()!=""</tt>, this
* is followed by the processing of these extra options which may overide
* options set in the input options file.
*
* <b>Note:</b> If <tt>this->get_options().get()==NULL</tt> before this
* function is called and if <tt>this->options_file_name()!=""</tt> or
* <tt>this->extra_options_str()!=""</tt>, the an <tt>OptionsFromStream</tt>
* object will be created anew to store the parsed options.
*
* <b>Note:</b> Calling this function will result in the options file and
* extra options to be parsed over and over again and add to or override the
* options currently already in <tt>*this->get_options()</tt>.
*/
void process_options();
/** \brief Calls <tt>process_options()</tt> and returns
* <tt>get_options()</tt>
*/
Teuchos::RCP<OptionsFromStream> process_and_get_options();
private:
Teuchos::RCP<OptionsFromStream> options_;
};
} // end namespace OptionsFromStreamPack
#endif // OPTIONS_FORM_STEAM_PACK_COMMANDLINE_OPTIONS_FROM_STREAM_PROCESSOR_HPP
|