2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
8 # This software is governed by the CeCILL-B license under French law and
9 # abiding by the rules of distribution of free software. You can use,
10 # modify and/ or redistribute the software under the terms of the CeCILL-B
11 # license as circulated by CEA, CNRS and INRIA at the following URL
12 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
13 # or in the file LICENSE.txt.
15 # As a counterpart to the access to the source code and rights to copy,
16 # modify and redistribute granted by the license, users are provided only
17 # with a limited warranty and the software's author, the holder of the
18 # economic rights, and the successive licensors have only limited
21 # The fact that you are presently reading this means that you have had
22 # knowledge of the CeCILL-B license and that you accept its terms.
23 # ------------------------------------------------------------------------ */
25 /*=========================================================================
28 Module: $RCSfile: creaSystem.h,v $
30 Date: $Date: 2012/11/15 09:07:32 $
31 Version: $Revision: 1.15 $
32 =========================================================================*/
36 *\brief contains all the OS depending stuff
38 #ifndef __creaSystem_h__
39 #define __creaSystem_h__
41 #include "creaConfigure.h"
43 // We try for Visual 6..????
44 //#pragma warning( disable : 4786)
46 //-----------------------------------------------------------------------------
47 //This is needed when compiling in debug mode
49 // 'identifier' : class 'type' needs to have dll-interface to be used by
50 // clients of class 'type2'
51 #pragma warning ( disable : 4251 )
52 // non dll-interface class 'type' used as base for dll-interface class 'type2'
53 #pragma warning ( disable : 4275 )
54 // 'identifier' : identifier was truncated to 'number' characters in the
56 #pragma warning ( disable : 4786 )
57 //'identifier' : decorated name length exceeded, name was truncated
58 #pragma warning ( disable : 4503 )
59 // C++ exception specification ignored except to indicate a
60 // function is not __declspec(nothrow)
61 #pragma warning ( disable : 4290 )
62 // signed/unsigned mismatch
63 #pragma warning ( disable : 4018 )
64 // return type for 'identifier' is '' (ie; not a UDT or reference to UDT. Will
65 // produce errors if applied using infix notation
66 #pragma warning ( disable : 4284 )
67 // 'type' : forcing value to bool 'true' or 'false' (performance warning)
68 // //#pragma warning ( disable : 4800 )
72 #include <stdio.h> // for printf, ...
73 #include <iostream> // for cout, endl, ...
76 // Micro$oft related stuff
81 //#include <curses.h> // for getch
84 //-----------------------------------------------------------------------------
85 // Micro$oft shared library related stuff
87 // all the classes that must be visible outside the crea library
88 // should be defined as :
89 // class CREA_EXPORT ClassName
97 //&& defined(BUILD_SHARED_LIBS)
99 #define CREA_EXPORT2 export
105 #endif // defined(_WIN32) && defined(BUILD_SHARED_LIBS)
110 #if defined(_WIN32) && defined(CREA_BUILD_SHARED)
111 #ifdef CREA_EXPORT_SYMBOLS
112 #define CREA_EXPORT __declspec( dllexport )
114 #define CREA_EXPORT __declspec( dllimport )
116 #define CREA_CDECL __cdecl
120 #endif // defined(_WIN32) && defined(CREA_BUILD_SHARED)
125 #endif //__BORLANDC__
129 // ----------------------------------------------------------------------------
131 // ----------------------------------------------------------------------------
132 //#include "creaWx.h"
135 #ifdef _USE_WXWIDGETS_
136 #include "wx/wxprec.h"
137 #include <wx/datetime.h>
148 #endif //_USE_WXWIDGETS_
150 //-----------------------------------------------------------------------------
152 //-----------------------------------------------------------------------------
158 #define CREA_STRINGIFY(A) #A
159 #define CREA_STRINGIFY_SYMBOL(A) CREA_STRINGIFY(A)
163 CREA_EXPORT inline const std::string& CREA_CDECL GetVersion()
165 static const std::string v(CREA_STRINGIFY_SYMBOL(CREA_VERSION));
171 //-----------------------------------------------------------------------------
173 //-----------------------------------------------------------------------------
176 typedef signed char int8_t;
177 typedef signed short int16_t;
178 typedef signed int int32_t;
179 typedef unsigned char uint8_t;
180 typedef unsigned short uint16_t;
181 typedef unsigned int uint32_t;
184 #include <inttypes.h>
188 #ifdef CMAKE_HAVE_STDINT_H
191 #ifdef CMAKE_HAVE_INTTYPES_H
192 // Old system only have this
193 #include <inttypes.h> // For uint8_t uint16_t and uint32_t
196 // Broken plateforms do not respect C99 and do not provide those typedef
197 // Special case for recent Borland compiler, comes with stdint.h
198 #if defined(_MSC_VER) || defined(__BORLANDC__) && (__BORLANDC__ < 0x0560) \
199 || defined(__MINGW32__)
200 typedef signed char int8_t;
201 typedef signed short int16_t;
202 typedef signed int int32_t;
203 typedef unsigned char uint8_t;
204 typedef unsigned short uint16_t;
205 typedef unsigned int uint32_t;
207 /// \todo Find a clever way to deal with int64_t, uint64_t
210 #error "Sorry your plateform is not supported"
211 #endif // defined(_MSC_VER) || defined(__BORLANDC__) && (__BORLANDC__ < 0x0560) || defined(__MINGW32__)
212 #endif // CMAKE_HAVE_INTTYPES_H
213 #endif // CMAKE_HAVE_STDINT_H
215 // Basically for VS6 and bcc 5.5.1:
217 #define UINT32_MAX (4294967295U)
220 //-----------------------------------------------------------------------------
223 //-----------------------------------------------------------------------------
227 /// System related stuff
230 /// returns true iff the program has a tty
232 CREA_EXPORT static int GetAppPath(char *pname, size_t pathsize);
233 CREA_EXPORT static std::string GetDllAppPath(std::string &nomdll);
234 CREA_EXPORT static std::string GetDllAppPath(const char *nomdll);
235 CREA_EXPORT static std::string GetExecutablePath();
236 CREA_EXPORT static void createDirectory(const char* directorypath);
240 //-----------------------------------------------------------------------------
244 #define VALID_FILE_SEPARATOR "\\"
245 #define INVALID_FILE_SEPARATOR "/"
247 #define INVALID_FILE_SEPARATOR "\\"
248 #define VALID_FILE_SEPARATOR "/"