Marsyas
0.6.0-alpha
|
00001 /* 00002 ** Copyright (C) 1998-2005 George Tzanetakis <gtzan@cs.uvic.ca> 00003 ** 00004 ** This program is free software; you can redistribute it and/or modify 00005 ** it under the terms of the GNU General Public License as published by 00006 ** the Free Software Foundation; either version 2 of the License, or 00007 ** (at your option) any later version. 00008 ** 00009 ** This program is distributed in the hope that it will be useful, 00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 ** GNU General Public License for more details. 00013 ** 00014 ** You should have received a copy of the GNU General Public License 00015 ** along with this program; if not, write to the Free Software 00016 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef MARSYAS_TM_CONTROLVALUE_H 00020 #define MARSYAS_TM_CONTROLVALUE_H 00021 00022 #include <string> 00023 #include <iostream> 00024 00025 #include <marsyas/common_header.h> 00026 00027 namespace Marsyas 00028 { 00029 class MarSystem; 00030 00034 enum { 00035 tmcv_null=0, 00036 tmcv_real, 00037 tmcv_natural, 00038 tmcv_string, 00039 tmcv_bool, 00040 tmcv_vec, 00041 tmcv_marsystem 00042 }; 00043 00044 // define an enum for marsystem type that doesn't class with the mar_* types 00045 //#define mar_marsystem 8192 00046 00052 class TmControlValue 00053 { 00054 protected: 00056 int type_; 00057 00059 mrs_real r_; 00060 mrs_natural n_; 00061 bool b_; 00062 std::string s_; 00063 MarSystem* ms_; 00064 00065 public: 00067 TmControlValue(); 00071 TmControlValue(const TmControlValue& v); 00072 00073 // MarControlValue& operator=(const MarControlValue& a); 00074 00078 TmControlValue(float re); 00082 TmControlValue(double re); 00086 TmControlValue(int ne); 00090 TmControlValue(long int ne); 00094 TmControlValue(std::string st); 00098 TmControlValue(const char * cc); 00102 TmControlValue(bool be); 00106 TmControlValue(MarSystem* m); 00107 00112 mrs_real toReal(); 00117 mrs_natural toNatural(); 00122 bool toBool(); 00127 std::string toString(); 00132 MarSystem* toMarSystem(); 00133 00138 int getType(); 00142 std::string getSType(); 00145 friend std::ostream& operator<<(std::ostream&, const TmControlValue&); 00146 }; 00147 00148 }//namespace Marsyas 00149 00150 #endif 00151 00152