scram::mef::ExternFunction
Extern function abstraction to be referenced by expressions. More...
#include <extern.h>
Inherits from scram::mef::ExternFunction< void >, scram::mef::Element, scram::mef::Usage, scram::mef::ContainerElement, boost::noncopyable
Public Functions
| Name | |
|---|---|
| ExternFunction(std::string name, const std::string & symbol, const ExternLibrary & library)<br>Loads a function from a library for further usage. | |
| R | operator()(Args... args) const<br>Calls the library function with the given numeric arguments. |
| virtual std::unique_ptr< Expression > | apply(std::vector< Expression * > args) const override |
Additional inherited members
Public Functions inherited from scram::mef::ExternFunction< void >
| Name | |
|---|---|
| virtual | ~ExternFunction() =default |
| Element(std::string name)<br>Constructs an element with an original name. |
Public Attributes inherited from scram::mef::ExternFunction< void >
| Name | |
|---|---|
| constexpr const char * | kTypeString <br>Type string for error messages. |
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_view | name_view() const |
| const std::string & | label() const |
| void | label(std::string label)<br>Sets the element label. |
| const AttributeMap & | attributes() const |
| void | AddAttribute(Attribute attr)<br>Adds an attribute to the attribute map of this element. |
| void | SetAttribute(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 | |
| void | name(std::string name)<br>Resets the element name. |
Public Functions inherited from scram::mef::Usage
| Name | |
|---|---|
| bool | usage() const |
| void | usage(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 | |
|---|---|
| class | Container |
Detailed Description
template <typename R ,
typename... Args>
class scram::mef::ExternFunction;Extern function abstraction to be referenced by expressions.
Template Parameters:
- R Numeric return type.
- Args Numeric argument types.
Precondition: The source dynamic library is loaded as long as this function lives.
Public Functions Documentation
function ExternFunction
inline ExternFunction(
std::string name,
const std::string & symbol,
const ExternLibrary & library
)Loads a function from a library for further usage.
Parameters:
- name The local identifier name.
- symbol The symbol name for the function in the library.
- library The dynamic library to lookup the function.
Exceptions:
- LogicError The name is required and empty.
- ValidityError The name is malformed.
- DLError There is no such symbol in the library.
Constructs an element with an original name.
The name is expected to conform to identifier requirements described in the MEF documentation and additions.
function operator()
inline R operator()(
Args... args
) constCalls the library function with the given numeric arguments.
function apply
virtual std::unique_ptr< Expression > apply(
std::vector< Expression * > args
) const overrideReimplements: scram::mef::ExternFunction< void >::apply
Updated on 2025-11-11 at 16:51:08 +0000
