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,
75 const std::string &what,
76 const std::string &args,
77 std::string &output);
78
85 static std::thread runProcessParallel(const std::string &executable, const std::string &args);
86
87private:
88 GAMSPlatform() {}
89
90 static std::string findGamsOnApple(LogId logId);
91 static void ensureEnvPathSetOnApple(const char *dirName);
92
93 static std::string findGamsOnUnix(LogId logId);
94 static void ensureEnvPathSetOnUnix(const char *dirName);
95 static bool interruptOnNonWindows(long pid);
96
97 static std::string findGamsOnWindows(LogId logId);
98 static void ensureEnvPathSetOnWindows(const char *dirName);
99 static bool interruptOnWindows(long pid);
100};
101
102} // namespace gams
103
104#endif // GAMSPLATFORM_H
Definition gams.h:91
Encapsulates all platform specific calls of the API.
static int runProcess(const std::string &where, const std::string &what, const std::string &args, std::string &output)
static bool interrupt(long pid)
static void ensureEnvPathContains(const char *dirName)
static std::string findGams(LogId logId=0)
static std::thread runProcessParallel(const std::string &executable, const std::string &args)