DQCsim
Public Member Functions | Friends | List of all members
dqcsim::wrap::Callback< R, Args > Class Template Reference

Class template shared between all callback functions. More...

Public Member Functions

 Callback (R(*cb)(Args...)) noexcept
 Constructs the callback wrapper from a regular C-style function. More...
 
template<class T >
 Callback (R(*cb)(T, Args...), T user) noexcept
 Constructs the callback wrapper from a regular C-style function with a user argument bound to it. More...
 
template<class T >
 Callback (T *instance, R(T::*cb)(Args...)) noexcept
 Constructs the callback wrapper from a member function. More...
 
 Callback (std::function< R(Args...)> &&cb) noexcept
 Constructs the callback wrapper by moving a std::function. More...
 
 Callback (const std::function< R(Args...)> &cb) noexcept
 Constructs the callback wrapper by copying a std::function. More...
 
 Callback (std::shared_ptr< std::function< R(Args...)>> &&cb) noexcept
 Constructs the callback wrapper by means of moving a shared_ptr to a std::function. More...
 
 Callback (const std::shared_ptr< std::function< R(Args...)>> &cb) noexcept
 Constructs the callback wrapper by means of a copying a shared_ptr to a std::function. More...
 

Friends

class CallbackEntryPoints
 

Detailed Description

template<class R, class... Args>
class dqcsim::wrap::Callback< R, Args >

Class template shared between all callback functions.

This class is specialized for all the callbacks supported by DQCsim in the callback namespace.

Definition at line 6749 of file dqcsim.

Constructor & Destructor Documentation

◆ Callback() [1/7]

template<class R , class... Args>
dqcsim::wrap::Callback< R, Args >::Callback ( R(*)(Args...)  cb)
inlinenoexcept

Constructs the callback wrapper from a regular C-style function.

Parameters
cbThe C function pointer to wrap.

Definition at line 6827 of file dqcsim.

◆ Callback() [2/7]

template<class R , class... Args>
template<class T >
dqcsim::wrap::Callback< R, Args >::Callback ( R(*)(T, Args...)  cb,
user 
)
inlinenoexcept

Constructs the callback wrapper from a regular C-style function with a user argument bound to it.

Usually this would be a pointer to some shared data structure containing the user's plugin state.

Parameters
cbThe C function pointer to wrap. When it is called, the first argument is always set to whatever is passed to user here.
userThe data to pass to the first argument of cb.

Definition at line 6841 of file dqcsim.

◆ Callback() [3/7]

template<class R , class... Args>
template<class T >
dqcsim::wrap::Callback< R, Args >::Callback ( T *  instance,
R(T::*)(Args...)  cb 
)
inlinenoexcept

Constructs the callback wrapper from a member function.

Parameters
instanceThe class instance whose member function is to be wrapped.
cbThe pointer to the member function that is to be wrapped.

Definition at line 6853 of file dqcsim.

◆ Callback() [4/7]

template<class R , class... Args>
dqcsim::wrap::Callback< R, Args >::Callback ( std::function< R(Args...)> &&  cb)
inlinenoexcept

Constructs the callback wrapper by moving a std::function.

Parameters
cbThe C++11 std::function to wrap.

Definition at line 6862 of file dqcsim.

◆ Callback() [5/7]

template<class R , class... Args>
dqcsim::wrap::Callback< R, Args >::Callback ( const std::function< R(Args...)> &  cb)
inlinenoexcept

Constructs the callback wrapper by copying a std::function.

Parameters
cbThe C++11 std::function to wrap.

Definition at line 6871 of file dqcsim.

◆ Callback() [6/7]

template<class R , class... Args>
dqcsim::wrap::Callback< R, Args >::Callback ( std::shared_ptr< std::function< R(Args...)>> &&  cb)
inlinenoexcept

Constructs the callback wrapper by means of moving a shared_ptr to a std::function.

Parameters
cbA C++11 std::shared_ptr to the std::function to wrap.

Definition at line 6881 of file dqcsim.

◆ Callback() [7/7]

template<class R , class... Args>
dqcsim::wrap::Callback< R, Args >::Callback ( const std::shared_ptr< std::function< R(Args...)>> &  cb)
inlinenoexcept

Constructs the callback wrapper by means of a copying a shared_ptr to a std::function.

Parameters
cbA C++11 std::shared_ptr to the std::function to wrap.

Definition at line 6890 of file dqcsim.


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