Marsyas  0.6.0-alpha
/usr/src/RPM/BUILD/marsyas-0.6.0/src/marsyas/common_source.h
Go to the documentation of this file.
00001 #ifndef MARSYAS_COMMON_H
00002 #define MARSYAS_COMMON_H
00003 
00014 /************************************************************************/
00015 /*      common includes                                                     */
00016 /************************************************************************/
00017 #include "config.h"
00018 
00019 #include <cstdio>
00020 #include <sys/types.h>
00021 #include <complex>
00022 #include <limits>
00023 #include <marsyas/MrsLog.h>
00024 
00025 
00026 /************************************************************************/
00027 /*  Numerical defines                                                   */
00028 /************************************************************************/
00029 #ifdef WIN32
00030 #ifndef NOMINMAX
00031 #define NOMINMAX
00032 #endif
00033 #endif
00034 
00035 /************************************************************************/
00036 /* LOGGING MACROS                                                       */
00037 /************************************************************************/
00038 
00039 
00040 
00041 #ifdef MARSYAS_LOG_DEBUGS
00042 #define MRSDEBUG(x) {std::ostringstream oss; MrsLog::mrsDebug((std::ostringstream&)(oss << x));}
00043 #else
00044 #define MRSDEBUG(x)
00045 #endif
00046 
00047 
00048 
00049 #ifdef MARSYAS_LOG_DIAGNOSTICS
00050 # define MRSDIAG(x) {std::ostringstream oss; MrsLog::mrsDiagnostic((std::ostringstream&)(oss << x));}
00051 #else
00052 # define MRSDIAG(x)
00053 #endif
00054 
00055 
00056 #ifdef MARSYAS_LOG_MESSAGES
00057 # define MRSMSG(x) {std::ostringstream oss; MrsLog::mrsMessage((std::ostringstream&)(oss << x));}
00058 #else
00059 # define MRSMSG(x)
00060 #endif
00061 
00062 
00063 
00064 /************************************************************************/
00065 /*  MATLAB engine macros                                                */
00066 /************************************************************************/
00067 #ifdef MARSYAS_MATLAB
00068 #include "MATLABengine.h"
00069 #define MATLAB_PUT(var, name) {MATLABengine::getMatlabEng()->putVariable(var, name);}
00070 #define MATLAB_GET(name, var) MATLABengine::getMatlabEng()->getVariable(name, var)
00071 #define MATLAB_EVAL(s) {std::ostringstream oss; MATLABengine::getMatlabEng()->evalString((std::ostringstream&)(oss << s));}
00072 #define MATLAB_CLOSE() MATLABengine::getMatlabEng()->closeMatlabEng()
00073 #else
00074 #define MATLAB_PUT(var, name) {}
00075 #define MATLAB_GET(name, var) {}
00076 //#define MATLAB_GET(name, var) -1
00077 #define MATLAB_EVAL(s)  {}
00078 #define MATLAB_CLOSE()  {}
00079 #endif
00080 
00081 
00082 /************************************************************************/
00083 /*  Sleep MACRO                                                         */
00084 /************************************************************************/
00085 // FIXME: old definition; I don't think it works well.
00086 // #if defined(__WINDOWS_ASIO__) || defined (__WINDOWS_DS__)
00087 
00088 // FIXME: do we need to include _CYGWIN and _MINGW as well?
00089 
00090 #ifdef MARSYAS_WIN32 //|| defined (MARSYAS_MINGW)
00091 #include <windows.h>
00092 #define SLEEP(milliseconds) Sleep((DWORD) milliseconds)
00093 #else
00094 #include <unistd.h>
00095 #define SLEEP(milliseconds) usleep((unsigned long) (milliseconds) * 1000.0)
00096 #endif
00097 
00098 /************************************************************************/
00099 /*      WIN32 specific                                                    */
00100 /************************************************************************/
00101 //only  relevant for WIN32 MSVC (and ignored by all other platforms)
00102 //For more info about the reason for this #pragma consult:
00103 //http://msdn2.microsoft.com/en-us/library/ttcz0bys.aspx
00104 #ifdef MARSYAS_WIN32
00105 #pragma warning(disable : 4996)
00106 #endif
00107 
00108 #endif /* !MARSYAS_COMMON_H */
00109