Marsyas  0.6.0-alpha
/usr/src/RPM/BUILD/marsyas-0.6.0/src/marsyas/MrsLog.h
Go to the documentation of this file.
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_MRSLOG_H
00020 #define MARSYAS_MRSLOG_H 1
00021 
00022 #include <marsyas/common_header.h>
00023 #include <marsyas/export.h>
00024 
00025 #include <sstream>
00026 #include <string>
00027 #include <cstdlib>
00028 
00029 namespace Marsyas
00030 {
00040 class marsyas_EXPORT MrsLog
00041 {
00042 public:
00043   typedef void (*log_function_t)(const std::string & msg);
00044 
00045 private:
00046   static std::string fname_;
00047 
00048   static log_function_t message_function_;
00049   static log_function_t warning_function_;
00050   static log_function_t error_function_;
00051   static log_function_t debug_function_;
00052   static log_function_t diagnostic_function_;
00053 
00054 public:
00055   static bool warnings_off_;
00056   static bool messages_off_;
00057 
00058   static  void setLogFile(std::string fname);
00059   static  void getLogFile();
00060 
00061   static void setMessageFunction(log_function_t function);
00062   static void setWarningFunction(log_function_t function);
00063   static void setErrorFunction(log_function_t function);
00064   static void setDebugFunction(log_function_t function);
00065   static void setDiagnosticFunction(log_function_t function);
00066   static void setAllFunctions(log_function_t function);
00067 
00068   static  void mrsMessage(const std::ostringstream& oss);
00069   //logging methods
00070   static  void mrsErr(const std::ostringstream& oss);
00071   static  void mrsWarning(const std::ostringstream& oss);
00072   static  void mrsDiagnostic(const std::ostringstream& oss);
00073   static  void mrsDebug(const std::ostringstream& oss);
00074   static  void mrsAssert(const char *strFile, unsigned uLine);
00075 };
00076 } //namespec Marsyas
00077 
00078 #endif