openModeller  Version 1.5.0
os_specific.hh
Go to the documentation of this file.
1 
28 #ifndef _OS_SPECIFICHH_
29 #define _OS_SPECIFICHH_
30 
31 #if (defined(__unix__) || defined(unix) || defined(__APPLE__)) && !defined(USG)
32 #include <sys/param.h>
33 #define dllexp
34 #define OM_ALG_DLL_EXPORT
35 #define OM_XML_DLL_EXPORT
36 #endif
37 
46 #include <vector>
47 #include <string>
48 
49 /****************************************************************/
50 /****** DEFINE MACRO TO NEATLY HANDLE UNUSED VARS ***************/
51 #ifdef _MSC_VER
52  // fake use to make unused variable warnings go away in Visual C++
53  #define UNUSED(symbol) symbol
54 #else
55  #define UNUSED(symbol)
56 #endif
57 
58 /****************************************************************/
59 /****** Replace finite with _finite when using MSVC *************/
60 #ifdef _MSC_VER
61  #define finite _finite // function used by maxent
62 #endif
63 
64 /****************************************************************/
65 /****** Sleep function (millisenconds) **************************/
66 #ifdef WIN32
67 #include <windows.h>
68 #else
69 #include <unistd.h>
70 #define Sleep(x) usleep((x)*1000)
71 #endif
72 
73 
74 /****************************************************************/
75 /********************* Dynamic Linking Loader *******************/
76 
77 #ifdef WIN32
78 #include <windows.h>
79 typedef HMODULE DLLHandle;
80 #else
81 typedef void *DLLHandle;
82 #endif
83 
84 extern DLLHandle dllOpen ( char const *dll_file_name );
85 extern void *dllFunction( DLLHandle, char const *function_name );
86 extern int dllClose ( DLLHandle );
87 extern const char *dllError ( DLLHandle );
88 
93 dllexp void setupExternalResources();
94 
100 dllexp std::string omDataPath( std::string dir="" );
101 
106 std::vector<std::string> initialPluginPath();
107 
115 std::vector<std::string> scanDirectory( std::string dir );
116 
124 dllexp int initRandom( unsigned int new_seed=0 );
125 
126 #ifdef WIN32
127 // rand_r implementation for Windows
128 dllexp int rand_r( unsigned * seed );
129 #endif
130 
135 std::string getWorkingPath();
136 
142 bool pathExists( const std::string path );
143 
149 bool createPath( const std::string path );
150 
151 #endif
dllexp int rand_r(unsigned *seed)
DLLHandle dllOpen(char const *dll_file_name)
Definition: os_specific.cpp:61
void * dllFunction(DLLHandle, char const *function_name)
Definition: os_specific.cpp:70
bool createPath(const std::string path)
bool pathExists(const std::string path)
dllexp void setupExternalResources()
Definition: os_specific.cpp:95
std::vector< std::string > scanDirectory(std::string dir)
dllexp std::string omDataPath(std::string dir="")
std::vector< std::string > initialPluginPath()
int dllClose(DLLHandle)
Definition: os_specific.cpp:79
void * DLLHandle
Definition: os_specific.hh:81
std::string getWorkingPath()
const char * dllError(DLLHandle)
Definition: os_specific.cpp:88
dllexp int initRandom(unsigned int new_seed=0)