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 "common_header.h" 00026 00027 namespace Marsyas 00028 { 00036 class MarSystem; 00037 00042 enum { 00043 tmcv_null=0, 00044 tmcv_real, 00045 tmcv_natural, 00046 tmcv_string, 00047 tmcv_bool, 00048 tmcv_vec, 00049 tmcv_marsystem 00050 }; 00051 00052 // define an enum for marsystem type that doesn't class with the mar_* types 00053 //#define mar_marsystem 8192 00054 00055 class TmControlValue 00056 { 00057 protected: 00059 int type_; 00060 00062 mrs_real r_; 00063 mrs_natural n_; 00064 bool b_; 00065 std::string s_; 00066 MarSystem* ms_; 00067 00068 public: 00070 TmControlValue(); 00074 TmControlValue(const TmControlValue& v); 00075 00076 // MarControlValue& operator=(const MarControlValue& a); 00077 00081 TmControlValue(float re); 00085 TmControlValue(double re); 00089 TmControlValue(int ne); 00093 TmControlValue(long int ne); 00097 TmControlValue(std::string st); 00101 TmControlValue(const char * cc); 00105 TmControlValue(bool be); 00109 TmControlValue(MarSystem* m); 00110 00115 mrs_real toReal(); 00120 mrs_natural toNatural(); 00125 bool toBool(); 00130 std::string toString(); 00135 MarSystem* toMarSystem(); 00136 00141 int getType(); 00145 std::string getSType(); 00148 friend std::ostream& operator<<(std::ostream&, const TmControlValue&); 00149 }; 00150 00151 }//namespace Marsyas 00152 00153 #endif 00154 00155
1.5.6