Skip to content

scram::mef::ExternLibrary

The MEF construct to extend expressions with external libraries. More...

#include <extern.h>

Inherits from scram::mef::Element, scram::mef::Usage, scram::mef::ContainerElement, boost::noncopyable

Public Functions

Name
ExternLibrary(std::string name, std::string lib_path, const boost::filesystem::path & reference_dir, bool system, bool decorate)<br>Constructs an element with an original name.
template <typename F > <br>std::enable_if_t< std::is_function_v< F >, std::add_pointer_t< F > >get(const std::string & symbol) const

Public Attributes

Name
constexpr const char *kTypeString <br>Type string for error messages.

Additional inherited members

Public Types inherited from scram::mef::Element

Name
using ext::linear_set< Attribute, AttributeKey >AttributeMap <br>Unique attribute map keyed with the attribute names.

Public Functions inherited from scram::mef::Element

Name
Element(std::string name)<br>Constructs an element with an original name.
const std::string &name() const
std::string_viewname_view() const
const std::string &label() const
voidlabel(std::string label)<br>Sets the element label.
const AttributeMap &attributes() const
voidAddAttribute(Attribute attr)<br>Adds an attribute to the attribute map of this element.
voidSetAttribute(Attribute attr)<br>Sets an attribute to the attribute map.
const Attribute *GetAttribute(std::string_view name) const
std::optional< Attribute >RemoveAttribute(std::string_view name)<br>Removes an attribute of this element.

Protected Functions inherited from scram::mef::Element

Name
~Element() =default
voidname(std::string name)<br>Resets the element name.

Public Functions inherited from scram::mef::Usage

Name
boolusage() const
voidusage(bool usage)

Protected Functions inherited from scram::mef::Usage

Name
~Usage() =default

Protected Functions inherited from scram::mef::ContainerElement

Name
const Element *container() const

Friends inherited from scram::mef::ContainerElement

Name
classContainer

Detailed Description

cpp
class scram::mef::ExternLibrary;

The MEF construct to extend expressions with external libraries.

This class dynamically loads and manages libraries. It supports only very basic interface for C function lookup with its symbol.

Public Functions Documentation

function ExternLibrary

cpp
ExternLibrary(
    std::string name,
    std::string lib_path,
    const boost::filesystem::path & reference_dir,
    bool system,
    bool decorate
)

Constructs an element with an original name.

Parameters:

  • name The local identifier name.
  • lib_path The library path with its name.
  • reference_dir The reference directory for relative paths.
  • system Search for the library in system paths.
  • decorate Decorate the library name with prefix and suffix.

Exceptions:

The name is expected to conform to identifier requirements described in the MEF documentation and additions.

function get

cpp
template <typename F >
inline std::enable_if_t< std::is_function_v< F >, std::add_pointer_t< F > > get(
    const std::string & symbol
) const

Parameters:

  • symbol The function symbol in the library.

Exceptions:

  • DLError The symbol is not in the library.

Template Parameters:

  • F The C free function type.

Return: The function pointer resolved from the symbol.

Public Attributes Documentation

variable kTypeString

cpp
static constexpr const char * kTypeString = "extern library";

Type string for error messages.


Updated on 2025-11-11 at 16:51:08 +0000