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 /*=========================================================================
31 Module: $RCSfile: creaSystem.h,v $
33 Date: $Date: 2012/11/15 10:43:26 $
34 Version: $Revision: 1.16 $
35 =========================================================================*/
39 *\brief contains all the OS depending stuff
41 #ifndef __creaSystem_h__
42 #define __creaSystem_h__
44 #include "creaConfigure.h"
46 // We try for Visual 6..????
47 //#pragma warning( disable : 4786)
49 //-----------------------------------------------------------------------------
50 //This is needed when compiling in debug mode
52 // 'identifier' : class 'type' needs to have dll-interface to be used by
53 // clients of class 'type2'
54 #pragma warning ( disable : 4251 )
55 // non dll-interface class 'type' used as base for dll-interface class 'type2'
56 #pragma warning ( disable : 4275 )
57 // 'identifier' : identifier was truncated to 'number' characters in the
59 #pragma warning ( disable : 4786 )
60 //'identifier' : decorated name length exceeded, name was truncated
61 #pragma warning ( disable : 4503 )
62 // C++ exception specification ignored except to indicate a
63 // function is not __declspec(nothrow)
64 #pragma warning ( disable : 4290 )
65 // signed/unsigned mismatch
66 #pragma warning ( disable : 4018 )
67 // return type for 'identifier' is '' (ie; not a UDT or reference to UDT. Will
68 // produce errors if applied using infix notation
69 #pragma warning ( disable : 4284 )
70 // 'type' : forcing value to bool 'true' or 'false' (performance warning)
71 // //#pragma warning ( disable : 4800 )
75 #include <stdio.h> // for printf, ...
76 #include <iostream> // for cout, endl, ...
79 // Micro$oft related stuff
84 //#include <curses.h> // for getch
87 //-----------------------------------------------------------------------------
88 // Micro$oft shared library related stuff
90 // all the classes that must be visible outside the crea library
91 // should be defined as :
92 // class CREA_EXPORT ClassName
100 //&& defined(BUILD_SHARED_LIBS)
102 #define CREA_EXPORT2 export
108 #endif // defined(_WIN32) && defined(BUILD_SHARED_LIBS)
113 #if defined(_WIN32) && defined(CREA_BUILD_SHARED)
114 #ifdef CREA_EXPORT_SYMBOLS
115 #define CREA_EXPORT __declspec( dllexport )
117 #define CREA_EXPORT __declspec( dllimport )
119 #define CREA_CDECL __cdecl
123 #endif // defined(_WIN32) && defined(CREA_BUILD_SHARED)
128 #endif //__BORLANDC__
132 // ----------------------------------------------------------------------------
134 // ----------------------------------------------------------------------------
135 //#include "creaWx.h"
138 #ifdef _USE_WXWIDGETS_
139 #include "wx/wxprec.h"
140 #include <wx/datetime.h>
151 #endif //_USE_WXWIDGETS_
153 //-----------------------------------------------------------------------------
155 //-----------------------------------------------------------------------------
161 #define CREA_STRINGIFY(A) #A
162 #define CREA_STRINGIFY_SYMBOL(A) CREA_STRINGIFY(A)
166 CREA_EXPORT inline const std::string& CREA_CDECL GetVersion()
168 static const std::string v(CREA_STRINGIFY_SYMBOL(CREA_VERSION));
174 //-----------------------------------------------------------------------------
176 //-----------------------------------------------------------------------------
179 typedef signed char int8_t;
180 typedef signed short int16_t;
181 typedef signed int int32_t;
182 typedef unsigned char uint8_t;
183 typedef unsigned short uint16_t;
184 typedef unsigned int uint32_t;
187 #include <inttypes.h>
191 #ifdef CMAKE_HAVE_STDINT_H
194 #ifdef CMAKE_HAVE_INTTYPES_H
195 // Old system only have this
196 #include <inttypes.h> // For uint8_t uint16_t and uint32_t
199 // Broken plateforms do not respect C99 and do not provide those typedef
200 // Special case for recent Borland compiler, comes with stdint.h
201 #if defined(_MSC_VER) || defined(__BORLANDC__) && (__BORLANDC__ < 0x0560) \
202 || defined(__MINGW32__)
203 typedef signed char int8_t;
204 typedef signed short int16_t;
205 typedef signed int int32_t;
206 typedef unsigned char uint8_t;
207 typedef unsigned short uint16_t;
208 typedef unsigned int uint32_t;
210 /// \todo Find a clever way to deal with int64_t, uint64_t
213 #error "Sorry your plateform is not supported"
214 #endif // defined(_MSC_VER) || defined(__BORLANDC__) && (__BORLANDC__ < 0x0560) || defined(__MINGW32__)
215 #endif // CMAKE_HAVE_INTTYPES_H
216 #endif // CMAKE_HAVE_STDINT_H
218 // Basically for VS6 and bcc 5.5.1:
220 #define UINT32_MAX (4294967295U)
223 //-----------------------------------------------------------------------------
226 //-----------------------------------------------------------------------------
230 /// System related stuff
233 /// returns true iff the program has a tty
235 CREA_EXPORT static int GetAppPath(char *pname, size_t pathsize);
236 CREA_EXPORT static std::string GetDllAppPath(std::string &nomdll);
237 CREA_EXPORT static std::string GetDllAppPath(const char *nomdll);
238 CREA_EXPORT static std::string GetExecutablePath();
239 CREA_EXPORT static void createDirectory(const char* directorypath);
243 //-----------------------------------------------------------------------------
247 #define VALID_FILE_SEPARATOR "\\"
248 #define INVALID_FILE_SEPARATOR "/"
250 #define INVALID_FILE_SEPARATOR "\\"
251 #define VALID_FILE_SEPARATOR "/"