2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------ */
28 /*=========================================================================
30 Module: $RCSfile: bbtkSystem.h,v $
32 Date: $Date: 2012/11/16 08:49:01 $
33 Version: $Revision: 1.15 $
34 =========================================================================*/
41 *\brief contains all the OS depending stuff
43 #ifndef __bbtkSystem_h__
44 #define __bbtkSystem_h__
46 #include "bbtkConfigure.h"
48 // We try for Visual 6..????
49 //#pragma warning( disable : 4786)
53 //-----------------------------------------------------------------------------
54 //This is needed when compiling in debug mode
56 // 'identifier' : class 'type' needs to have dll-interface to be used by
57 // clients of class 'type2'
58 #pragma warning ( disable : 4251 )
59 // non dll-interface class 'type' used as base for dll-interface class 'type2'
60 #pragma warning ( disable : 4275 )
61 // 'identifier' : identifier was truncated to 'number' characters in the
63 #pragma warning ( disable : 4786 )
64 //'identifier' : decorated name length exceeded, name was truncated
65 #pragma warning ( disable : 4503 )
66 // C++ exception specification ignored except to indicate a
67 // function is not __declspec(nothrow)
68 #pragma warning ( disable : 4290 )
69 // signed/unsigned mismatch
70 #pragma warning ( disable : 4018 )
71 // return type for 'identifier' is '' (ie; not a UDT or reference to UDT. Will
72 // produce errors if applied using infix notation
73 #pragma warning ( disable : 4284 )
74 // 'type' : forcing value to bool 'true' or 'false' (performance warning)
75 // Has revealed a real error !
76 // bbSignalOutputModification(bool) called rather than
77 // bbSignalOutputModification(const std::string&, bool = true)
78 // when invoking bbSignalOutputModification("Out")
80 // //#pragma warning ( disable : 4800 )
82 // 'PACKAGE_NAMEGetPackage' has C-linkage specified, but returns UDT 'boost::shared_ptr<T>' which is incompatible with C
83 #pragma warning ( disable : 4190 )
89 #include <stdio.h> // for printf, ...
90 #include <iostream> // for cout, endl, ...
93 // Micro$oft related stuff
98 //#include <curses.h> // for getch
101 //-----------------------------------------------------------------------------
102 // Micro$oft shared library related stuff
104 // all the classes that must be visible outside the bbtk library
105 // should be defined as :
106 // class BBTK_EXPORT ClassName
112 // IF NOT DEF THEN INTERNAL COMPILER ERROR WITH BOOST 1.37 ON VISUAL C++
113 #define BOOST_SP_NO_SP_CONVERTIBLE
117 //&& defined(BUILD_SHARED_LIBS)
119 #ifdef BBTK_EXPORT_SYMBOLS
120 #define BBTK_EXPORT __declspec( dllexport )
122 #define BBTK_EXPORT __declspec( dllimport )
124 #define BBTK_CDECL __cdecl
128 #endif // defined(_WIN32) && defined(BUILD_SHARED_LIBS)
134 #endif //__BORLANDC__
140 //-----------------------------------------------------------------------------
146 #define BBTK_STRINGIFY(A) #A
147 #define BBTK_STRINGIFY_SYMBOL(A) BBTK_STRINGIFY(A)
151 BBTK_EXPORT inline const std::string& BBTK_CDECL GetVersion()
153 static const std::string v(BBTK_STRINGIFY_SYMBOL(BBTK_VERSION));
159 //-----------------------------------------------------------------------------
164 //-----------------------------------------------------------------------------
167 typedef signed char int8_t;
168 typedef signed short int16_t;
169 typedef signed int int32_t;
170 typedef unsigned char uint8_t;
171 typedef unsigned short uint16_t;
172 typedef unsigned int uint32_t;
175 #include <inttypes.h>
179 #ifdef CMAKE_HAVE_STDINT_H
182 #ifdef CMAKE_HAVE_INTTYPES_H
183 // Old system only have this
184 #include <inttypes.h> // For uint8_t uint16_t and uint32_t
187 // Broken plateforms do not respect C99 and do not provide those typedef
188 // Special case for recent Borland compiler, comes with stdint.h
189 #if defined(_MSC_VER) || defined(__BORLANDC__) && (__BORLANDC__ < 0x0560) \
190 || defined(__MINGW32__)
191 typedef signed char int8_t;
192 typedef signed short int16_t;
193 typedef signed int int32_t;
194 typedef unsigned char uint8_t;
195 typedef unsigned short uint16_t;
196 typedef unsigned int uint32_t;
198 /// \todo Find a clever way to deal with int64_t, uint64_t
201 #error "Sorry your plateform is not supported"
202 #endif // defined(_MSC_VER) || defined(__BORLANDC__) && (__BORLANDC__ < 0x0560) || defined(__MINGW32__)
203 #endif // CMAKE_HAVE_INTTYPES_H
204 #endif // CMAKE_HAVE_STDINT_H
206 // Basically for VS6 and bcc 5.5.1:
208 #define UINT32_MAX (4294967295U)
213 //-----------------------------------------------------------------------------
216 //-----------------------------------------------------------------------------
220 /// System related stuff
223 /// returns true iff the program has a tty
228 //-----------------------------------------------------------------------------
232 #define VALID_FILE_SEPARATOR "\\"
233 #define INVALID_FILE_SEPARATOR "/"
234 #define VALID_FILE_SEPARATOR_CHAR '\\'
235 #define INVALID_FILE_SEPARATOR_CHAR '/'
237 #define INVALID_FILE_SEPARATOR "\\"
238 #define VALID_FILE_SEPARATOR "/"
239 #define INVALID_FILE_SEPARATOR_CHAR '\\'
240 #define VALID_FILE_SEPARATOR_CHAR '/'
246 //----------------------------
248 #include <unistd.h> //for access, unlink
250 #include <io.h> //for _access on Win32
254 # define access _access
260 //===========================================================
261 // Define the groups (modules) for doxygen documentation
263 * \defgroup box Black boxes related classes
264 * \defgroup interface Graphical User Interface components
265 * \defgroup data Data