Marsyas  0.6.0-alpha
/usr/src/RPM/BUILD/marsyas-0.6.0/src/marsyas/marsystems/WekaSink.h
Go to the documentation of this file.
00001 /*
00002 ** Copyright (C) 1998-2010 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_WEKASINK_H
00020 #define MARSYAS_WEKASINK_H
00021 
00022 #include <marsyas/system/MarSystem.h>
00023 
00024 #include <fstream>
00025 #include <sstream>
00026 #include <iomanip>
00027 
00028 namespace Marsyas
00029 {
00056 class WekaSink: public MarSystem
00057 {
00058 private:
00059   void addControls();
00060   void myUpdate(MarControlPtr sender);
00061 
00063   std::string filename_;
00064 
00066   std::ofstream* mos_;
00067 
00069   std::vector<std::string> labelNames_;
00070 
00072   mrs_natural precision_;
00073   mrs_natural downsample_;
00074 
00075   MarControlPtr ctrl_regression_;
00076   MarControlPtr ctrl_inject_;
00077   MarControlPtr ctrl_injectComment_;
00078   MarControlPtr ctrl_injectVector_;
00079 
00080 
00081   MarControlPtr ctrl_putHeader_;
00082   MarControlPtr ctrl_precision_;
00083   MarControlPtr ctrl_downsample_;
00084   MarControlPtr ctrl_nLabels_;
00085   MarControlPtr ctrl_labelNames_;
00086   MarControlPtr ctrl_filename_;
00087   MarControlPtr ctrl_currentlyPlaying_;
00088 
00089   MarControlPtr ctrl_onlyStable_;
00090   MarControlPtr ctrl_resetStable_;
00091 
00092   mrs_string prev_playing_;
00093 
00094   mrs_natural stabilizingTicks_;
00095   mrs_natural count_;
00096 
00097 public:
00099   WekaSink(std::string name);
00100 
00102   WekaSink(const WekaSink& a);
00103 
00105   ~WekaSink();
00106 
00107   MarSystem* clone() const;
00108 
00110   void putHeader(std::string inObsNames);
00111 
00112   void myProcess(realvec& in, realvec& out);
00113 
00114   // Jen's hack for MIREX 05 to annotate produced weka file
00115   std::ofstream* getOfstream()
00116   {
00117     return mos_;
00118   }
00119 
00120 };
00121 
00122 }//namespace Marsyas
00123 
00124 
00125 #endif
00126 
00127 
00128 
00129 
00130 
00131 
00132 
00133 
00134 
00135