Manages dynamically loadable modules.
More...
#include <OGF/basic/modules/modmgr.h>
|
|
| ModuleManager () |
| | Forbids construction by client code.
|
| |
|
| ~ModuleManager () override |
| | Forbids destruction by client code.
|
| |
|
void | do_terminate_modules () |
| | Terminates all the modules registered in the system.
|
| |
| | ~Environment () override |
| | Environment destructor.
|
| |
| bool | notify_observers (const std::string &name, const std::string &value, bool recursive) |
| | Notifies observers.
|
| |
| bool | notify_local_observers (const std::string &name, const std::string &value) |
| | Notifies local observers.
|
| |
| | Counted () |
| | Creates a reference counted object.
|
| |
| virtual | ~Counted () |
| | Destroys a reference counted object.
|
| |
Manages dynamically loadable modules.
Definition at line 71 of file modmgr.h.
◆ function_ptr
| typedef void(* OGF::ModuleManager::function_ptr) () |
A generic function pointer.
Definition at line 77 of file modmgr.h.
◆ append_dynamic_libraries_path()
| static void OGF::ModuleManager::append_dynamic_libraries_path |
( |
const std::string & |
path | ) |
|
|
static |
Adds a path where dynamic libraries can be loaded.
Under Windows, adds the path to the PATH environment variable. Under Unixes, adds the path to the LD_LIBRARY_PATH environment variable.
- Parameters
-
| [in] | path | the path to be added. |
◆ bind_module()
| bool OGF::ModuleManager::bind_module |
( |
const std::string & |
module_name, |
|
|
Module * |
module |
|
) |
| |
Declares a Module object to the ModuleManager.
Ownership of the module object is transfered to the module manager.
- Parameters
-
| [in] | module_name | name of the module |
| [in] | module | a pointer to the module object |
- Return values
-
| true | if the module could be successfully bound |
| false | otherwise (e.g. if a module with the same name was already bound) |
◆ get_local_value()
| bool OGF::ModuleManager::get_local_value |
( |
const std::string & |
name, |
|
|
std::string & |
value |
|
) |
| const |
|
overridevirtual |
overloads Environment::get_local_value()
Defines the "loaded_modules" and "loaded_dynamic_modules" variables.
- Parameters
-
| [in] | name | name of the variable to be queried |
| [out] | value | value of the variable |
- Return values
-
| true | if a variable with name was found |
| false | otherwise |
Implements GEO::Environment.
◆ initialize()
| static void OGF::ModuleManager::initialize |
( |
| ) |
|
|
static |
Initializes the ModuleManager system.
Called once when Graphite starts.
◆ instance()
◆ load_module()
| bool OGF::ModuleManager::load_module |
( |
const std::string & |
module_name, |
|
|
bool |
quiet = false |
|
) |
| |
Loads a dynamic module.
Searches a dll that matches the module name in the OGF path, managed by the FileManager.
- Parameters
-
| [in] | module_name | the name of the module, as displayed to the user (without "lib" prefix, without ".dll" or ".so" extension) |
| [in] | quiet | if true, status messages are displayed |
- Return values
-
| true | if the module was successfully loaded |
| false | otherwise |
- See also
- FileManager
◆ resolve_function()
| static function_ptr OGF::ModuleManager::resolve_function |
( |
const std::string & |
name | ) |
|
|
static |
Finds a pointer to a function by its name.
Searches all the functions currently loaded in all the dynamic libraries used by the current process.
- Parameters
-
| [in] | name | the name of the function. |
- Returns
- a pointer to the function or nullptr if no function was found.
◆ resolve_module()
| Module * OGF::ModuleManager::resolve_module |
( |
const std::string & |
module_name | ) |
|
Retreives a Module object by name.
- Parameters
-
| [in] | module_name | name of the module |
- Returns
- the module object associated with
module_name if it exists, nil otherwise
◆ resolve_symbol()
| static void * OGF::ModuleManager::resolve_symbol |
( |
const std::string & |
name | ) |
|
|
static |
Finds a pointer to a symbol by its name.
Searches all the functions currently loaded in all the dynamic libraries used by the current process.
- Parameters
-
| [in] | name | the name of the symbol. |
- Returns
- a pointer to the symbol or nullptr if no symbol was found.
◆ set_local_value()
| bool OGF::ModuleManager::set_local_value |
( |
const std::string & |
name, |
|
|
const std::string & |
value |
|
) |
| |
|
overridevirtual |
overloads Environment::set_local_value()
Defines no additional variable ("loaded_modules" and "loaded_dynamic_modules" are readonly).
- Parameters
-
| [in] | name | name of the variable to be set |
| [in] | value | new value for the variable |
- Return values
-
| true | if a variable with name could be set to value |
| false | otherwise |
Implements GEO::Environment.
◆ terminate()
| static void OGF::ModuleManager::terminate |
( |
| ) |
|
|
static |
Terminates the ModuleManager system.
Called once when Graphite exits.
◆ terminate_dynamic_modules()
| static void OGF::ModuleManager::terminate_dynamic_modules |
( |
| ) |
|
|
static |
Terminates the dynamic modules.
The dynamic modules are those that are loaded on-demand by Graphite. This function is called once when Graphite exits.
◆ unbind_module()
| bool OGF::ModuleManager::unbind_module |
( |
const std::string & |
module_name | ) |
|
Removes a Module object from the ModuleManager.
- Parameters
-
| [in] | module_name | name of the module. |
- Return values
-
| true | if the module could be successfully unbound |
| false | otherwise (e.g. if no module of that name was found in the ModuleManager) |
The documentation for this class was generated from the following file: