Loading...
Searching...
No Matches
gams::GAMSPlatform Struct Reference

Encapsulates all platform specific calls of the API. More...

#include <gamsplatform.h>

Static Public Member Functions

static std::string findGams (LogId logId=0)
 
static void ensureEnvPathContains (const char *dirName)
 
static bool interrupt (long pid)
 
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)
 

Detailed Description

Encapsulates all platform specific calls of the API.

Definition at line 44 of file gamsplatform.h.

Member Function Documentation

◆ ensureEnvPathContains()

static void gams::GAMSPlatform::ensureEnvPathContains ( const char *  dirName)
static

Ensures that the directory name is contained in the environment path.

Parameters
dirNameA directory name.

◆ findGams()

static std::string gams::GAMSPlatform::findGams ( LogId  logId = 0)
static

find GAMS system directory from related environment.

  • on windows : first search "PATH" if not found then search windows registry "gams.location",
  • on Unix : first search "PATH" if not found then "LD_LIBRARAY_PATH".
  • on Mac : first use Unix search strategy if not found then "DYLD_LIBRARAY_PATH", After two attempts of search and GAMS directory is still not found, returns null String.
    Returns
    GAMS directory if found, null otherwise.

◆ interrupt()

static bool gams::GAMSPlatform::interrupt ( long  pid)
static

Interrupt GAMS during processing.

Parameters
pidA process ID.
Returns
Returns true if the interrupt was called successfully; otherwise false.
Remarks
On unix like platfoms this function calls gams to execute the interrupt and waits unitl gams has finished.

◆ runProcess()

static int gams::GAMSPlatform::runProcess ( const std::string  where,
const std::string  what,
const std::string  args,
std::string &  output 
)
static

Runs a process in a specified location.

Parameters
whereDirectory of execution.
whatName of process to run.
argsProcess arguments.
outputProcess output as string.
Returns
Exit code.

◆ runProcessParallel()

static std::thread gams::GAMSPlatform::runProcessParallel ( const std::string  executable,
const std::string  args 
)
static

Runs a process without waiting for it to end. Returns std::thread of started process.

Parameters
executableFilepath of process to run.
argsProcess arguments.
Returns
thread