CppADCodeGen  HEAD
A C++ Algorithmic Differentiation Package with Source Code Generation
CppAD::cg::system Namespace Reference

Classes

class  SystemInfo
 

Functions

std::string getWorkingDirectory ()
 
void createFolder (const std::string &folder)
 
std::string createPath (const std::string &baseFolder, const std::string &file)
 
std::string createPath (std::initializer_list< std::string > folders, const std::string &file)
 
std::string escapePath (const std::string &path)
 
std::string filenameFromPath (const std::string &path)
 
std::string directoryFromPath (const std::string &path)
 
bool isAbsolutePath (const std::string &path)
 
bool isDirectory (const std::string &path)
 
bool isFile (const std::string &path)
 
void callExecutable (const std::string &executable, const std::vector< std::string > &args, std::string *stdOutErrMessage=nullptr, const std::string *stdInMessage=nullptr)
 

Detailed Description

System dependent functions

Function Documentation

◆ callExecutable()

void CppAD::cg::system::callExecutable ( const std::string &  executable,
const std::vector< std::string > &  args,
std::string *  stdOutErrMessage = nullptr,
const std::string *  stdInMessage = nullptr 
)
inline

Calls an external executable (system dependent). In the case of an error during execution an exception will be thrown.

Parameters
executablethe executable path
argsthe command line arguments to the executable
stdOutErrMessagestandard output and standard error message from the executable
stdInMessageinformation to pass as standard input to the executable
Exceptions
CGExceptionon failure to call the executable

Referenced by CppAD::cg::GccCompiler< Base >::buildDynamic(), CppAD::cg::ClangCompiler< Base >::buildDynamic(), CppAD::cg::GccCompiler< Base >::compileFile(), CppAD::cg::ClangCompiler< Base >::compileFile(), CppAD::cg::GccCompiler< Base >::compileSource(), and CppAD::cg::ClangCompiler< Base >::compileSource().

◆ createFolder()

void CppAD::cg::system::createFolder ( const std::string &  folder)
inline

creates a new folder (system dependent)

Parameters
folderthe path to the folder
Exceptions
CGExceptionon failure to create the folder

Referenced by CppAD::cg::AbstractCCompiler< Base >::compileSources(), and CppAD::cg::ModelLibraryCSourceGen< Base >::saveSources().

◆ createPath() [1/2]

std::string CppAD::cg::system::createPath ( const std::string &  baseFolder,
const std::string &  file 
)
inline

Creates a new path (system dependent)

Parameters
baseFolderthe path to the base folder
filethe file or folder name inside the base folder
Returns
the new path

Referenced by CppAD::cg::AbstractCCompiler< Base >::compileSources(), and CppAD::cg::ModelLibraryCSourceGen< Base >::saveSources().

◆ createPath() [2/2]

std::string CppAD::cg::system::createPath ( std::initializer_list< std::string >  folders,
const std::string &  file 
)
inline

Creates a new path (system dependent)

Parameters
foldersthe names of the folders in the path to the file
filethe file or folder name
Returns
the new path

◆ escapePath()

std::string CppAD::cg::system::escapePath ( const std::string &  path)
inline

Escapes a file or folder path (system dependent)

Parameters
paththe file/folder path
Returns
the escaped file/folder path

◆ isAbsolutePath()

bool CppAD::cg::system::isAbsolutePath ( const std::string &  path)
inline

Determines if a path is absolute.

Parameters
paththe path
Returns
true if it is absolute, false if it is relative

◆ isDirectory()

bool CppAD::cg::system::isDirectory ( const std::string &  path)
inline

Checks if a path exists and is a directory

Parameters
paththe path
Returns
true if the path exists and it is a directory

◆ isFile()

bool CppAD::cg::system::isFile ( const std::string &  path)
inline

Checks if a path exists and is a file

Parameters
paththe path
Returns
true if the path exists and it is a file