Loading...
Searching...
No Matches
gamsplatform.h
1
26#ifndef GAMSPLATFORM_H
27#define GAMSPLATFORM_H
28
29#include "gamslib_global.h"
30#include <thread>
31
32namespace gams {
33
34extern LIBSPEC const char cEnvSep;
35extern LIBSPEC const char *cLibEnv;
36extern LIBSPEC const char *cPathSep;
37extern LIBSPEC const char *cCmpFileName;
38extern LIBSPEC const int cExitCodeDiv;
39extern LIBSPEC const char *cExeSuffix;
40extern LIBSPEC const char *cLibPrefix;
41extern LIBSPEC const char *cLibSuffix;
42
44struct LIBSPEC GAMSPlatform
45{
52 static std::string findGams(LogId logId = 0);
53
56 static void ensureEnvPathContains(const char *dirName);
57
64 static bool interrupt(long pid);
65
74 static int runProcess(const std::string where, const std::string what, const std::string args, std::string& output);
75
82 static std::thread runProcessParallel(const std::string executable, const std::string args);
83private:
84 GAMSPlatform() {}
85
86 static std::string findGamsOnApple(LogId logId);
87 static void ensureEnvPathSetOnApple(const char *dirName);
88
89 static std::string findGamsOnUnix(LogId logId);
90 static void ensureEnvPathSetOnUnix(const char *dirName);
91 static bool interruptOnNonWindows(long pid);
92
93 static std::string findGamsOnWindows(LogId logId);
94 static void ensureEnvPathSetOnWindows(const char *dirName);
95 static bool interruptOnWindows(long pid);
96};
97
98} // namespace gams
99
100#endif // GAMSPLATFORM_H
Definition: gams.h:91
Encapsulates all platform specific calls of the API.
Definition: gamsplatform.h:45
static bool interrupt(long pid)
static void ensureEnvPathContains(const char *dirName)
static std::string findGams(LogId logId=0)
static int runProcess(const std::string where, const std::string what, const std::string args, std::string &output)
static std::thread runProcessParallel(const std::string executable, const std::string args)