Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# APPSPACK_Parameter_List.hpp

Go to the documentation of this file.

    00001 // $Id: APPSPACK_Parameter_List.hpp,v 1.8.2.1 2005/06/29 17:07:42 tgkolda Exp $
    00002 // $Source: /space/CVS-Acro/acro/packages/appspack/appspack/src/APPSPACK_Parameter_List.hpp,v $
    00003
    00004 //@HEADER
    00005 // ************************************************************************
    00006 //
    00007 //          APPSPACK: Asynchronous Parallel Pattern Search
    00008 //                 Copyright (2003) Sandia Corporation
    00009 //
    00010 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
    00011 // license for use of this work by or on behalf of the U.S. Government.
    00012 //
    00013 // This library is free software; you can redistribute it and/or modify
    00014 // it under the terms of the GNU Lesser General Public License as
    00015 // published by the Free Software Foundation; either version 2.1 of the
    00016 // License, or (at your option) any later version.
    00017 //
    00018 // This library is distributed in the hope that it will be useful, but
    00019 // WITHOUT ANY WARRANTY; without even the implied warranty of
    00020 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00021 // Lesser General Public License for more details.
    00022 //
    00023 // You should have received a copy of the GNU Lesser General Public
    00024 // License along with this library; if not, write to the Free Software
    00025 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
    00026 // USA.                                                                           .
    00027 //
    00028 // Questions? Contact Tammy Kolda (tgkolda@sandia.gov)
    00029 //
    00030 // ************************************************************************
    00031 //@HEADER
    00032
    00038 #ifndef APPSPACK_PARAMETER_LIST_HPP
    00039 #define APPSPACK_PARAMETER_LIST_HPP
    00040
    00041 #include "APPSPACK_Common.hpp"
    00042 #include "APPSPACK_Parameter_Entry.hpp"
    00043 #include "APPSPACK_GCI.hpp"
    00044
    00045 namespace APPSPACK {
    00046 namespace Parameter {
    00047
    00055 class List {
    00056
    00058   typedef map<string, Entry> Map;
    00059
    00061   typedef Map::const_iterator ConstIterator;
    00062
    00064   typedef Map::iterator Iterator;
    00065
    00066 public:
    00067
    00068
    00070   List();
    00071
    00073   List(const List& source);
    00074
    00076   List& operator=(const List& source);
    00077
    00079   ~List();
    00080
    00081   //-------------------------
    00088
    00090
    00095   List& sublist(const string& name);
    00096
    00098
    00102   const List& sublist(const string& name) const;
    00104
    00105
    00106   //-------------------------
    00129
    00131   void setParameter(const string& name, bool value);
    00132
    00134   void setParameter(const string& name, int value);
    00135
    00137   void setParameter(const string& name, double value);
    00138
    00140   void setParameter(const string& name, const char* value);
    00141
    00143   void setParameter(const string& name, const string& value);
    00144
    00146   void setParameter(const string& name, const Value& value);
    00147
    00149   void setParameter(const string& name, const Vector& value);
    00151
    00167
    00169   bool getParameter(const string& name, bool nominal);
    00170
    00172   int getParameter(const string& name, int nominal);
    00173
    00175   double getParameter(const string& name, double nominal);
    00176
    00178   const string& getParameter(const string& name, const char* nominal);
    00179
    00181   const string& getParameter(const string& name, const string& nominal);
    00182
    00184   const Value& getParameter(const string& name, const Value& nominal);
    00185
    00187   const Vector& getParameter(const string& name, const Vector& nominal);
    00188
    00189
    00191   bool getParameter(const string& name, bool nominal) const;
    00192
    00194   int getParameter(const string& name, int nominal) const;
    00195
    00197   double getParameter(const string& name, double nominal) const;
    00198
    00200   const string& getParameter(const string& name, const char* nominal) const;
    00201
    00203   const string& getParameter(const string& name, const string& nominal) const;
    00204
    00206   const Value& getParameter(const string& name, const Value& nominal) const;
    00207
    00209   const Vector& getParameter(const string& name, const Vector& nominal) const;
    00210
    00212
    00220
    00222   double getDoubleParameter(const string& name) const;
    00223
    00225   const Value& getValueParameter(const string& name) const;
    00226
    00228   const Vector& getVectorParameter(const string& name) const;
    00230
    00237
    00239   bool isParameter(const string& name) const;
    00240
    00242   bool isParameterBool(const string& name) const;
    00243
    00245   bool isParameterInt(const string& name) const;
    00246
    00248   bool isParameterDouble(const string& name) const;
    00249
    00251   bool isParameterString(const string& name) const;
    00252
    00254   bool isParameterSublist(const string& name) const;
    00255
    00257   bool isParameterValue(const string& name) const;
    00258
    00260   bool isParameterVector(const string& name) const;
    00262
    00269
    00271   bool isParameterEqual(const string& name, bool value) const;
    00272
    00274   bool isParameterEqual(const string& name, int value) const;
    00275
    00277   bool isParameterEqual(const string& name, double value) const;
    00278
    00280   bool isParameterEqual(const string& name, const char* value) const;
    00281
    00283   bool isParameterEqual(const string& name, const string& value) const;
    00284
    00286   bool isParameterEqual(const string& name, const Value& value) const;
    00287
    00289   bool isParameterEqual(const string& name, const Vector& value) const;
    00290
    00292
    00294
    00296   ostream& print(ostream& stream = cout, int indent = 0) const;
    00297
    00299
    00307
    00309   void pack() const;
    00310
    00312   void unpack();
    00313
    00315
    00316 private:
    00317
    00319   bool isRecursive(const List& l) const;
    00320
    00322   const string& name(ConstIterator i) const;
    00323
    00325   Entry& entry(Iterator i);
    00326
    00328   const Entry& entry(ConstIterator i) const;
    00329
    00330 private:
    00331
    00333   enum PackingCodes
    00334   {
    00336     NEW_ENTRY,
    00338     END_OF_LIST
    00339   };
    00340
    00342   Map params;
    00343
    00349   mutable vector<string> tmpstrings;
    00350 };
    00351 }
    00352 }
    00353
    00354 #endif
    00355
    00356

© Sandia Corporation | Site Contact | Privacy and Security

Generated on Wed Dec 14 18:41:04 2005 for APPSPACK 4.0.2 by 1.3.8 written by Dimitri van Heesch, © 1997-2002