frepple::utils::Environment Class Reference

This class groups some functions used to interact with the operating system environment. More...

#include <utils.h>

Public Types

typedef map< string, XMLElementParameterList
 

Static Public Member Functions

static const string & getLogFile ()
 
static int getProcessorCores ()
 
static void loadModule (string lib, ParameterList &parameters)
 Function to dynamically load a shared library in frePPLe. More...
 
static void printModules ()
 
static string searchFile (const string)
 
static void setLogFile (const string &x)
 

Detailed Description

This class groups some functions used to interact with the operating system environment.

It handles:

  • The location of the configuration files.
  • The maximum number of processors / threads to be used by frePPLe.
  • An output stream for logging all output.
  • Dynamic loading of a shared library.

Definition at line 2657 of file utils.h.

Member Typedef Documentation

Type for storing parameters passed to a module that is loaded.

Definition at line 2700 of file utils.h.

Member Function Documentation

static const string& frepple::utils::Environment::getLogFile ( )
inlinestatic

Returns the name of the logfile.

Definition at line 2689 of file utils.h.

int frepple::utils::Environment::getProcessorCores ( )
static

Returns the number of processor cores on your machine.

Definition at line 175 of file utils/library.cpp.

void frepple::utils::Environment::loadModule ( string  lib,
ParameterList parameters 
)
static

Function to dynamically load a shared library in frePPLe.

After loading the library, the function "initialize" of the module is executed.

The current implementation supports the following platforms:

  • Windows
  • Linux
  • Unix systems supporting the dlopen function in the standard way. Some unix systems have other or deviating APIs. A pretty messy story :-<

Definition at line 239 of file utils/library.cpp.

void frepple::utils::Environment::printModules ( )
static

Print all modules that have been loaded.

Definition at line 459 of file utils/actions.cpp.

string frepple::utils::Environment::searchFile ( const string  filename)
static

Search for a file with a given name.
The following directories are searched in sequence to find a match:

  • The current directory.
  • The directory referred to by the variable FREPPLE_HOME, if it is defined.
  • The data directory as configured during the compilation. This applies only to linux / unix.
  • The library directory as configured during the compilation. This applies only to linux / unix.

Definition at line 107 of file utils/library.cpp.

void frepple::utils::Environment::setLogFile ( const string &  x)
static

Updates the filename for logging error messages and warnings. The file is also opened for writing and the standard output and standard error output streams are redirected to it.
If the filename starts with '+' the log file is appended to instead of being overwritten.

Definition at line 197 of file utils/library.cpp.


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