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
113 // IF NOT DEF THEN INTERNAL COMPILER ERROR WITH BOOST 1.37 ON VISUAL C++
114 #define BOOST_SP_NO_SP_CONVERTIBLE
119 //&& defined(BUILD_SHARED_LIBS)
121 #ifdef BBTK_EXPORT_SYMBOLS
122 #define BBTK_EXPORT __declspec( dllexport )
124 #define BBTK_EXPORT __declspec( dllimport )
126 #define BBTK_CDECL __cdecl
130 #endif // defined(_WIN32) && defined(BUILD_SHARED_LIBS)
136 #endif //__BORLANDC__
142 //-----------------------------------------------------------------------------
148 #define BBTK_STRINGIFY(A) #A
149 #define BBTK_STRINGIFY_SYMBOL(A) BBTK_STRINGIFY(A)
154 BBTK_EXPORT inline const std::string& BBTK_CDECL GetVersion()
156 static const std::string v(BBTK_STRINGIFY_SYMBOL(BBTK_VERSION));
163 //-----------------------------------------------------------------------------
168 //-----------------------------------------------------------------------------
171 typedef signed char int8_t;
172 typedef signed short int16_t;
173 typedef signed int int32_t;
174 typedef unsigned char uint8_t;
175 typedef unsigned short uint16_t;
176 typedef unsigned int uint32_t;
179 #include <inttypes.h>
183 #ifdef CMAKE_HAVE_STDINT_H
186 #ifdef CMAKE_HAVE_INTTYPES_H
187 // Old system only have this
188 #include <inttypes.h> // For uint8_t uint16_t and uint32_t
191 // Broken plateforms do not respect C99 and do not provide those typedef
192 // Special case for recent Borland compiler, comes with stdint.h
193 #if defined(_MSC_VER) || defined(__BORLANDC__) && (__BORLANDC__ < 0x0560) \
194 || defined(__MINGW32__)
195 typedef signed char int8_t;
196 typedef signed short int16_t;
197 typedef signed int int32_t;
198 typedef unsigned char uint8_t;
199 typedef unsigned short uint16_t;
200 typedef unsigned int uint32_t;
201 /// \todo Find a clever way to deal with int64_t, uint64_t
203 #error "Sorry your plateform is not supported"
204 #endif // defined(_MSC_VER) || defined(__BORLANDC__) && (__BORLANDC__ < 0x0560) || defined(__MINGW32__)
205 #endif // CMAKE_HAVE_INTTYPES_H
206 #endif // CMAKE_HAVE_STDINT_H
208 // Basically for VS6 and bcc 5.5.1:
210 #define UINT32_MAX (4294967295U)
215 //-----------------------------------------------------------------------------
218 //-----------------------------------------------------------------------------
222 /// System related stuff
225 /// returns true iff the program has a tty
230 //-----------------------------------------------------------------------------
234 #define VALID_FILE_SEPARATOR "\\"
235 #define INVALID_FILE_SEPARATOR "/"
236 #define VALID_FILE_SEPARATOR_CHAR '\\'
237 #define INVALID_FILE_SEPARATOR_CHAR '/'
239 #define INVALID_FILE_SEPARATOR "\\"
240 #define VALID_FILE_SEPARATOR "/"
241 #define INVALID_FILE_SEPARATOR_CHAR '\\'
242 #define VALID_FILE_SEPARATOR_CHAR '/'
246 #endif //__bbtkSystem_h__
249 //----------------------------
251 #include <unistd.h> //for access, unlink
253 #include <io.h> //for _access on Win32
257 # define access _access
263 //===========================================================
264 // Define the groups (modules) for doxygen documentation
266 * \defgroup box Black boxes related classes
267 * \defgroup interface Graphical User Interface components
268 * \defgroup data Data