Documentation for OpenFLUID 2.2.0
openfluid::utils::ExternalProgram Class Reference

Detailed Description

Management of external programs

#include <utils/ExternalProgram.hpp>

Public Types

enum class  RegisteredPrograms {
  CMake , Zip , SevenZip , Gnuplot ,
  GoogleEarth , Gcc , Pandoc , PdfLatex ,
  BibTex , Latex2HTML , Git , GrassGis ,
  R , Rscript
}
 

Public Member Functions

 ExternalProgram ()=delete
 
 ExternalProgram (const std::vector< std::string > &ProgramNames, const std::vector< std::string > &SearchPaths=std::vector< std::string >(), bool UsePathEnv=true)
 
 ExternalProgram (const std::string &ProgramName, const std::vector< std::string > &SearchPaths=std::vector< std::string >(), bool UsePathEnv=true)
 
 ~ExternalProgram ()
 
bool isFound () const
 
void searchForProgram ()
 
std::string getFullProgramPath () const
 

Static Public Member Functions

static ExternalProgram getRegisteredProgram (RegisteredPrograms Prog, const std::vector< std::string > &SearchPaths=std::vector< std::string >(), bool UsePathEnv=true)
 
static std::string findUsingPATHEnvVar (const std::vector< std::string > &ProgramNames)
 
static std::string findUsingPathsList (const std::vector< std::string > &ProgramNames, const std::vector< std::string > &PathsList)
 

Member Enumeration Documentation

◆ RegisteredPrograms

List of pre-registered external programs

Enumerator
CMake 
Zip 
SevenZip 
Gnuplot 
GoogleEarth 
Gcc 
Pandoc 
PdfLatex 
BibTex 
Latex2HTML 
Git 
GrassGis 
Rscript 

Constructor & Destructor Documentation

◆ ExternalProgram() [1/3]

openfluid::utils::ExternalProgram::ExternalProgram ( )
delete

◆ ExternalProgram() [2/3]

openfluid::utils::ExternalProgram::ExternalProgram ( const std::vector< std::string > &  ProgramNames,
const std::vector< std::string > &  SearchPaths = std::vector< std::string >(),
bool  UsePathEnv = true 
)

Constructor for a given external programs. Automatically searches for the program at construction

Parameters
[in]ProgramNamesThe possible names of the program to find
[in]SearchPathsThe list of paths to search. Default value is an empty list
[in]UsePathEnvEnable the use of PATH environment variable to search for the program. Default value is true.

◆ ExternalProgram() [3/3]

openfluid::utils::ExternalProgram::ExternalProgram ( const std::string &  ProgramName,
const std::vector< std::string > &  SearchPaths = std::vector< std::string >(),
bool  UsePathEnv = true 
)

Constructor for a given external programs. Automatically searches for the program at construction

Parameters
[in]ProgramNameThe name of the program to find
[in]SearchPathsThe list of paths to search. Default value is an empty list
[in]UsePathEnvEnable the use of PATH environment variable to search for the program. Default value is true.

◆ ~ExternalProgram()

openfluid::utils::ExternalProgram::~ExternalProgram ( )

Member Function Documentation

◆ findUsingPATHEnvVar()

static std::string openfluid::utils::ExternalProgram::findUsingPATHEnvVar ( const std::vector< std::string > &  ProgramNames)
static

Finds a program using the PATH environment variable

Parameters
[in]ProgramNamesThe list of the potential program names of the program to find
Returns
The full path of the first found program

◆ findUsingPathsList()

static std::string openfluid::utils::ExternalProgram::findUsingPathsList ( const std::vector< std::string > &  ProgramNames,
const std::vector< std::string > &  PathsList 
)
static

Finds a program using a given paths list

Parameters
[in]ProgramNamesThe list of the potential program names of the program to find
[in]PathsListThe list of paths to search
Returns
The full path of the first found program

◆ getFullProgramPath()

std::string openfluid::utils::ExternalProgram::getFullProgramPath ( ) const
inline

Returns the full path of the program

Returns
the full path of the program if it has been found, otherwise an empty string

◆ getRegisteredProgram()

static ExternalProgram openfluid::utils::ExternalProgram::getRegisteredProgram ( RegisteredPrograms  Prog,
const std::vector< std::string > &  SearchPaths = std::vector< std::string >(),
bool  UsePathEnv = true 
)
static

Returns an ExternalProgram object initialized with the registered program to find

Parameters
[in]ProgThe registered program to find
[in]SearchPathsThe list of paths to search. Default value is an empty list
[in]UsePathEnvEnable the use of PATH environment variable to search for the registered program. Default value is true.
Returns
An ExternalProgram object initialized with the registered program to find

◆ isFound()

bool openfluid::utils::ExternalProgram::isFound ( ) const
inline

Returns true if the current program has been found

Returns
true if the current program has been found

◆ searchForProgram()

void openfluid::utils::ExternalProgram::searchForProgram ( )

Searches for the program


The documentation for this class was generated from the following file: