AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::inlet::FunctionWrapper Class Reference

A sum type for callables with arbitrary signature. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.7.0/src/axom/inlet/Function.hpp>

Public Member Functions

template<typename FuncType >
 FunctionWrapper (std::function< FuncType > &&func)
 Primary constructor, initializes a member of the "variant". More...
 
 FunctionWrapper ()=default
 
template<typename Ret , typename... Args>
Ret call (Args &&... args) const
 Calls the function. More...
 
template<typename FuncType >
std::function< FuncType > get () const
 
 operator bool () const
 Checks whether the function exists. More...
 
void setName (std::string &&name)
 Sets the function's name. More...
 

Detailed Description

A sum type for callables with arbitrary signature.

Template Parameters
FunctionTagsThe types of supported functions

This provides an interface not templated on a specific function signature for uniform retrieval through the Reader interface

Constructor & Destructor Documentation

◆ FunctionWrapper() [1/2]

template<typename FuncType >
axom::inlet::FunctionWrapper::FunctionWrapper ( std::function< FuncType > &&  func)
inline

Primary constructor, initializes a member of the "variant".

Parameters
[in]funcThe function to initialize with
Template Parameters
FuncTypeThe function's signature
Note
"Empty" functions are allowable and result in the object comparing false when converted to bool

References axom::inlet::detail::FunctionBuffer::Alignment, and axom::inlet::detail::FunctionBuffer::Size.

◆ FunctionWrapper() [2/2]

axom::inlet::FunctionWrapper::FunctionWrapper ( )
default

Member Function Documentation

◆ call()

template<typename Ret , typename... Args>
Ret axom::inlet::FunctionWrapper::call ( Args &&...  args) const
inline

Calls the function.

Parameters
[in]argsThe parameter pack for the function's arguments
Template Parameters
RetThe user-specified return type, needed to fully disambiguate the function to call
ArgsThe types of the user-specified arguments, deduced automatically
Returns
The function's result

References SLIC_ERROR_IF.

◆ get()

template<typename FuncType >
std::function<FuncType> axom::inlet::FunctionWrapper::get ( ) const
inline

References SLIC_ERROR_IF.

◆ operator bool()

axom::inlet::FunctionWrapper::operator bool ( ) const
inlineexplicit

Checks whether the function exists.

◆ setName()

void axom::inlet::FunctionWrapper::setName ( std::string &&  name)
inline

Sets the function's name.

Note
Needs to be separate from constructor to allow the compiler to deduce template arguments correctly

References axom::inlet::detail::destroy_func_inst< void >().


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