openModeller
Version 1.4.0
|
00001 00029 #include <openmodeller/AlgParameter.hh> 00030 00031 #include <stdlib.h> 00032 #include <string.h> 00033 #include <stdio.h> 00034 00035 /****************************************************************/ 00036 /*********************** Om Alg Parameter ***********************/ 00037 00038 /********************/ 00039 /*** constructors ***/ 00040 00041 AlgParameter::AlgParameter(): 00042 _id(""), 00043 _value("") 00044 { 00045 00046 } 00047 00048 AlgParameter::AlgParameter( std::string const id, std::string const value ) 00049 { 00050 _id = id; 00051 _value = value; 00052 } 00053 00054 AlgParameter::AlgParameter( const AlgParameter ¶m ) 00055 { 00056 _id = param._id; 00057 _value = param._value; 00058 } 00059 00060 00061 /******************/ 00062 /*** destructor ***/ 00063 00064 AlgParameter::~AlgParameter() 00065 { 00066 00067 } 00068 00069 00070 /******************/ 00071 /*** operator = ***/ 00072 AlgParameter & 00073 AlgParameter::operator=( const AlgParameter ¶m ) 00074 { 00075 if ( this == ¶m ) { 00076 00077 return *this; 00078 } 00079 00080 _id = param._id; 00081 _value = param._value; 00082 00083 return *this; 00084 } 00085 00086 00087 /******************/ 00088 /*** value Real ***/ 00089 double 00090 AlgParameter::valueReal() 00091 { 00092 return _value.c_str() ? atof( _value.c_str() ) : 0.0; 00093 } 00094 00095 00096 /*****************/ 00097 /*** set Value ***/ 00098 void 00099 AlgParameter::setValue( double value ) 00100 { 00101 char buf[32]; 00102 sprintf( buf, "%-32.8f", value ); 00103 00104 _value = std::string(buf); 00105 } 00106 00107 00108