bbtkSystem.h

Go to the documentation of this file.
00001 /*=========================================================================                                                                               
00002   Program:   bbtk
00003   Module:    $RCSfile: bbtkSystem.h,v $
00004   Language:  C++
00005   Date:      $Date: 2009/06/08 14:50:04 $
00006   Version:   $Revision: 1.14 $
00007 =========================================================================*/
00008 
00009 /* ---------------------------------------------------------------------
00010 
00011 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
00012 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
00013 *
00014 *  This software is governed by the CeCILL-B license under French law and 
00015 *  abiding by the rules of distribution of free software. You can  use, 
00016 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
00017 *  license as circulated by CEA, CNRS and INRIA at the following URL 
00018 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
00019 *  or in the file LICENSE.txt.
00020 *
00021 *  As a counterpart to the access to the source code and  rights to copy,
00022 *  modify and redistribute granted by the license, users are provided only
00023 *  with a limited warranty  and the software's author,  the holder of the
00024 *  economic rights,  and the successive licensors  have only  limited
00025 *  liability. 
00026 *
00027 *  The fact that you are presently reading this means that you have had
00028 *  knowledge of the CeCILL-B license and that you accept its terms.
00029 * ------------------------------------------------------------------------ */                                                                         
00030 
00031 
00036 #ifndef __bbtkSystem_h__
00037 #define __bbtkSystem_h__
00038 
00039 #include "bbtkConfigure.h"
00040 
00041 // We try for Visual 6..????
00042 //#pragma warning( disable : 4786)
00043 
00044 
00045 
00046 //-----------------------------------------------------------------------------
00047 //This is needed when compiling in debug mode
00048 #ifdef _MSC_VER
00049 // 'identifier' : class 'type' needs to have dll-interface to be used by
00050 // clients of class 'type2'
00051 #pragma warning ( disable : 4251 )
00052 // non dll-interface class 'type' used as base for dll-interface class 'type2'
00053 #pragma warning ( disable : 4275 )
00054 // 'identifier' : identifier was truncated to 'number' characters in the
00055 // debug information
00056 #pragma warning ( disable : 4786 )
00057 //'identifier' : decorated name length exceeded, name was truncated
00058 #pragma warning ( disable : 4503 )
00059 // C++ exception specification ignored except to indicate a 
00060 // function is not __declspec(nothrow)
00061 #pragma warning ( disable : 4290 )
00062 // signed/unsigned mismatch
00063 #pragma warning ( disable : 4018 )
00064 // return type for 'identifier' is '' (ie; not a UDT or reference to UDT. Will
00065 // produce errors if applied using infix notation
00066 #pragma warning ( disable : 4284 )
00067 // 'type' : forcing value to bool 'true' or 'false' (performance warning)
00068 // Has revealed a real error !
00069 //  bbSignalOutputModification(bool) called rather than 
00070 //  bbSignalOutputModification(const std::string&, bool = true)
00071 //  when invoking bbSignalOutputModification("Out") 
00072 // KEEP IT !  
00073 // //#pragma warning ( disable : 4800 )
00074 // To avoid warning :
00075 // 'PACKAGE_NAMEGetPackage' has C-linkage specified, but returns UDT 'boost::shared_ptr<T>' which is incompatible with C
00076 #pragma warning ( disable : 4190 )
00077 
00078 
00079 #endif //_MSC_VER
00080 
00081 
00082 #include <stdio.h>  // for printf, ...
00083 #include <iostream> // for cout, endl, ...
00084 
00085 #ifdef _MSC_VER
00086 // Micro$oft related stuff
00087 #pragma once
00088 #include <conio.h>
00089 #include <tchar.h>
00090 #else
00091 //#include  <curses.h> // for getch
00092 #endif //_MSC_VER
00093 
00094 //-----------------------------------------------------------------------------
00095 // Micro$oft shared library related stuff
00096 //
00097 // all the classes that must be visible outside the bbtk library 
00098 // should be defined as :
00099 // class BBTK_EXPORT ClassName 
00100 // instead of :
00101 // class ClassName
00102 
00103 
00104 #if defined(_WIN32) 
00105   // IF NOT DEF THEN INTERNAL COMPILER ERROR WITH BOOST 1.37 ON VISUAL C++ 
00106   #define BOOST_SP_NO_SP_CONVERTIBLE
00107 #endif
00108 
00109 #if defined(_WIN32) 
00110 //&& defined(BUILD_SHARED_LIBS)
00111 //#include "WWW.h"
00112   #ifdef BBTK_EXPORT_SYMBOLS
00113     #define BBTK_EXPORT __declspec( dllexport )
00114 #else
00115     #define BBTK_EXPORT __declspec( dllimport )
00116   #endif
00117   #define BBTK_CDECL __cdecl
00118 #else
00119   #define BBTK_EXPORT
00120   #define BBTK_CDECL
00121 #endif // defined(_WIN32) && defined(BUILD_SHARED_LIBS)
00122 
00123 
00124 
00125 #ifdef __BORLANDC__
00126 #include <mem.h>
00127 #endif //__BORLANDC__
00128 
00129 
00130 
00131 
00132 
00133 //-----------------------------------------------------------------------------
00134 // Version
00135 #include <string.h>
00136 
00137 namespace bbtk
00138 {
00139 #define BBTK_STRINGIFY(A) #A
00140 #define BBTK_STRINGIFY_SYMBOL(A) BBTK_STRINGIFY(A)
00141 
00142   extern "C" 
00143   {
00144     BBTK_EXPORT inline const std::string& BBTK_CDECL GetVersion() 
00145     {
00146       static const std::string v(BBTK_STRINGIFY_SYMBOL(BBTK_VERSION));
00147       return v;
00148     }
00149   }
00150 
00151 }
00152 //-----------------------------------------------------------------------------
00153 
00154 
00155 
00156 
00157 //-----------------------------------------------------------------------------
00158 /*
00159 #ifdef _WIN32
00160 typedef  signed char         int8_t;
00161 typedef  signed short        int16_t;
00162 typedef  signed int          int32_t;
00163 typedef  unsigned char       uint8_t;
00164 typedef  unsigned short      uint16_t;
00165 typedef  unsigned int        uint32_t;
00166 #else 
00167 #include <stdint.h>
00168 #include <inttypes.h> 
00169 #endif
00170 */
00171 
00172 #ifdef CMAKE_HAVE_STDINT_H
00173    #include <stdint.h>
00174 #else
00175 #ifdef CMAKE_HAVE_INTTYPES_H
00176    // Old system only have this
00177    #include <inttypes.h>   // For uint8_t uint16_t and uint32_t
00178 #else
00179    //#include "XXX.h"
00180 // Broken plateforms do not respect C99 and do not provide those typedef
00181 // Special case for recent Borland compiler, comes with stdint.h
00182 #if defined(_MSC_VER) || defined(__BORLANDC__) && (__BORLANDC__ < 0x0560)  \
00183                       || defined(__MINGW32__)
00184 typedef  signed char         int8_t;
00185 typedef  signed short        int16_t;
00186 typedef  signed int          int32_t;
00187 typedef  unsigned char       uint8_t;
00188 typedef  unsigned short      uint16_t;
00189 typedef  unsigned int        uint32_t;
00190 
00192 
00193 #else
00194 #error "Sorry your plateform is not supported"
00195 #endif // defined(_MSC_VER) || defined(__BORLANDC__) && (__BORLANDC__ < 0x0560)  || defined(__MINGW32__)
00196 #endif // CMAKE_HAVE_INTTYPES_H
00197 #endif // CMAKE_HAVE_STDINT_H
00198 
00199 // Basically for VS6 and bcc 5.5.1:
00200 #ifndef UINT32_MAX
00201 #define UINT32_MAX    (4294967295U)
00202 #endif
00203 
00204 
00205 
00206 //-----------------------------------------------------------------------------
00207 
00208 
00209 //-----------------------------------------------------------------------------
00210 namespace bbtk
00211 {
00212  
00214   struct System
00215   {
00217     static int HasTTY(); 
00218   };
00219 
00220 } // namespace bbtk
00221 //-----------------------------------------------------------------------------
00222 
00223     // file separator
00224 #if defined(_WIN32)
00225 #define VALID_FILE_SEPARATOR "\\"
00226 #define INVALID_FILE_SEPARATOR "/"
00227 #define VALID_FILE_SEPARATOR_CHAR '\\'
00228 #define INVALID_FILE_SEPARATOR_CHAR '/'
00229 #else
00230 #define INVALID_FILE_SEPARATOR "\\"
00231 #define VALID_FILE_SEPARATOR "/"
00232 #define INVALID_FILE_SEPARATOR_CHAR '\\'
00233 #define VALID_FILE_SEPARATOR_CHAR '/'
00234 #endif
00235 
00236 #endif
00237 
00238 
00239 //----------------------------
00240 #ifndef _WIN32
00241 #include <unistd.h> //for access, unlink
00242 #else
00243 #include <io.h> //for _access on Win32
00244 #endif
00245 
00246 #ifdef _MSC_VER
00247 # define access _access
00248 #endif
00249 
00250 
00251 
00252 
00253 //===========================================================
00254 // Define the groups (modules) for doxygen documentation

Generated on Thu May 31 14:12:03 2012 for BBTK by  doxygen 1.5.7.1