VSM C++ SDK
Vehicle Specific Modules SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
callback.h
Go to the documentation of this file.
1 // Copyright (c) 2018, Smart Projects Holdings Ltd
2 // All rights reserved.
3 // See LICENSE file for license details.
4 
13 #ifndef _UGCS_VSM_CALLBACK_H_
14 #define _UGCS_VSM_CALLBACK_H_
15 
16 #include <ugcs/vsm/defs.h>
17 #include <ugcs/vsm/exception.h>
18 #include <ugcs/vsm/debug.h>
19 
20 #include <tuple>
21 #include <memory>
22 #include <functional>
23 
25 #define __UNPACK_PARAMS(...) __VA_ARGS__
26 
42 #define DEFINE_CALLBACK_BUILDER(__name, __types, __values) \
43  template <class __Callable, typename... __Args> \
44  __DEFINE_CALLBACK_BUILDER_BODY(__name, __types, __values)
45 
55 #define DEFINE_CALLBACK_BUILDER_TEMPLATE(__name, __template, __types, __values) \
56  template <__UNPACK_PARAMS __template, class __Callable, typename... __Args> \
57  __DEFINE_CALLBACK_BUILDER_BODY(__name, __types, __values)
58 
59 #ifndef NO_DOXYGEN
60 /* Common part of DEFINE_CALLBACK_BUILDER and DEFINE_CALLBACK_BUILDER_TEMPLATE. */
61 #define __DEFINE_CALLBACK_BUILDER_BODY(__name, __types, __values) \
62  static \
63  typename ugcs::vsm::Callback_forced_args<__Callable, \
64  std::tuple<__UNPACK_PARAMS __types>, \
65  __Args...>::Callback_type::Ptr \
66  __name(__Callable &&__callable, __Args &&... __args) \
67  { \
68  return ugcs::vsm::Callback_forced_args<__Callable, \
69  std::tuple<__UNPACK_PARAMS __types>, \
70  __Args...>::Create( \
71  std::forward<__Callable>(__callable), \
72  std::forward_as_tuple<__UNPACK_PARAMS __types>(__UNPACK_PARAMS __values), \
73  std::forward<__Args>(__args)...); \
74  }
75 #endif
76 
77 namespace ugcs {
78 namespace vsm {
79 
85 template<typename Result>
87 public:
89  typedef Result Result_t;
90 
92  template <class Callback = Callback_base>
93  class Ptr: public std::shared_ptr<Callback> {
94  public:
97 
99  template <typename... Args>
100  Ptr(Args &&... args):
101  std::shared_ptr<Callback_type>(std::forward<Args>(args)...)
102  {}
103 
107  Result_t
109  {
110  if (!std::shared_ptr<Callback_type>::get()) {
111  VSM_EXCEPTION(Nullptr_exception,
112  "Attempted to invoke empty callback");
113  }
114  return (*std::shared_ptr<Callback_type>::get())();
115  }
116  };
117 
119  virtual Result_t
120  operator()() = 0;
121 };
122 
123 #ifndef NO_DOXYGEN
124 
125 namespace callback_internal {
126 
130 template <int...>
131 struct Sequence
132 {};
133 
137 template<int n, int... s>
138 struct Sequence_generator: Sequence_generator<n - 1, n - 1, s...>
139 {};
140 
142 template<int... s>
143 struct Sequence_generator<0, s...>
144 {
146  typedef Sequence<s...> Sequence_type;
147 };
148 
152 template <typename T>
153 struct Adapt_arg_type {
155  typedef typename std::remove_cv<typename std::remove_reference<T>::type>::type type;
156 };
157 
159 template <size_t size>
160 struct Adapt_arg_type<const char (&)[size]> {
162  typedef const char *type;
163 };
164 
168 template <typename T, typename Enable = void>
169 struct Adapt_callable_type {
171  typedef typename std::remove_cv<typename std::remove_reference<T>::type>::type type;
172 };
173 
175 template <typename F>
176 struct Adapt_callable_type<F,
177  typename std::enable_if<
178  std::is_function<
179  typename std::remove_reference<F>::type>::value>::type> {
181  typedef F type;
182 };
183 
186 template <class Method>
187 struct Is_method_ptr_type {
188  static constexpr bool value =
189  std::is_member_function_pointer<typename callback_internal::Adapt_callable_type<Method>::type>::value;
190 };
191 
193 template <class Method>
194 constexpr bool
195 Is_method_ptr()
196 {
198 }
199 
200 } /* namespace callback_internal */
201 #endif
202 
212 template <class Callable, class Enable, typename... Args>
213 class Callback:
214  public Callback_base<typename std::result_of<Callable(Args...)>::type> {
215 public:
217  typedef Callback_base<typename std::result_of<Callable(Args...)>::type>
220  typedef typename Base_type::template Ptr<Callback> Ptr;
221 
222 private:
224  typedef std::tuple<typename callback_internal::Adapt_arg_type<Args>::type...> Args_tuple;
225 
226 public:
230  template <size_t arg_idx>
231  using Arg_type = typename std::tuple_element<arg_idx, Args_tuple>::type;
232 
234  static Ptr
235  Create(Callable &&callable, Args &&... args)
236  {
237  return std::make_shared<Callback>(std::forward<Callable>(callable),
238  std::forward<Args>(args)...);
239  }
240 
246  Callback(Callable &&callable, Args &&... args):
247  callable(std::forward<Callable>(callable)),
248  args(std::forward<Args>(args)...)
249  {}
250 
252  Callback(Callback &&) = default;
253 
255  virtual typename Base_type::Result_t
256  operator()() override
257  {
258  return Invoke(typename callback_internal::Sequence_generator
259  <sizeof...(Args)>::Sequence_type());
260  }
261 
267  template <size_t arg_idx>
268  Arg_type<arg_idx> &
270  {
271  return std::get<arg_idx>(args);
272  }
273 
274 protected:
276  typename callback_internal::Adapt_callable_type<Callable>::type callable;
278  Args_tuple args;
279 
281  template <int... s>
282  typename Base_type::Result_t
283  Invoke(callback_internal::Sequence<s...>)
284  {
285  return callable(std::get<s>(args)...);
286  }
287 };
288 
299 template <class Method, class Class_ptr, typename... Args>
300 class Callback<Method,
301  typename std::enable_if<callback_internal::Is_method_ptr<Method>()>::type,
302  Class_ptr, Args...>:
303  public Callback_base<typename std::result_of<Method(Class_ptr, Args...)>::type> {
304 public:
306  typedef Callback_base<typename std::result_of<Method(Class_ptr, Args...)>::type>
309  typedef typename Base_type::template Ptr<Callback> Ptr;
310 
311 private:
313  typedef std::tuple<typename callback_internal::Adapt_arg_type<Args>::type...> Args_tuple;
314 
315 public:
319  template <size_t arg_idx>
320  using Arg_type = typename std::tuple_element<arg_idx, Args_tuple>::type;
321 
323  static Ptr
324  Create(Method method, Class_ptr &&obj_ptr, Args &&... args)
325  {
326  return std::make_shared<Callback>(method,
327  std::forward<Class_ptr>(obj_ptr),
328  std::forward<Args>(args)...);
329  }
330 
332  Callback(Method method, Class_ptr &&obj_ptr, Args &&... args):
333  obj_ptr(std::forward<Class_ptr>(obj_ptr)), method(method),
334  args(std::forward<Args>(args)...)
335  {}
336 
338  Callback(Callback &&) = default;
339 
341  virtual typename Base_type::Result_t
342  operator()() override
343  {
344  return Invoke(typename callback_internal::Sequence_generator
345  <sizeof...(Args)>::Sequence_type());
346  }
347 
353  template <size_t arg_idx>
354  Arg_type<arg_idx> &
356  {
357  return std::get<arg_idx>(args);
358  }
359 
360 private:
362  typename std::remove_reference<Class_ptr>::type obj_ptr;
364  typename callback_internal::Adapt_callable_type<Method>::type method;
366  Args_tuple args;
367 
369  template <int... s>
370  typename Base_type::Result_t
371  Invoke(callback_internal::Sequence<s...>)
372  {
373  return ((*obj_ptr).*method)(std::get<s>(args)...);
374  }
375 };
376 
387 template <class Callable, typename... Args>
388 typename Callback<Callable, void, Args...>::Ptr
389 Make_callback(Callable &&callable, Args&& ...args)
390 {
391  return Callback<Callable,
392  void,
393  Args...>::Create
394  (std::forward<Callable>(callable), std::forward<Args>(args)...);
395 }
396 
397 namespace callback_internal {
398 
400 template <class Result, typename... Args>
402 public:
404  typedef std::function<Result(Args...)> Callable;
406  typedef Callback<Callable, void, Args...> Callback_type;
407 
409  static Callable
411  {
412  return [](Args __UNUSED... args) {
413  return Result();
414  };
415  }
416 };
417 
419 template <typename... Args>
420 class Dummy_callback_helper<void, Args...> {
421 public:
423  typedef std::function<void(Args...)> Callable;
425  typedef Callback<Callable, void, Args...> Callback_type;
426 
428  static Callable
430  {
431  return [](Args __UNUSED... args) {};
432  }
433 };
434 
435 } /* namespace callback_internal */
436 
444 template <class Result, typename... Args>
445 typename callback_internal::Dummy_callback_helper<Result, Args...>::Callback_type::Ptr
447 {
448  typedef callback_internal::Dummy_callback_helper<Result, Args...> Helper;
449  return Make_callback<typename Helper::Callable>(Helper::Create(), Args()...);
450 }
451 
452 namespace callback_internal {
453 
455 template <class Callback, size_t idx, typename... Args>
457 
459 template <class Callback>
462  constexpr static bool value = true;
463 };
464 
466 template <class Callback, size_t idx, typename Arg>
467 struct Callback_args_checker<Callback, idx, Arg> {
469  typedef typename Callback::template Arg_type<idx> Cbk_arg;
472 
473  static_assert(value, "Argument type mismatch");
474 };
475 
477 template <class Callback, size_t idx, typename Arg, typename... Args>
478 struct Callback_args_checker<Callback, idx, Arg, Args...> {
480  typedef typename Callback::template Arg_type<idx> Cbk_arg;
483  Callback_args_checker<Callback, idx + 1, Args...>::value;
484 
485  static_assert(value, "Argument type mismatch");
486 };
487 
488 } /* namespace callback_internal */
489 
499 template <class Callback_ptr, typename Result, typename... Args>
500 constexpr void
502 {
503  typedef typename
504  std::remove_reference<decltype(*std::declval<Callback_ptr>())>::type Callback;
505 
506  /* Check result type. */
508  "Callback result value type mismatch");
509  /* Check argument types. */
511  "Arguments type mismatch");
512 }
513 
514 
515 #ifndef NO_DOXYGEN
516 namespace callback_internal {
517 
524 template <class Callable, typename Enable, typename... Args>
525 class Callback_forced_args_helper {
526 public:
527  template <typename... Forced_args>
528  static typename Callback<Callable, void, Forced_args..., Args...>::Ptr
529  Create(Callable &&callable, std::tuple<Forced_args...> &&forced_args,
530  Args &&... args)
531  {
532  return Create_impl<decltype(forced_args)>(
533  std::forward<Callable>(callable),
534  std::tuple_cat(std::forward<std::tuple<Forced_args...>>(forced_args),
535  std::forward_as_tuple(std::forward<Args>(args)...)),
536  typename callback_internal::Sequence_generator<sizeof...(Forced_args) + sizeof...(Args)>::Sequence_type());
537  }
538 
540  template <class Forced_args_tuple>
541  using Callback_type = decltype(Callback_forced_args_helper::Create(
542  std::declval<Callable>(),
543  std::declval<Forced_args_tuple>(),
544  std::declval<Args>()...));
545 
546 private:
547  template <class Forced_args_tuple, class All_args_tuple, int... args_seq>
548  static typename Callback_type<Forced_args_tuple>::Ptr
549  Create_impl(Callable &&callable, All_args_tuple &&all_args_tuple,
550  callback_internal::Sequence<args_seq...>)
551  {
552  return Make_callback(
553  std::forward<Callable>(callable),
554  std::forward<typename std::tuple_element<args_seq, All_args_tuple>::type>
555  (std::get<args_seq>(all_args_tuple))...);
556  }
557 };
558 
560 template <class Method, class Class_ptr, typename... Args>
561 class Callback_forced_args_helper<
562  Method,
563  typename std::enable_if<callback_internal::Is_method_ptr<Method>()>::type,
564  Class_ptr, Args...> {
565 public:
566  template <typename... Forced_args>
567  static typename Callback<Method, void, Class_ptr, Forced_args..., Args...>::Ptr
568  Create(Method &&method, std::tuple<Forced_args...> &&forced_args,
569  Class_ptr &&class_ptr, Args &&... args)
570  {
571  return Create_impl<decltype(forced_args)>(
572  std::forward<Method>(method),
573  std::tuple_cat(std::forward_as_tuple(std::forward<Class_ptr>(class_ptr)),
574  std::forward<std::tuple<Forced_args...>>(forced_args),
575  std::forward_as_tuple(std::forward<Args>(args)...)),
576  typename callback_internal::Sequence_generator<
577  1 + sizeof...(Forced_args) + sizeof...(Args)>::Sequence_type());
578  }
579 
581  template <class Forced_args_tuple>
582  using Callback_type = decltype(Callback_forced_args_helper::Create(
583  std::declval<Method>(),
584  std::declval<Forced_args_tuple>(),
585  std::declval<Class_ptr>(),
586  std::declval<Args>()...));
587 private:
588  template <class Forced_args_tuple, class All_args_tuple, int... args_seq>
589  static typename Callback_type<Forced_args_tuple>::Ptr
590  Create_impl(Method &&method, All_args_tuple &&all_args_tuple,
591  callback_internal::Sequence<args_seq...>)
592  {
593  return Make_callback(
594  std::forward<Method>(method),
595  std::forward<typename std::tuple_element<args_seq, All_args_tuple>::type>
596  (std::get<args_seq>(all_args_tuple))...);
597  }
598 };
599 
600 } /* namespace callback_internal */
601 #endif
602 
603 
627 template <class Callable, class Forced_args_tuple, typename... Args>
629  public callback_internal::Callback_forced_args_helper<Callable, void, Args...>::
630  template Callback_type<Forced_args_tuple> {
631 public:
633  typedef callback_internal::Callback_forced_args_helper<Callable, void, Args...> Helper;
635  typedef typename Helper::template Callback_type<Forced_args_tuple> Callback_type;
636 
646  static typename Callback_type::Ptr
647  Create(Callable &&callable, Forced_args_tuple &&forced_args_tuple,
648  Args &&... args)
649  {
650  return Helper::Create(std::forward<Callable>(callable),
651  std::forward<Forced_args_tuple>(forced_args_tuple),
652  std::forward<Args>(args)...);
653  }
654 };
655 
656 namespace internal {
657 
661 template <class Ptr_tuple, size_t arg_idx>
662 void
663 Assign_ptr_tuple_impl(Ptr_tuple &tuple __UNUSED)
664 {}
665 
667 template <class Ptr_tuple, size_t arg_idx, typename Arg, typename... Args>
668 void
669 Assign_ptr_tuple_impl(Ptr_tuple &tuple, Arg &&arg, Args &&... args)
670 {
671  *std::get<arg_idx>(tuple) = std::forward<Arg>(arg);
672  Assign_ptr_tuple_impl<Ptr_tuple, arg_idx + 1, Args...>
673  (tuple, std::forward<Args>(args)...);
674 }
675 
678 template <class Ptr_tuple, typename... Args>
679 void
680 Assign_ptr_tuple(Ptr_tuple &tuple, Args &&... args)
681 {
682  Assign_ptr_tuple_impl<Ptr_tuple, 0, Args...>(tuple, std::forward<Args>(args)...);
683 }
684 
685 } /* namespace internal */
686 
693 template <class Result, typename... Args>
695 public:
699  typedef typename Callback_type::template Ptr<> Callback_ptr;
700 
701 private:
703  typedef std::tuple<typename std::add_lvalue_reference<Args>::type...> Args_ref_tuple;
705  typedef std::tuple<typename std::add_pointer<Args>::type...> Args_ptr_tuple;
706 
707 public:
709  template <size_t arg_idx>
710  using Arg_ref_type = typename std::tuple_element<arg_idx, Args_ref_tuple>::type;
711 
713  template <size_t arg_idx>
714  using Arg_ptr_type = typename std::tuple_element<arg_idx, Args_ptr_tuple>::type;
715 
717  Callback_proxy() = default;
718 
720  template <class Callback_ptr>
722  cbk(cbk), args_ptr(Get_args_ptr_tuple(cbk, Args_seq()))
723  {
724  Callback_check_type<Callback_ptr, Result, Args...>();
725  }
726 
728  template <typename... Invoke_args>
729  void
730  Set_args(Invoke_args &&... invoke_args) const
731  {
732  internal::Assign_ptr_tuple(args_ptr, std::forward<Invoke_args>(invoke_args)...);
733  }
734 
736  template <typename... Invoke_args>
737  Result
738  operator()(Invoke_args &&... invoke_args) const
739  {
740  Set_args<Invoke_args...>(std::forward<Invoke_args>(invoke_args)...);
741  return Invoke();
742  }
743 
745  Result
746  Invoke() const
747  {
748  return cbk();
749  }
750 
754  {
755  return cbk;
756  }
757 
759  explicit operator bool() const
760  {
761  return cbk != nullptr;
762  }
763 
765  operator Callback_ptr()
766  {
767  return cbk;
768  }
769 
775  template <size_t arg_idx>
776  Arg_ref_type<arg_idx>
778  {
779  /*
780  * Proxy should be bound to be able to access arguments.
781  * In release build the code will anyway crash somewhere else.
782  */
783  ASSERT(*this);
784  return *std::get<arg_idx>(args_ptr);
785  }
786 
792  template <size_t arg_idx, typename Arg_type>
793  void
794  Set_arg(Arg_type &&arg)
795  {
796  Get_arg<arg_idx>() = std::forward<Arg_type>(arg);
797  }
798 
802  bool
803  operator ==(const Callback_proxy& other) const
804  {
805  return other.cbk == cbk;
806  }
807 
811  bool
812  operator !=(const Callback_proxy& other) const
813  {
814  return other.cbk != cbk;
815  }
816 
818  class Hasher {
819  public:
821  size_t
822  operator()(const Callback_proxy& proxy) const
823  {
824  static std::hash<decltype(proxy.cbk.get())> hasher;
825 
826  return hasher(proxy.cbk.get());
827  }
828  };
829 
830 private:
832  typedef typename callback_internal::Sequence_generator<sizeof...(Args)>::Sequence_type Args_seq;
833 
835  mutable Callback_ptr cbk;
837  Args_ptr_tuple args_ptr;
838 
842  template <class Callback_ptr, int... args_seq>
843  static Args_ptr_tuple
844  Get_args_ptr_tuple(Callback_ptr cbk, callback_internal::Sequence<args_seq...>)
845  {
846  return Args_ptr_tuple(&cbk->template Get_arg<args_seq>()...);
847  }
848 };
849 
850 } /* namespace vsm */
851 } /* namespace ugcs */
852 
853 #endif /* _UGCS_VSM_CALLBACK_H_ */
static Callback_type::Ptr Create(Callable &&callable, Forced_args_tuple &&forced_args_tuple, Args &&...args)
Create callback with forced first arguments.
Definition: callback.h:647
bool operator==(const Callback_proxy &other) const
Equality operator.
Definition: callback.h:803
static Callable Create()
Create callable object.
Definition: callback.h:410
Helper structure for checking callback argument types.
Definition: callback.h:456
void Set_arg(Arg_type &&arg)
Set argument value at the specified position.
Definition: callback.h:794
void Set_args(Invoke_args &&...invoke_args) const
Set arguments values for callback invocation.
Definition: callback.h:730
Callback_base< Result > Callback_type
Base type of the underlying callback object.
Definition: callback.h:697
Base_type::Result_t Invoke(callback_internal::Sequence< s...>)
Invoke callable entity with user provided arguments.
Definition: callback.h:283
virtual Result_t operator()()=0
Execute callback.
Debugging and troubleshooting helpers.
Result Result_t
Result type.
Definition: callback.h:89
Helper class for creating dummy callbacks.
Definition: callback.h:401
Callback_type::template Ptr Callback_ptr
Pointer to the underlying callback object.
Definition: callback.h:699
Result Invoke() const
Invoke the callback with the previously set argument values.
Definition: callback.h:746
typename std::tuple_element< arg_idx, Args_tuple >::type Arg_type
Get type of the specified argument.
Definition: callback.h:231
Arg_ref_type< arg_idx > Get_arg()
Get reference to an argument at the specified position.
Definition: callback.h:777
Callback Callback_type
Type of target callback.
Definition: callback.h:96
Common preprocessor definitions.
Callback which can be executed.
Definition: callback.h:86
#define ASSERT(x)
No action in release.
Definition: debug.h:68
VSM exceptions definition.
callback_internal::Adapt_callable_type< Callable >::type callable
Callable entity from user.
Definition: callback.h:276
std::function< void(Args...)> Callable
Callable type.
Definition: callback.h:423
#define __UNUSED
Use with unused arguments if you like to declare that it is not (yet) used a the function.
Definition: defs.h:30
Base_type::template Ptr< Callback > Ptr
Callable pointer class type.
Definition: callback.h:309
constexpr void Callback_check_type()
Check if the specified callback type corresponds to the partial prototype.
Definition: callback.h:501
Result_t operator()()
Call the associated callback.
Definition: callback.h:108
Args_tuple args
User provided arguments pack.
Definition: callback.h:278
Callback(Callable &&callable, Args &&...args)
Construct callback instance.
Definition: callback.h:246
Arg_type< arg_idx > & Get_arg()
Get reference to an argument at the specified position.
Definition: callback.h:269
std::function< Result(Args...)> Callable
Callable type.
Definition: callback.h:404
Arg_type< arg_idx > & Get_arg()
Get reference to an argument at the specified position.
Definition: callback.h:355
static Ptr Create(Method method, Class_ptr &&obj_ptr, Args &&...args)
Create callback instance.
Definition: callback.h:324
Callback_base< typename std::result_of< Callable(Args...)>::type > Base_type
Base class type.
Definition: callback.h:218
Pointer class type.
Definition: callback.h:93
Base_type::template Ptr< Callback > Ptr
Callable pointer class type.
Definition: callback.h:220
Helper class for proxying callback invocation.
Definition: callback.h:694
Callback< Callable, void, Args...>::Ptr Make_callback(Callable &&callable, Args &&...args)
Create a callback.
Definition: callback.h:389
Callback_proxy(Callback_ptr cbk)
Constructs instance bound to the provided callback object.
Definition: callback.h:721
typename std::tuple_element< arg_idx, Args_ref_tuple >::type Arg_ref_type
Creates reference type to the argument with index arg_idx.
Definition: callback.h:710
static Callable Create()
Create callable object.
Definition: callback.h:429
Helper::template Callback_type< Forced_args_tuple > Callback_type
Resulted callback type.
Definition: callback.h:635
Callback< Callable, void, Args...> Callback_type
Resulted callback type.
Definition: callback.h:425
virtual Base_type::Result_t operator()() override
Execute callback.
Definition: callback.h:256
typename std::tuple_element< arg_idx, Args_tuple >::type Arg_type
Get type of the specified argument.
Definition: callback.h:320
Result operator()(Invoke_args &&...invoke_args) const
Invoke the callback with the specified first arguments.
Definition: callback.h:738
Callback::template Arg_type< idx > Cbk_arg
Corresponding real argument type in the callback.
Definition: callback.h:469
Callback::template Arg_type< idx > Cbk_arg
Corresponding real argument type in the callback.
Definition: callback.h:480
Callback< Callable, void, Args...> Callback_type
Resulted callback type.
Definition: callback.h:406
Helper class for defining custom callback creation functions which force several first arguments for ...
Definition: callback.h:628
bool operator!=(const Callback_proxy &other) const
Non-equality operator.
Definition: callback.h:812
Callback proxy hasher based on referenced callback.
Definition: callback.h:818
static Ptr Create(Callable &&callable, Args &&...args)
Create callback instance.
Definition: callback.h:235
Generic callback.
Definition: callback.h:213
Callback_ptr Get_callback()
Get the associated callback.
Definition: callback.h:753
Callback_base< typename std::result_of< Method(Class_ptr, Args...)>::type > Base_type
Base class type.
Definition: callback.h:307
Callback(Method method, Class_ptr &&obj_ptr, Args &&...args)
Constructor for class method bound callback.
Definition: callback.h:332
callback_internal::Dummy_callback_helper< Result, Args...>::Callback_type::Ptr Make_dummy_callback()
Create dummy callback.
Definition: callback.h:446
Ptr(Args &&...args)
Constructor accepts the same arguments as std::shared_ptr.
Definition: callback.h:100
#define VSM_EXCEPTION(__exc_class, __msg,...)
Throw VSM exception instance.
Definition: exception.h:168
Callback_proxy()=default
Default constructor creates unbound instance.
typename std::tuple_element< arg_idx, Args_ptr_tuple >::type Arg_ptr_type
Creates pointer type to the argument with index arg_idx.
Definition: callback.h:714
virtual Base_type::Result_t operator()() override
Execute callback.
Definition: callback.h:342
T value
Stored value (in wire byte order).
Definition: endian.h:356
callback_internal::Callback_forced_args_helper< Callable, void, Args...> Helper
Helper type.
Definition: callback.h:633
size_t operator()(const Callback_proxy &proxy) const
Hash value operator.
Definition: callback.h:822