Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

mitkCommonIncludes.h

00001 /*=========================================================================
00002 
00003   Program:   3DMed
00004   Date:      $Date: 2014-02-25 18:30:00 +0800 $
00005   Version:   $Version: 4.6.0 $
00006   Copyright: MIPG, Institute of Automation, Chinese Academy of Sciences
00007 
00008 =========================================================================*/
00009 
00010 
00011 // The mitkCommonIncludes centralizes the inclusion of system include
00012 // files. 
00013 
00014 #ifndef __mitkCommonIncludes_h
00015 #define __mitkCommonIncludes_h
00016 
00017 //
00018 //OS-----------------------------------------------------------------
00019 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
00020     #define MITK_OS_WIN32
00021 #elif defined(WIN64) || defined(_WIN64) || defined(__WIN64__)
00022     #define MITK_OS_WIN32
00023     #define MITK_OS_WIN64
00024 #elif defined(MSDOS) || defined(_MSDOS)
00025     #define MITK_OS_MSDOS
00026 #elif defined(__linux__) || defined(__linux)
00027     #define MITK_OS_LINUX
00028 #elif defined(__APPLE__) && defined(__GNUC__)
00029     #define MITK_OS_MACX
00030 #elif defined(__MACOSX__)
00031     #define MITK_OS_MACX
00032 #elif defined(macintosh)
00033     #define MITK_OS_MAC9
00034 #elif defined(__OS2__)
00035     #if defined(__EMX__)
00036         #define MITK_OS_OS2EMX
00037     #else
00038         #define MITK_OS_OS2
00039     #endif
00040 #elif defined(__sun) || defined(sun)
00041     #define MITK_OS_SOLARIS
00042 #elif defined(hpux) || defined(__hpux)
00043     #define MITK_OS_HPUX
00044 #elif defined(__FreeBSD__)
00045     #define MITK_OS_FREEBSD
00046     #define MITK_OS_BSD4
00047 #endif
00048 
00049 #if defined(MITK_OS_MAC9) || defined(MITK_OS_MACX)
00050 #define MITK_OS_MAC
00051 #endif
00052 
00053 #if defined(MITK_OS_MAC9) || defined(MITK_OS_MSDOS) || defined(MITK_OS_OS2) || defined(MITK_OS_WIN32) || defined(MITK_OS_WIN64)
00054 #undef MITK_OS_UNIX
00055 #elif !defined(MITK_OS_UNIX)
00056 #define MITK_OS_UNIX
00057 #endif
00058 
00059 //
00060 //Thread API-----------------------------------------------------------------
00061 
00062 #ifndef MITK_USE_WIN32_THREADS
00063 #ifndef MITK_USE_PTHREAD
00064 
00065 #ifdef MITK_OS_WIN32
00066 #define MITK_USE_WIN32_THREADS
00067 #endif 
00068 
00069 #ifdef MITK_OS_LINUX
00070 #define MITK_USE_PTHREAD
00071 #endif 
00072 
00073 #endif
00074 #endif
00075 
00076 //
00077 //Compiler----------------------------------------------------------------
00078 #if defined(_MSC_VER)
00079     #define MITK_CC_MSVC
00080     //Visual C++.Net issues for _MSC_VER >= 1300 
00081     #if _MSC_VER >= 1300
00082         #define MITK_CC_MSVC_NET
00083     #endif  // _MSC_VER >= 1300
00084 #elif defined(__BORLANDC__) || defined(__TURBOC__)
00085     #define MITK_CC_BORLAND
00086 #elif defined(__GNUC__)
00087     #define MITK_CC_GNU 
00088 #elif defined(__INTEL_COMPILER)
00089     #define MITK_CC_INTEL
00090 #endif
00091 
00092 
00093 
00094 //
00095 // Dll export------------------------------------------
00096 #if defined(MITK_OS_WIN32)  // Windows system 
00097 #define _WIN32_WINNT 0x0501   // for Mouse Wheel support
00098 #include <windows.h>
00099     #if defined(MITK_COMMON_DLL)  //Create a DLL library
00100         #define MITK_COMMON_API __declspec(dllexport)
00101         #define MITK_COMMON_DLL_EXPORT
00102     #elif !defined(MITK_STATIC) //Use a DLL library
00103         #define MITK_COMMON_API __declspec(dllimport)
00104         #define MITK_COMMON_DLL_EXPORT
00105         #if defined(MITK_CC_MSVC_NET)
00106             #define MITK_TEMPLATE extern
00107         #else
00108             #define MITK_TEMPLATE
00109         #endif
00110     #endif
00111 #else   //Other system
00112 #undef MITK_COMMON_DLL
00113 #endif
00114 
00115 #ifndef MITK_COMMON_API
00116     #define MITK_COMMON_API
00117 #endif
00118 
00119 //
00120 // Default os-dependent const values
00121 #if defined(MITK_OS_WIN32)
00122     #define MITK_DEFAULT_TEMP_PATH getenv("TEMP")
00123 #elif defined(MITK_OS_LINUX)
00124     #define MITK_DEFAULT_TEMP_PATH "/tmp/"
00125 #endif
00126 
00127 //
00128 // Handle MSVC compiler warning messages, etc.-------------------------
00129 #if defined(MITK_CC_MSVC)
00130 
00131 //disable warnings on 255 char debug symbols
00132 #pragma warning (disable : 4786)
00133 
00134 //disable warnings on extern before template instantiation
00135 #pragma warning (disable : 4231)
00136 
00137 //disable warnings on needs to have dll-interface to be used by clients of class
00138 #pragma warning (disable : 4251)
00139 
00140 #pragma warning (disable : 4018)
00141 
00142 #pragma warning ( disable : 4244 )
00143 
00144 #pragma warning ( disable : 4996 )
00145 
00146 //#pragma warning ( disable : 4127 )
00147 //#pragma warning ( disable : 4305 )
00148 //#pragma warning ( disable : 4309 )
00149 //#pragma warning ( disable : 4710 )
00150 //#pragma warning ( disable : 4706 )
00151 //#pragma warning ( disable : 4097 )
00152 
00153 #endif  //_MSC_VER
00154 
00155 
00156 
00157 //include  generic stuff-------------------------------------------------
00158 #include <stdio.h>
00159 #include <stdlib.h>
00160 
00161 static inline void mitkDisplayMessage(const char *msgBuf)
00162 {
00163     #if defined(MITK_OS_WIN32)
00164         const char *title = "Information";
00165         MessageBox(NULL, (LPCTSTR)msgBuf, (LPCTSTR)title, MB_OK);
00166     #else
00167         printf("%s", msgBuf);
00168     #endif
00169 }
00170 
00171 #if defined(MITK_OS_WIN32)
00172 #include <direct.h>
00173 static inline  bool mitkMakeDirectory(const char *dirname)
00174 {
00175     return (_mkdir(dirname)==0);
00176 }
00177 static inline bool mitkRemoveDirectory(const char *dirname)
00178 {
00179     return (_rmdir(dirname)==0);
00180 }
00181 #else
00182 #include <sys/stat.h>
00183 static inline bool mitkMakeDirectory(const char *dirname)
00184 {
00185     return (mkdir(dirname,S_IRUSR | S_IWUSR | S_IXUSR)==0);
00186 }
00187 static inline bool mitkRemoveDirectory(const char *dirname)
00188 {
00189     return (remove(dirname)==0);
00190 }
00191 #endif
00192 
00193 #endif
00194 

Generated on Tue Feb 25 15:00:36 2014 for MITK (Medical Imaging ToolKit) by  doxygen 1.4.3