matador::library Class Reference

Helps to load and unload external libraries. More...

#include <library.hpp>

Public Member Functions

 library ()=default
 
 library (std::string lib)
 
bool load ()
 
bool load (const std::string &lib)
 
bool unload ()
 
func_ptr function (const std::string &f) const
 

Detailed Description

Helps to load and unload external libraries.

This class represents a loader and unloader for an exernal library. The path to the library is given by a string. It can be loaded and unloaded. Furthermore it provides a method to get a pointer to an function exported by the library. The function is identfied by a name.

Constructor & Destructor Documentation

◆ library() [1/2]

matador::library::library ( )
default

Create a unspecified library serializable

◆ library() [2/2]

matador::library::library ( std::string  lib)
explicit

Create a library for the given lib path

Parameters
libThe path to the library to map.

Member Function Documentation

◆ function()

func_ptr matador::library::function ( const std::string &  f) const

Returns the pointer to the exported function of the library identified by the given name.

Parameters
fThe name of the exported function.
Returns
The pointer to the function.

◆ load() [1/2]

bool matador::library::load ( )

Load the underlaying library. If the library path is invalid or the library cannot be loaded false is returned.

Returns
True on successful library loading.

◆ load() [2/2]

bool matador::library::load ( const std::string &  lib)

Sets the libray (and subsequently close and overwrite an already instatiated library) and load the underlaying library. If the library path is invalid or the library cannot be loaded false is returned.

Parameters
libThe path to the library to load.
Returns
True on successful library loading.

◆ unload()

bool matador::library::unload ( )

Unload an loaded library. If the library isn't loaded or an error occured while unloading false is returned.

Returns
True on successful unloading.

The documentation for this class was generated from the following file:
  • matador/utils/library.hpp