MoochoPack: Miscellaneous Utilities for MOOCHO Version of the Day
OptionsFromStreamPack_CommandLineOptionsFromStreamProcessor.hpp
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
00005 //                  Copyright (2003) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #ifndef OPTIONS_FORM_STEAM_PACK_COMMANDLINE_OPTIONS_FROM_STREAM_PROCESSOR_HPP
00030 #define OPTIONS_FORM_STEAM_PACK_COMMANDLINE_OPTIONS_FROM_STREAM_PROCESSOR_HPP
00031 
00032 #include "OptionsFromStreamPack_OptionsFromStream.hpp"
00033 #include "Teuchos_CommandLineProcessor.hpp"
00034 #include "Teuchos_RCP.hpp"
00035 #include "Teuchos_StandardMemberCompositionMacros.hpp"
00036 
00037 namespace OptionsFromStreamPack {
00038 
00044 class CommandLineOptionsFromStreamProcessor {
00045 public:
00046 
00058   CommandLineOptionsFromStreamProcessor(
00059     const std::string  &options_file_name_opt_name   = "ofs-options-file"
00060     ,const std::string  &options_file_name_opt_doc   = "The name of the file containing input options for OptionsFromStream object."
00061     ,const std::string &options_file_name            = ""
00062     ,const std::string &extra_options_str_opt_name   = "ofs-extra-options"
00063     ,const std::string &extra_options_str_opt_doc    = "Extra options in format \"OptGrp1{name1=val1,...,namen=valn}:OptGr2{name1=val1,...,namen=valn}:...\""
00064     ,const std::string &extra_options_str            = ""
00065     );
00066   // RAB: 2006/01/27: Note, this value contains no semi-columns since this
00067   // conflicts with Trilinos' runtests script.  Therefore, I have to replace
00068   // the ',' separators with ';' below!
00069   // Note: we can leave off the last ',' since it turns out that the
00070   // way the new OptionsFromStream::parse_options(...) is written that
00071   // the last semicolon in an options group is not necessary!
00072 
00080   void set_options(
00081     Teuchos::RCP<OptionsFromStream> const& options
00082     );
00083 
00089   Teuchos::RCP<OptionsFromStream> get_options() const;
00090 
00098   STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,options_file_name_opt_name);
00099 
00107   STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,options_file_name_opt_doc);
00108 
00116   STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,options_file_name);
00117 
00125   STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,extra_options_str_opt_name);
00126 
00134   STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,extra_options_str_opt_doc);
00135 
00143   STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,extra_options_str);
00144 
00153   void setup_commandline_processor(
00154     Teuchos::CommandLineProcessor *clp
00155     );
00156 
00173   void process_options();
00174 
00178   Teuchos::RCP<OptionsFromStream> process_and_get_options();
00179 
00180 private:
00181 
00182   Teuchos::RCP<OptionsFromStream>     options_;
00183 
00184 };
00185 
00186 } // end namespace OptionsFromStreamPack
00187 
00188 #endif  // OPTIONS_FORM_STEAM_PACK_COMMANDLINE_OPTIONS_FROM_STREAM_PROCESSOR_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends