![]() |
VSM C++ SDK
Vehicle Specific Modules SDK
|
Generic callback which can be used to define and create an instance of an abstract callable operation with arbitrary arguments. More...
#include <ugcs/vsm/defs.h>
#include <ugcs/vsm/exception.h>
#include <ugcs/vsm/debug.h>
#include <tuple>
#include <memory>
#include <functional>
Go to the source code of this file.
Namespaces | |
ugcs | |
UGCS root namespace. | |
ugcs::vsm | |
All VSM SDK functionality resides in this namespace. | |
Macros | |
#define | __UNPACK_PARAMS(...) __VA_ARGS__ |
Internal helper for unpacking parenthesis-enclosed parameters lists. More... | |
#define | DEFINE_CALLBACK_BUILDER(__name, __types, __values) |
Define callback builder function. More... | |
#define | DEFINE_CALLBACK_BUILDER_TEMPLATE(__name, __template, __types, __values) |
The same as DEFINE_CALLBACK_BUILDER, but allows specifying additional template parameters for builders which arguments depend on templates. More... | |
Functions | |
template<class Callable , typename... Args> | |
Callback< Callable, void, Args...>::Ptr | ugcs::vsm::Make_callback (Callable &&callable, Args &&...args) |
Create a callback. More... | |
template<class Result , typename... Args> | |
callback_internal::Dummy_callback_helper < Result, Args...> ::Callback_type::Ptr | ugcs::vsm::Make_dummy_callback () |
Create dummy callback. More... | |
template<class Callback_ptr , typename Result , typename... Args> | |
constexpr void | ugcs::vsm::Callback_check_type () |
Check if the specified callback type corresponds to the partial prototype. More... | |
template<class Ptr_tuple , size_t arg_idx> | |
void | ugcs::vsm::internal::Assign_ptr_tuple_impl (Ptr_tuple &tuple __UNUSED) |
Assign_ptr_tuple implementation specialization for tail last recursive call. | |
template<class Ptr_tuple , size_t arg_idx, typename Arg , typename... Args> | |
void | ugcs::vsm::internal::Assign_ptr_tuple_impl (Ptr_tuple &tuple, Arg &&arg, Args &&...args) |
Assign_ptr_tuple implementation recursive definition. More... | |
template<class Ptr_tuple , typename... Args> | |
void | ugcs::vsm::internal::Assign_ptr_tuple (Ptr_tuple &tuple, Args &&...args) |
Helper function for assigning values to location pointers by pointers stored in a tuple. More... | |
Generic callback which can be used to define and create an instance of an abstract callable operation with arbitrary arguments.
The main benefit is that callback can be executed without knowing anything about the arguments of the associated operation. For example, ugcs::vsm::Request class uses callbacks to notify request handlers about the completion of a particular request.
#define __UNPACK_PARAMS | ( | ... | ) | __VA_ARGS__ |
Internal helper for unpacking parenthesis-enclosed parameters lists.
#define DEFINE_CALLBACK_BUILDER | ( | __name, | |
__types, | |||
__values | |||
) |
Define callback builder function.
Use when forced arguments required.
__name | Name for a created function. |
__types | Types of forced arguments (parenthesis-enclosed comma-separated list). |
__values | Initial values for the forced arguments (parenthesis-enclosed comma-separated list). |
Usage example:
#define DEFINE_CALLBACK_BUILDER_TEMPLATE | ( | __name, | |
__template, | |||
__types, | |||
__values | |||
) |
The same as DEFINE_CALLBACK_BUILDER, but allows specifying additional template parameters for builders which arguments depend on templates.
__name | See DEFINE_CALLBACK_BUILDER |
__template | Additional template parameters (parenthesis-enclosed comma-separated list). |
__types | See DEFINE_CALLBACK_BUILDER |
__values | See DEFINE_CALLBACK_BUILDER |