fei_Param.hpp

00001 /*--------------------------------------------------------------------*/
00002 /*    Copyright 2005 Sandia Corporation.                              */
00003 /*    Under the terms of Contract DE-AC04-94AL85000, there is a       */
00004 /*    non-exclusive license for use of this work by or on behalf      */
00005 /*    of the U.S. Government.  Export of this program may require     */
00006 /*    a license from the United States Government.                    */
00007 /*--------------------------------------------------------------------*/
00008 
00009 #ifndef _fei_Param_hpp_
00010 #define _fei_Param_hpp_
00011 
00012 #include <fei_macros.hpp>
00013 #include <string>
00014 
00015 namespace fei {
00023 class Param {
00024   public:
00026   enum ParamType {
00027     STRING = 0,
00028     DOUBLE = 1,
00029     INT = 2,
00030     BOOL = 3,
00031     VOID = 4,
00032     BAD_TYPE = 5
00033   };
00034 
00036   Param(const char* name, const char* value);
00038   Param(const char* name, double value);
00040   Param(const char* name, int value);
00042   Param(const char* name, const void* value);
00044   Param(const char* name, bool value);
00046   Param(const Param& src);
00047 
00049   virtual ~Param();
00050 
00052   Param& operator=(const Param& src);
00053 
00055   std::string getName() const;
00056 
00058   ParamType getType() const;
00059 
00062   std::string getStringValue() const;
00063 
00066   double getDoubleValue() const;
00067 
00070   int getIntValue() const;
00071 
00074   bool getBoolValue() const;
00075 
00078   const void* getVoidValue() const;
00079 
00080   private:
00081   ParamType type_;
00082   std::string name_;
00083   std::string string_value_;
00084   double double_value_;
00085   int int_value_;
00086   bool bool_value_;
00087   const void* void_value_;
00088 };
00089 }//namespace fei
00090 
00091 inline
00092 std::string fei::Param::getName() const
00093 {
00094   return name_;
00095 }
00096 
00097 inline
00098 fei::Param::ParamType fei::Param::getType() const
00099 {
00100   return type_;
00101 }
00102 
00103 inline
00104 std::string fei::Param::getStringValue() const
00105 {
00106   return string_value_;
00107 }
00108 
00109 inline
00110 double fei::Param::getDoubleValue() const
00111 {
00112   return double_value_;
00113 }
00114 
00115 inline
00116 int fei::Param::getIntValue() const
00117 {
00118   return int_value_;
00119 }
00120 
00121 inline
00122 bool fei::Param::getBoolValue() const
00123 {
00124   return bool_value_;
00125 }
00126 
00127 inline
00128 const void* fei::Param::getVoidValue() const
00129 {
00130   return void_value_;
00131 }
00132 #endif

Generated on Wed May 12 21:30:41 2010 for FEI by  doxygen 1.4.7