VSM C++ SDK
Vehicle Specific Modules SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ugcs::vsm::Callback_forced_args< Callable, Forced_args_tuple, Args > Class Template Reference

Helper class for defining custom callback creation functions which force several first arguments for the user callback. More...

#include <callback.h>

Inheritance diagram for ugcs::vsm::Callback_forced_args< Callable, Forced_args_tuple, Args >:

Public Types

using Helper = callback_internal::Callback_forced_args_helper< Callable, void, Args...>
 Helper type. More...
 
using Callback_ptr = typename Helper::template Callback_ptr< Forced_args_tuple >
 Resulted callback type. More...
 

Static Public Member Functions

static Callback_ptr Create (Callable &&callable, Forced_args_tuple &&forced_args_tuple, Args &&...args)
 Create callback with forced first arguments. More...
 

Detailed Description

template<class Callable, class Forced_args_tuple, typename... Args>
class ugcs::vsm::Callback_forced_args< Callable, Forced_args_tuple, Args >

Helper class for defining custom callback creation functions which force several first arguments for the user callback.

Parameters
CallableUser provided callable object.
Forced_args_tuplestd::tuple for enforced arguments.
ArgsUser arguments for the callable. If the callable object is member function then the first user argument should be pointer (any smart pointer accepted) to the object instance.

Usage example:

// Enforce "int" argument with value "10".
template <class Callable, typename... Args>
typename Callback_forced_args<Callable, std::tuple<int>, Args...>::Callback_type::Ptr
Make_my_callback(Callable &&callable, Args &&... args)
{
return Callback_forced_args<Callable, std::tuple<int>, Args...>::Create(
std::forward<Callable>(callable), std::forward_as_tuple<int>(10),
std::forward<Args>(args)...);
}

Member Typedef Documentation

template<class Callable , class Forced_args_tuple , typename... Args>
using ugcs::vsm::Callback_forced_args< Callable, Forced_args_tuple, Args >::Callback_ptr = typename Helper::template Callback_ptr<Forced_args_tuple>

Resulted callback type.

template<class Callable , class Forced_args_tuple , typename... Args>
using ugcs::vsm::Callback_forced_args< Callable, Forced_args_tuple, Args >::Helper = callback_internal::Callback_forced_args_helper<Callable, void, Args...>

Helper type.

Member Function Documentation

template<class Callable , class Forced_args_tuple , typename... Args>
static Callback_ptr ugcs::vsm::Callback_forced_args< Callable, Forced_args_tuple, Args >::Create ( Callable &&  callable,
Forced_args_tuple &&  forced_args_tuple,
Args &&...  args 
)
inlinestatic

Create callback with forced first arguments.

Parameters
callableUser provided callable object. Should be forwarded by std::forward().
forced_args_tupleTuple with first arguments values. Should be created by std::forward_as_tuple().
argsUser provided arguments. Should be forwarded by std::forward().
Returns
Pointer to created callback.

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