VSM C++ SDK
Vehicle Specific Modules SDK
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

typedef callback_internal::Callback_forced_args_helper< Callable, void, Args... > Helper
 Helper type. More...
 
typedef Helper::template Callback_type< Forced_args_tuple > Callback_type
 Resulted callback type. More...
 

Static Public Member Functions

static Callback_type::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>
typedef Helper::template Callback_type<Forced_args_tuple> ugcs::vsm::Callback_forced_args< Callable, Forced_args_tuple, Args >::Callback_type

Resulted callback type.

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

Helper type.

Member Function Documentation

template<class Callable , class Forced_args_tuple , typename... Args>
static Callback_type::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: