MoochoPack: Miscellaneous Utilities for MOOCHO  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | List of all members
OptionsFromStreamPack::CommandLineOptionsFromStreamProcessor Class Reference

Reads from a file and/or parses from the commandline to initalize an OptionsFromStream object. More...

#include <OptionsFromStreamPack_CommandLineOptionsFromStreamProcessor.hpp>

Public Member Functions

 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="")
 Construct with default values for the options file name and extra options. More...
 
void set_options (Teuchos::RCP< OptionsFromStream > const &options)
 Set the OptionsFromStream object that will be used to fill options in to. More...
 
Teuchos::RCP< OptionsFromStreamget_options () const
 Just return the OptionsFromStream object in its current state. More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, options_file_name_opt_name)
 Set the name of the commandline option name that specifies the options file name. More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, options_file_name_opt_doc)
 Set the documentation of the commandline option name that specifies the options file name. More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, options_file_name)
 Set the options file name manually (which will be used for default value for "--${options_file_name_opt_name}=???" commandline option). More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, extra_options_str_opt_name)
 Set the name of the commandline option name that specifies the extra options. More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, extra_options_str_opt_doc)
 Set the documentation of the commandline option name that specifies the extra options. More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (std::string, extra_options_str)
 Set the extra commandline options string (can be used for default value for "--${extra_options_str_opt_name}=???" commandline option). More...
 
void setup_commandline_processor (Teuchos::CommandLineProcessor *clp)
 Setup a comandline processor before it processes commandline options or reads form a file. More...
 
void process_options ()
 Read the options file and/or process the commandline options. More...
 
Teuchos::RCP< OptionsFromStreamprocess_and_get_options ()
 Calls process_options() and returns get_options() More...
 

Detailed Description

Reads from a file and/or parses from the commandline to initalize an OptionsFromStream object.

ToDo: Finish documentation!

Definition at line 57 of file OptionsFromStreamPack_CommandLineOptionsFromStreamProcessor.hpp.

Constructor & Destructor Documentation

OptionsFromStreamPack::CommandLineOptionsFromStreamProcessor::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 = "" 
)

Construct with default values for the options file name and extra options.

Postconditions:

  • this->get_options_file_name()==options_file_name
  • this->get_extra_options_str()==extra_options_str

Suggestion: Do not pass in arguments to the consturctor. Instead, construct the object and then call the setup frunction.

Definition at line 49 of file OptionsFromStreamPack_CommandLineOptionsFromStreamProcessor.cpp.

Member Function Documentation

void OptionsFromStreamPack::CommandLineOptionsFromStreamProcessor::set_options ( Teuchos::RCP< OptionsFromStream > const &  options)

Set the OptionsFromStream object that will be used to fill options in to.

Postconditions:

Definition at line 65 of file OptionsFromStreamPack_CommandLineOptionsFromStreamProcessor.cpp.

Teuchos::RCP< OptionsFromStream > OptionsFromStreamPack::CommandLineOptionsFromStreamProcessor::get_options ( ) const

Just return the OptionsFromStream object in its current state.

This function does not force the options to be processed.

Definition at line 73 of file OptionsFromStreamPack_CommandLineOptionsFromStreamProcessor.cpp.

OptionsFromStreamPack::CommandLineOptionsFromStreamProcessor::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
options_file_name_opt_name   
)

Set the name of the commandline option name that specifies the options file name.

Postconditions:

  • this->options_file_name_opt_name()==options_file_name_opt_name
OptionsFromStreamPack::CommandLineOptionsFromStreamProcessor::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
options_file_name_opt_doc   
)

Set the documentation of the commandline option name that specifies the options file name.

Postconditions:

  • this->options_file_name_opt_doc()==options_file_name_opt_doc
OptionsFromStreamPack::CommandLineOptionsFromStreamProcessor::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
options_file_name   
)

Set the options file name manually (which will be used for default value for "--${options_file_name_opt_name}=???" commandline option).

Postconditions:

  • this->options_file_name()==options_file_name
OptionsFromStreamPack::CommandLineOptionsFromStreamProcessor::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
extra_options_str_opt_name   
)

Set the name of the commandline option name that specifies the extra options.

Postconditions:

  • this->extra_options_str_opt_name()==extra_options_str_opt_name
OptionsFromStreamPack::CommandLineOptionsFromStreamProcessor::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
extra_options_str_opt_doc   
)

Set the documentation of the commandline option name that specifies the extra options.

Postconditions:

  • this->oextra_options_str_opt_doc()==extra_options_str_opt_doc
OptionsFromStreamPack::CommandLineOptionsFromStreamProcessor::STANDARD_MEMBER_COMPOSITION_MEMBERS ( std::string  ,
extra_options_str   
)

Set the extra commandline options string (can be used for default value for "--${extra_options_str_opt_name}=???" commandline option).

Postconditions:

  • this->get_extra_options_str()===extra_options_str
void OptionsFromStreamPack::CommandLineOptionsFromStreamProcessor::setup_commandline_processor ( Teuchos::CommandLineProcessor clp)

Setup a comandline processor before it processes commandline options or reads form a file.

Sets up two options on the commandline processor:

  • –${this->options_file_name_opt_name()}: Sets the value returned from this->options_file_name()
  • –${this->extra_options_str_opt_name()}: Sets the value returned from this->extra_options_str()

Definition at line 78 of file OptionsFromStreamPack_CommandLineOptionsFromStreamProcessor.cpp.

void OptionsFromStreamPack::CommandLineOptionsFromStreamProcessor::process_options ( )

Read the options file and/or process the commandline options.

If this->options_file_name()!="", then this file is read and processed first. Then, if this->extra_options_str()!="", this is followed by the processing of these extra options which may overide options set in the input options file.

Note: If this->get_options().get()==NULL before this function is called and if this->options_file_name()!="" or this->extra_options_str()!="", the an OptionsFromStream object will be created anew to store the parsed options.

Note: 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 *this->get_options().

Definition at line 86 of file OptionsFromStreamPack_CommandLineOptionsFromStreamProcessor.cpp.

Teuchos::RCP< OptionsFromStream > OptionsFromStreamPack::CommandLineOptionsFromStreamProcessor::process_and_get_options ( )

The documentation for this class was generated from the following files: