RAVENNAKIT
Loading...
Searching...
No Matches
rav::SafeFunction< R(Args...)> Class Template Reference

#include <safe_function.hpp>

Public Types

using FuncType = std::function<R(Args...)>

Public Member Functions

 SafeFunction ()
 Constructs an empty callback function.
 SafeFunction (FuncType f)
 Constructs a callback function with the given function.
R operator() (Args... args) const
 Calls the stored function with the given arguments.
void set (FuncType f)
 Sets the function to be called.
SafeFunction & operator= (FuncType f)
 Sets the function to be called.
void reset ()
 Resets the function to a no-op function.

Detailed Description

template<typename R, typename... Args>
class rav::SafeFunction< R(Args...)>

Definition at line 39 of file safe_function.hpp.

Member Typedef Documentation

◆ FuncType

template<typename R, typename... Args>
using rav::SafeFunction< R(Args...)>::FuncType = std::function<R(Args...)>

Definition at line 41 of file safe_function.hpp.

Constructor & Destructor Documentation

◆ SafeFunction() [1/2]

template<typename R, typename... Args>
rav::SafeFunction< R(Args...)>::SafeFunction ( )
inline

Constructs an empty callback function.

Definition at line 46 of file safe_function.hpp.

◆ SafeFunction() [2/2]

template<typename R, typename... Args>
rav::SafeFunction< R(Args...)>::SafeFunction ( FuncType f)
inlineexplicit

Constructs a callback function with the given function.

Parameters
fThe function to be called.

Definition at line 52 of file safe_function.hpp.

Member Function Documentation

◆ operator()()

template<typename R, typename... Args>
R rav::SafeFunction< R(Args...)>::operator() ( Args... args) const
inline

Calls the stored function with the given arguments.

Parameters
argsThe arguments to be passed to the function.
Returns
The result of the function call.

Definition at line 59 of file safe_function.hpp.

◆ operator=()

template<typename R, typename... Args>
SafeFunction & rav::SafeFunction< R(Args...)>::operator= ( FuncType f)
inline

Sets the function to be called.

Parameters
fThe function to be called.

Definition at line 75 of file safe_function.hpp.

◆ reset()

template<typename R, typename... Args>
void rav::SafeFunction< R(Args...)>::reset ( )
inline

Resets the function to a no-op function.

Definition at line 83 of file safe_function.hpp.

◆ set()

template<typename R, typename... Args>
void rav::SafeFunction< R(Args...)>::set ( FuncType f)
inline

Sets the function to be called.

Parameters
fThe function to be called.

Definition at line 67 of file safe_function.hpp.


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