Marsyas
0.6.0-alpha
|
00001 /* 00002 ** Copyright (C) 1998-2006 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 #include <marsyas/sched/EvValUpd.h> 00020 #include <marsyas/system/MarSystem.h> 00021 00022 using std::ostringstream; 00023 using namespace Marsyas; 00024 00025 EvValUpd::EvValUpd(mrs_string cname, MarControlPtr val) : EvEvent("EvValUpd","vu") 00026 { 00027 set(NULL,cname,val); 00028 } 00029 00030 EvValUpd::EvValUpd(MarSystem* ms, mrs_string cname, MarControlPtr val) : EvEvent("EvValUpd","vu") 00031 { 00032 set(ms,cname,val); 00033 } 00034 00035 EvValUpd::EvValUpd(EvValUpd& e) : EvEvent("EvValUpd","vu") 00036 { 00037 set(e.target_,e.cname_,e.value_); 00038 } 00039 00040 EvValUpd::~EvValUpd() { } 00041 00042 void 00043 EvValUpd::set(MarSystem* ms, mrs_string cname, MarControlPtr value) 00044 { 00045 target_=ms; 00046 cname_=cname; 00047 value_=value; 00048 } 00049 00050 void 00051 EvValUpd::dispatch() 00052 { 00053 if (target_ !=NULL) { 00054 target_->updControl(cname_,value_); 00055 } 00056 } 00057 00058 EvValUpd* 00059 EvValUpd::clone() 00060 { 00061 return new EvValUpd(*this); 00062 } 00063 00064 void 00065 EvValUpd::updctrl(std::string cname, TmControlValue value) 00066 { 00067 if (checkupd(cname,"mrs_string/control",value,tmcv_string)) { setCName(value.toString()); } 00068 else if (checkupd(cname,"MarSystem/target",value,tmcv_marsystem)) { setTarget(value.toMarSystem()); } 00069 // Note that setValue(type) depends on the setting of mrs_string/control 00070 // else if (checktype(cname,"MarSystem/target",value,mar_marsystem)) { setValue(value.toMarSystem()); } 00071 } 00072 00073 /* these have been moved to the header file 00074 mrs_string EvValUpd::getCName() const { return cname_; } 00075 MarControlPtr EvValUpd::getValue() const { return value_; } 00076 MarSystem* EvValUpd::getTarget() const { return target_; } 00077 00078 void EvValUpd::setCName(mrs_string cname) { cname_=cname; } 00079 void EvValUpd::setValue(MarControlPtr value) { value_=value; } 00080 void EvValUpd::setTarget(MarSystem* ms) { target_=ms; } 00081 */ 00082 /* 00083 ostream& Marsyas::operator<< (ostream& o, EvValUpd& e) { 00084 // sys.put(o); 00085 o << "EvValUpd<" << e.getCName() << "," << e.getValue() << ">"; 00086 return o; 00087 } 00088 */