Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

/root/src/subsynth/syn/Util/MultivariateType.h

Go to the documentation of this file.
00001 #ifndef MULTIVARIATETYPE
00002 #define MULTIVARIATETYPE
00003 
00004 #include <sstream>
00005 #include <string>
00006 
00007 namespace syn
00008 {
00009 
00010    class MultivariateType
00011    {
00012    public:
00013       MultivariateType() : mData( "" )
00014       {
00015       }
00016 
00017       MultivariateType( const MultivariateType& r )
00018       {
00019          mData = r.mData;
00020       }
00021 
00022       MultivariateType( const std::string& str_val )
00023       {
00024          mData = str_val;
00025       }
00026 
00027    #ifndef SYN_NO_MEMBER_TEMPLATES
00028       template<class T>
00029       MultivariateType( const T& val )
00030       {
00031          this->setValue<T>( val );
00032       }
00033    #endif // ! SYN_NO_MEMBER_TEMPLATES
00034 
00035       std::string getString() const
00036       { 
00037          return mData; 
00038       }
00039 
00040    #ifndef SYN_NO_MEMBER_TEMPLATES
00041 
00044       template<class T>
00045       void setValue( const T& val )
00046       {
00047          std::ostringstream oss;
00048          oss << val;
00049          mData = oss.str();
00050       }
00051 
00052       template<class T>
00053       T getValue(T dum = T()) const
00054       {
00055          T t;
00056          std::istringstream iss( mData );
00057          iss >> t;
00058          return t;
00059       }
00060    #endif // ! SYN_NO_MEMBER_TEMPLATES
00061 
00063       operator std::string() const
00064       {
00065          return mData;
00066       }
00067 
00068    protected:
00069       std::string mData;
00070    };
00071 } // bokbokbok
00072 
00073 #endif

Generated at Mon Apr 15 09:26:08 2002 for subsynth by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001