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

# APPSPACK_Parameter_Entry.hpp

Go to the documentation of this file.

    00001 // $Id: APPSPACK_Parameter_Entry.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_Entry.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_ENTRY_HPP
    00039 #define APPSPACK_PARAMETER_ENTRY_HPP
    00040
    00041 #include "APPSPACK_Common.hpp"          // class data element (string)
    00042 #include "APPSPACK_Value.hpp"
    00043 #include "APPSPACK_Vector.hpp"
    00044
    00045 namespace APPSPACK {
    00046
    00048 namespace Parameter {
    00049
    00050 class List; // anonther parameter type (forward declaration)
    00051
    00064 class Entry {
    00065
    00066 public:
    00067
    00075
    00077   Entry();
    00078
    00080   Entry(const Entry& source);
    00081
    00083   Entry(bool value, bool isCreatedByGet = false);
    00084
    00086   Entry(int value, bool isCreatedByGet = false);
    00087
    00089   Entry(double value, bool isCreatedByGet = false);
    00090
    00092   Entry(const string& value, bool isCreatedByGet = false);
    00093
    00095   Entry(const Value& value, bool isCreatedByGet = false);
    00096
    00098   Entry(const Vector& value, bool isCreatedByGet = false);
    00099
    00101   ~Entry();
    00102
    00104
    00106
    00108   Entry& operator=(const Entry& source);
    00109
    00111
    00116
    00117   List& setList(bool isCreatedByGet = false);
    00119   List& getListValue();
    00121   const List& getListValue() const;
    00123
    00132
    00133   void setValue(bool value, bool isCreatedByGet = false);
    00135   void setValue(int value, bool isCreatedByGet = false);
    00137   void setValue(double value, bool isCreatedByGet = false);
    00139   void setValue(const char* value, bool isCreatedByGet = false);
    00141   void setValue(const string& value, bool isCreatedByGet = false);
    00143   void setValue(const Value& value, bool isCreatedByGet = false);
    00145   void setValue(const Vector& value, bool isCreatedByGet = false);
    00147
    00154
    00155   bool isBool() const;
    00157   bool isInt() const;
    00159   bool isDouble() const;
    00161   bool isString() const;
    00163   bool isList() const;
    00165   bool isValue() const;
    00167   bool isVector() const;
    00169
    00170
    00180
    00181   bool getBoolValue() const;
    00183   int getIntValue() const;
    00185   double getDoubleValue() const;
    00187   const string& getStringValue() const;
    00189   const Value& getValueValue() const;
    00191   const Vector& getVectorValue() const;
    00193
    00204
    00205   void pack() const;
    00207   void unpack();
    00208
    00210
    00212
    00214
    00220   ostream& leftshift(ostream& stream) const;
    00221
    00223
    00224 private:
    00225
    00227   void reset();
    00228
    00230   enum EntryType {
    00232     APPSPACK_NONE,
    00234     APPSPACK_BOOL,
    00236     APPSPACK_INT,
    00238     APPSPACK_DOUBLE,
    00240     APPSPACK_STRING,
    00242     APPSPACK_LIST,
    00244     APPSPACK_VALUE,
    00246     APPSPACK_VECTOR
    00247   };
    00248
    00250   EntryType type;
    00251
    00253   bool bval;
    00254
    00256   int ival;
    00257
    00259   double dval;
    00260
    00262   string sval;
    00263
    00265   List* lval;
    00266
    00268   Value valueval;
    00269
    00271   Vector vectorval;
    00272
    00274   mutable bool isGotten;
    00275
    00277   mutable bool isSetByGet;
    00278
    00279 };
    00280
    00281 } // namespace Parameter
    00282 } // namespace APPSPACK
    00283
    00285 ostream& operator<<(ostream& stream, const APPSPACK::Parameter::Entry& e);
    00286
    00287 #endif

© 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