DynExp
Highly flexible laboratory automation for dynamically changing experiments.
Util::CallableMemberWrapper< ObjectT, CallableT > Class Template Reference

Wraps a member function of some object and stores its default arguments. Moving from CallableMemberWrapper does not work since this class holds const members and a reference to the object the member function is invoked on. Copy instead. More...

+ Inheritance diagram for Util::CallableMemberWrapper< ObjectT, CallableT >:

Public Member Functions

constexpr CallableMemberWrapper (ObjectT &Object, const CallableT Callable, ArgumentTs DefaultArgs={}) noexcept
 Constructs a CallableMemberWrapper instance. More...
 
template<typename... ArgTs>
auto operator() (ArgTs &&...Args) const
 Invokes the stored member function. If arguments are passed, they are are forwarded instead of the stored default arguments. More...
 
- Public Member Functions inherited from Util::INonMovable
 INonMovable (const INonMovable &)=default
 
INonMovableoperator= (const INonMovable &)=default
 
 INonMovable (INonMovable &&)=delete
 
INonMovableoperator= (INonMovable &&)=delete
 

Private Types

using ArgumentTs = argument_of_t< CallableT >
 

Private Member Functions

template<size_t... Indices, typename... ArgTs>
auto Invoke (std::integer_sequence< size_t, Indices... >, ArgTs &&...Args) const
 

Private Attributes

ObjectT & Object
 Instance of class Callable belongs to. Callable is invoked on this instance. More...
 
const CallableT Callable
 Pointer to class member function to be invoked. More...
 
const ArgumentTs DefaultArgs
 Default arguments to be passed when invoking operator() with less arguments Callable expects. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Util::INonMovable
constexpr INonMovable ()=default
 
 ~INonMovable ()=default
 

Detailed Description

template<typename ObjectT, typename CallableT>
class Util::CallableMemberWrapper< ObjectT, CallableT >

Wraps a member function of some object and stores its default arguments. Moving from CallableMemberWrapper does not work since this class holds const members and a reference to the object the member function is invoked on. Copy instead.

Template Parameters
ObjectTType of the object the member function belongs to
CallableTThe member function's function pointer type

Definition at line 447 of file Util.h.

Member Typedef Documentation

◆ ArgumentTs

template<typename ObjectT , typename CallableT >
using Util::CallableMemberWrapper< ObjectT, CallableT >::ArgumentTs = argument_of_t<CallableT>
private

Definition at line 449 of file Util.h.

Constructor & Destructor Documentation

◆ CallableMemberWrapper()

template<typename ObjectT , typename CallableT >
constexpr Util::CallableMemberWrapper< ObjectT, CallableT >::CallableMemberWrapper ( ObjectT &  Object,
const CallableT  Callable,
ArgumentTs  DefaultArgs = {} 
)
inlineconstexprnoexcept

Constructs a CallableMemberWrapper instance.

Parameters
ObjectInstance the member function is invoked on
CallablePointer to a member function
DefaultArgsDefault arguments to be passed to the member function upon invocation without passing other arguments

Definition at line 459 of file Util.h.

Member Function Documentation

◆ Invoke()

template<typename ObjectT , typename CallableT >
template<size_t... Indices, typename... ArgTs>
auto Util::CallableMemberWrapper< ObjectT, CallableT >::Invoke ( std::integer_sequence< size_t, Indices... >  ,
ArgTs &&...  Args 
) const
inlineprivate

Definition at line 477 of file Util.h.

◆ operator()()

template<typename ObjectT , typename CallableT >
template<typename... ArgTs>
auto Util::CallableMemberWrapper< ObjectT, CallableT >::operator() ( ArgTs &&...  Args) const
inline

Invokes the stored member function. If arguments are passed, they are are forwarded instead of the stored default arguments.

Template Parameters
...ArgTsTypes of the arguments expected by the wrapped member function
Parameters
...ArgsArguments to be forwarded to the wrapped member function
Returns
Returns the result of the wrapped member function.

Definition at line 470 of file Util.h.

Member Data Documentation

◆ Callable

template<typename ObjectT , typename CallableT >
const CallableT Util::CallableMemberWrapper< ObjectT, CallableT >::Callable
private

Pointer to class member function to be invoked.

Definition at line 483 of file Util.h.

◆ DefaultArgs

template<typename ObjectT , typename CallableT >
const ArgumentTs Util::CallableMemberWrapper< ObjectT, CallableT >::DefaultArgs
private

Default arguments to be passed when invoking operator() with less arguments Callable expects.

Definition at line 484 of file Util.h.

◆ Object

template<typename ObjectT , typename CallableT >
ObjectT& Util::CallableMemberWrapper< ObjectT, CallableT >::Object
private

Instance of class Callable belongs to. Callable is invoked on this instance.

Definition at line 482 of file Util.h.


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