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 #ifndef MARSYAS_MARSYSTEMTEMPLATEADVANCED_H 00020 #define MARSYAS_MARSYSTEMTEMPLATEADVANCED_H 00021 00022 #include <marsyas/system/MarSystem.h> 00023 00024 namespace Marsyas 00025 { 00032 // declare a new custom control to be used by 00033 // this MarSystem (e.g. a header for a file) 00034 struct MyHeader 00035 { 00036 std::string someString; 00037 mrs_natural someValue; 00038 bool someFlag; 00039 realvec someVec; 00040 00041 // some operators are mandatory for all controls! 00042 // so we must declare and define them for our custom controls 00043 marsyas_EXPORT friend bool operator==(const MyHeader& hdr1, const MyHeader& hdr2); 00044 marsyas_EXPORT friend bool operator!=(const MyHeader& hdr1, const MyHeader& hdr2); 00045 marsyas_EXPORT friend MyHeader operator+(MyHeader& hdr1, MyHeader& hdr2); 00046 marsyas_EXPORT friend MyHeader operator-(MyHeader& hdr1, MyHeader& hdr2); 00047 marsyas_EXPORT friend MyHeader operator*(MyHeader& hdr1, MyHeader& hdr2); 00048 marsyas_EXPORT friend MyHeader operator/(MyHeader& hdr1, MyHeader& hdr2); 00049 marsyas_EXPORT friend std::ostream& operator<<(std::ostream& os, const MyHeader& hdr); 00050 marsyas_EXPORT friend std::istream& operator>>(std::istream& is, MyHeader& hdr); 00051 }; 00052 00053 // alias to avoid excessive verbosity (see addControls() definition in .cpp) 00054 typedef MarControlValueT<MyHeader> MyHeaderT; 00055 00056 class marsyas_EXPORT MarSystemTemplateAdvanced: public MarSystem 00057 { 00058 private: 00059 std::string someString_; 00060 00061 //Add specific controls needed by this MarSystem. 00062 void addControls(); 00063 00064 //"Pointers" to controls allow efficient access to their values. 00065 //(for clarity sake, we use the ctrl_ prefix so these "pointers" 00066 //can be easily identified through out the code.. but this is not 00067 //mandatory, just recommended) 00068 MarControlPtr ctrl_header_; 00069 00070 void myUpdate(MarControlPtr sender); 00071 00072 public: 00073 MarSystemTemplateAdvanced(std::string name); 00074 MarSystemTemplateAdvanced(const MarSystemTemplateAdvanced& a);//copy ctor 00075 ~MarSystemTemplateAdvanced(); 00076 MarSystem* clone() const; 00077 00078 void myProcess(realvec& in, realvec& out); 00079 }; 00080 00081 }//namespace Marsyas 00082 00083 #endif //MARSYAS_MARSYSTEMTEMPLATEADVANCED_H 00084