alpaqa 1.0.0a8
Nonconvex constrained optimization
Loading...
Searching...
No Matches
Classes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
DLLoader Class Reference

#include <interop/dl/include/alpaqa/dl/dl-problem.hpp>

Detailed Description

Definition at line 16 of file dl-problem.hpp.

+ Inheritance diagram for DLLoader:
+ Collaboration diagram for DLLoader:

Classes

struct  FuncTag
 

Protected Types

using dl_handle_t = std::shared_ptr< void >
 

Protected Member Functions

 DLLoader (std::string so_filename, std::string symbol_prefix)
 Load a shared library.
 
std::shared_ptr< void > load_lib () const
 Open the shared library using dlopen
 
template<class F >
F * load_func (std::string_view name) const
 Load a function with signature F from the library using dlsym.
 
template<class Signature >
requires std::is_function_v<Signature>
const std::function< Signature > & extra_func (const std::string &name) const
 
template<class Ret , class... FArgs, class... Args>
decltype(auto) call_extra_func_helper (const void *instance, FuncTag< Ret(const instance_t *, FArgs...)>, const std::string &name, Args &&...args) const
 
template<class Ret , class... FArgs, class... Args>
decltype(auto) call_extra_func_helper (void *instance, FuncTag< Ret(instance_t *, FArgs...)>, const std::string &name, Args &&...args)
 
template<class Ret , class... FArgs, class... Args>
decltype(auto) call_extra_func_helper (const void *, FuncTag< Ret(FArgs...)>, const std::string &name, Args &&...args) const
 

Protected Attributes

std::string so_filename
 
std::string symbol_prefix
 
dl_handle_t handle
 Handle to the shared library (returned by dlopen).
 
std::shared_ptr< function_dict_textra_functions
 An associative array of additional functions exposed by the problem.
 

Class Documentation

◆ alpaqa::dl::DLLoader::FuncTag

struct alpaqa::dl::DLLoader::FuncTag
+ Collaboration diagram for DLLoader::FuncTag< Func >:

Member Typedef Documentation

◆ dl_handle_t

using dl_handle_t = std::shared_ptr<void>
protected

Definition at line 29 of file dl-problem.hpp.

Constructor & Destructor Documentation

◆ DLLoader()

DLLoader ( std::string  so_filename,
std::string  symbol_prefix 
)
protected

Load a shared library.

Parameters
so_filenameFilename of the shared library to load.
symbol_prefixPrefix of the symbols in the library.

Definition at line 33 of file dl-problem.cpp.

Member Function Documentation

◆ load_lib()

std::shared_ptr< void > load_lib ( ) const
protected

Open the shared library using dlopen

Definition at line 12 of file dl-problem.cpp.

◆ load_func()

F * load_func ( std::string_view  name) const
protected

Load a function with signature F from the library using dlsym.

Definition at line 22 of file dl-problem.cpp.

◆ extra_func()

const std::function< Signature > & extra_func ( const std::string &  name) const
inlineprotected

Definition at line 44 of file dl-problem.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ call_extra_func_helper() [1/3]

decltype(auto) call_extra_func_helper ( const void *  instance,
FuncTag< Ret(const instance_t *, FArgs...)>  ,
const std::string &  name,
Args &&...  args 
) const
inlineprotected

Definition at line 71 of file dl-problem.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ call_extra_func_helper() [2/3]

decltype(auto) call_extra_func_helper ( void *  instance,
FuncTag< Ret(instance_t *, FArgs...)>  ,
const std::string &  name,
Args &&...  args 
)
inlineprotected

Definition at line 80 of file dl-problem.hpp.

+ Here is the call graph for this function:

◆ call_extra_func_helper() [3/3]

decltype(auto) call_extra_func_helper ( const void *  ,
FuncTag< Ret(FArgs...)>  ,
const std::string &  name,
Args &&...  args 
) const
inlineprotected

Definition at line 87 of file dl-problem.hpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ so_filename

std::string so_filename
protected

Definition at line 26 of file dl-problem.hpp.

◆ symbol_prefix

std::string symbol_prefix
protected

Definition at line 27 of file dl-problem.hpp.

◆ handle

dl_handle_t handle
protected

Handle to the shared library (returned by dlopen).

Definition at line 31 of file dl-problem.hpp.

◆ extra_functions

std::shared_ptr<function_dict_t> extra_functions
protected

An associative array of additional functions exposed by the problem.

Definition at line 34 of file dl-problem.hpp.


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