ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
Communication::MpiCallbacks::CallbackHandle< Args > Class Template Reference

RAII handle for a callback. More...

#include <MpiCallbacks.hpp>

Public Member Functions

template<typename F , class = std::enable_if_t<std::is_same_v< typename detail::functor_types<F>::argument_types, std::tuple<Args...>>>>
 CallbackHandle (std::shared_ptr< MpiCallbacks > cb, F &&f)
 
 CallbackHandle (CallbackHandle const &)=delete
 
 CallbackHandle (CallbackHandle &&rhs) noexcept=default
 
CallbackHandleoperator= (CallbackHandle const &)=delete
 
CallbackHandleoperator= (CallbackHandle &&rhs) noexcept=default
 
template<class... ArgRef>
auto operator() (ArgRef &&...args) const -> std::enable_if_t< std::is_void_v< decltype(std::declval< void(*)(Args...)>()(std::forward< ArgRef >(args)...))> >
 Call the callback managed by this handle.
 
 ~CallbackHandle ()
 
int id () const
 

Detailed Description

template<class... Args>
class Communication::MpiCallbacks::CallbackHandle< Args >

RAII handle for a callback.

This is what the client gets for registering a dynamic (= not function pointer) callback. It manages the lifetime of the callback handle needed to call it. The handle has a type derived from the signature of the callback, which makes it possible to do static type checking on the arguments.

Definition at line 199 of file MpiCallbacks.hpp.

Constructor & Destructor Documentation

◆ CallbackHandle() [1/3]

template<class... Args>
template<typename F , class = std::enable_if_t<std::is_same_v< typename detail::functor_types<F>::argument_types, std::tuple<Args...>>>>
Communication::MpiCallbacks::CallbackHandle< Args >::CallbackHandle ( std::shared_ptr< MpiCallbacks cb,
F &&  f 
)
inline

Definition at line 204 of file MpiCallbacks.hpp.

◆ CallbackHandle() [2/3]

template<class... Args>
Communication::MpiCallbacks::CallbackHandle< Args >::CallbackHandle ( CallbackHandle< Args > const &  )
delete

◆ CallbackHandle() [3/3]

template<class... Args>
Communication::MpiCallbacks::CallbackHandle< Args >::CallbackHandle ( CallbackHandle< Args > &&  rhs)
defaultnoexcept

◆ ~CallbackHandle()

template<class... Args>
Communication::MpiCallbacks::CallbackHandle< Args >::~CallbackHandle ( )
inline

Definition at line 235 of file MpiCallbacks.hpp.

Member Function Documentation

◆ id()

template<class... Args>
int Communication::MpiCallbacks::CallbackHandle< Args >::id ( ) const
inline

Definition at line 240 of file MpiCallbacks.hpp.

◆ operator()()

template<class... Args>
template<class... ArgRef>
auto Communication::MpiCallbacks::CallbackHandle< Args >::operator() ( ArgRef &&...  args) const -> std::enable_if_t< std::is_void_v<decltype(std::declval<void (*)(Args...)>()( std::forward<ArgRef>(args)...))>>
inline

Call the callback managed by this handle.

The arguments are passed to the remote callees, it must be possible to call the function with the provided arguments, otherwise this will not compile.

Definition at line 225 of file MpiCallbacks.hpp.

◆ operator=() [1/2]

template<class... Args>
CallbackHandle & Communication::MpiCallbacks::CallbackHandle< Args >::operator= ( CallbackHandle< Args > &&  rhs)
defaultnoexcept

◆ operator=() [2/2]

template<class... Args>
CallbackHandle & Communication::MpiCallbacks::CallbackHandle< Args >::operator= ( CallbackHandle< Args > const &  )
delete

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