Geogram  Version 1.9.1
A programming library of geometric algorithms
GEO::SystemEnvironment Class Reference

System environment. More...

#include <geogram/basic/environment.h>

Inheritance diagram for GEO::SystemEnvironment:
GEO::Environment GEO::Counted

Protected Member Functions

 ~SystemEnvironment () override
 
bool set_local_value (const std::string &name, const std::string &value) override
 Sets a variable value locally. More...
 
bool get_local_value (const std::string &name, std::string &value) const override
 Retrieves a variable value locally. More...
 
- Protected Member Functions inherited from GEO::Environment
 ~Environment () override
 Environment destructor. More...
 
bool notify_observers (const std::string &name, const std::string &value, bool recursive)
 Notifies observers. More...
 
bool notify_local_observers (const std::string &name, const std::string &value)
 Notifies local observers. More...
 
- Protected Member Functions inherited from GEO::Counted
 Counted ()
 Creates a reference counted object. More...
 
virtual ~Counted ()
 Destroys a reference counted object. More...
 

Additional Inherited Members

- Public Member Functions inherited from GEO::Environment
virtual bool add_environment (Environment *env)
 Adds a child environment. More...
 
bool has_value (const std::string &name) const
 Tests if a variable exists. More...
 
virtual bool get_value (const std::string &name, std::string &value) const
 Retrieves the value of a variable. More...
 
std::string get_value (const std::string &name) const
 Retrieves the value of a variable. More...
 
virtual bool set_value (const std::string &name, const std::string &value)
 Sets a variable value. More...
 
virtual Environmentfind_environment (const std::string &name)
 Finds the environment that declares a variable as a local name. More...
 
virtual bool add_observer (const std::string &name, VariableObserver *observer)
 Attaches an observer to a variable. More...
 
virtual bool remove_observer (const std::string &name, VariableObserver *observer)
 Detaches an observer from a variable. More...
 
virtual bool notify_observers (const std::string &name, bool recursive=false)
 Notifies observers. More...
 
- Public Member Functions inherited from GEO::Counted
void ref () const
 Increments the reference count. More...
 
void unref () const
 Decrements the reference count. More...
 
bool is_shared () const
 Check if the object is shared. More...
 
int nb_refs () const
 Gets the number of references that point to this object. More...
 
- Static Public Member Functions inherited from GEO::Environment
static Environmentinstance ()
 Gets the root environment. More...
 
static void terminate ()
 Cleans up the environment. More...
 
- Static Public Member Functions inherited from GEO::Counted
static void ref (const Counted *counted)
 Increments the reference count. More...
 
static void unref (const Counted *counted)
 Decrements the reference count. More...
 

Detailed Description

System environment.

This class is a specialization of Environment that retrieves the variable values from the system environment, but does not allow to set them.

Definition at line 442 of file environment.h.

Constructor & Destructor Documentation

◆ ~SystemEnvironment()

GEO::SystemEnvironment::~SystemEnvironment ( )
overrideprotected

SystemEnvironment destructor

Member Function Documentation

◆ get_local_value()

bool GEO::SystemEnvironment::get_local_value ( const std::string &  name,
std::string &  value 
) const
overrideprotectedvirtual

Retrieves a variable value locally.

This function is used internally. It searches variable name locally and stores its value in the output string value.

Parameters
[in]namethe name of the variable
[out]valueis set the variable value if it was found locally.
Return values
trueif the variable was found
falseif not
Note
This function must be reimplemented in derived custom environments. The value is retrieved from the system environment using the system function getenv().

Implements GEO::Environment.

◆ set_local_value()

bool GEO::SystemEnvironment::set_local_value ( const std::string &  name,
const std::string &  value 
)
overrideprotectedvirtual

Sets a variable value locally.

This function is used internally. It sets the variable named name to the given value locally.

Parameters
[in]namethe name of the variable
[in]valuethe value of the variable
Return values
trueif the variable was successfully added locally
falseotherwise
Note
This function must be reimplemented in derived custom environments. This function does actually not update the system environment and always returns false.

Implements GEO::Environment.


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