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  using Result_t = Result;
90 
92  template <class Callback = Callback_base>
93  class Ptr: public std::shared_ptr<Callback> {
94 
95  public:
98 
100  template <typename... Args>
101  Ptr(Args &&... args):
102  std::shared_ptr<Callback_type>(std::forward<Args>(args)...)
103  {}
104 
108  Result_t
110  {
111  if (!std::shared_ptr<Callback_type>::get()) {
112  VSM_EXCEPTION(Nullptr_exception,
113  "Attempted to invoke empty callback");
114  }
115  return (*std::shared_ptr<Callback_type>::get())();
116  }
117  };
118 
120  virtual Result_t
121  operator()() = 0;
122 
123  virtual
124  ~Callback_base() = default;
125 };
126 
127 #ifndef NO_DOXYGEN
128 
129 namespace callback_internal {
130 
134 template <int...>
135 struct Sequence
136 {};
137 
141 template<int n, int... s>
142 struct Sequence_generator: Sequence_generator<n - 1, n - 1, s...>
143 {};
144 
146 template<int... s>
147 struct Sequence_generator<0, s...>
148 {
150  using Sequence_type = Sequence<s...>;
151 };
152 
156 template <typename T>
157 struct Adapt_arg_type {
159  using type = typename std::remove_cv<typename std::remove_reference<T>::type>::type;
160 };
161 
163 template <size_t size>
164 struct Adapt_arg_type<const char (&)[size]> {
166  using type = const char *;
167 };
168 
172 template <typename T, typename Enable = void>
173 struct Adapt_callable_type {
175  using type = typename std::remove_cv<typename std::remove_reference<T>::type>::type;
176 };
177 
179 template <typename F>
180 struct Adapt_callable_type<F,
181  typename std::enable_if<
182  std::is_function<
183  typename std::remove_reference<F>::type>::value>::type> {
185  using type = F;
186 };
187 
190 template <class Method>
191 struct Is_method_ptr_type {
192  static constexpr bool value =
193  std::is_member_function_pointer<typename callback_internal::Adapt_callable_type<Method>::type>::value;
194 };
195 
197 template <class Method>
198 constexpr bool
199 Is_method_ptr()
200 {
202 }
203 
204 } /* namespace callback_internal */
205 #endif
206 
216 template <class Callable, class Enable, typename... Args>
217 class Callback:
218  public Callback_base<typename std::result_of<Callable(Args...)>::type> {
219 public:
221  using Base_type = Callback_base<typename std::result_of<Callable(Args...)>::type>;
223  using Ptr = typename Base_type::template Ptr<Callback>;
224 
225 private:
227  typedef std::tuple<typename callback_internal::Adapt_arg_type<Args>::type...> Args_tuple;
228 
229 public:
233  template <size_t arg_idx>
234  using Arg_type = typename std::tuple_element<arg_idx, Args_tuple>::type;
235 
237  static Ptr
238  Create(Callable &&callable, Args &&... args)
239  {
240  return std::make_shared<Callback>(std::forward<Callable>(callable),
241  std::forward<Args>(args)...);
242  }
243 
249  Callback(Callable &&callable, Args &&... args):
250  callable(std::forward<Callable>(callable)),
251  args(std::forward<Args>(args)...)
252  {}
253 
255  Callback(Callback &&) = default;
256 
258  virtual typename Base_type::Result_t
259  operator()() override
260  {
261  return Invoke(typename callback_internal::Sequence_generator
262  <sizeof...(Args)>::Sequence_type());
263  }
264 
270  template <size_t arg_idx>
271  Arg_type<arg_idx> &
273  {
274  return std::get<arg_idx>(args);
275  }
276 
277 protected:
279  typename callback_internal::Adapt_callable_type<Callable>::type callable;
281  Args_tuple args;
282 
284  template <int... s>
285  typename Base_type::Result_t
286  Invoke(callback_internal::Sequence<s...>)
287  {
288  return callable(std::get<s>(args)...);
289  }
290 };
291 
302 template <class Method, class Class_ptr, typename... Args>
303 class Callback<Method,
304  typename std::enable_if<callback_internal::Is_method_ptr<Method>()>::type,
305  Class_ptr, Args...>:
306  public Callback_base<typename std::result_of<Method(Class_ptr, Args...)>::type> {
307 public:
309  using Base_type = Callback_base<typename std::result_of<Method(Class_ptr, Args...)>::type>;
311  using Ptr = typename Base_type::template Ptr<Callback>;
312 
313 private:
315  typedef std::tuple<typename callback_internal::Adapt_arg_type<Args>::type...> Args_tuple;
316 
317 public:
321  template <size_t arg_idx>
322  using Arg_type = typename std::tuple_element<arg_idx, Args_tuple>::type;
323 
325  static Ptr
326  Create(Method method, Class_ptr &&obj_ptr, Args &&... args)
327  {
328  return std::make_shared<Callback>(method,
329  std::forward<Class_ptr>(obj_ptr),
330  std::forward<Args>(args)...);
331  }
332 
334  Callback(Method method, Class_ptr &&obj_ptr, Args &&... args):
335  obj_ptr(std::forward<Class_ptr>(obj_ptr)), method(method),
336  args(std::forward<Args>(args)...)
337  {}
338 
340  Callback(Callback &&) = default;
341 
343  virtual typename Base_type::Result_t
344  operator()() override
345  {
346  return Invoke(typename callback_internal::Sequence_generator
347  <sizeof...(Args)>::Sequence_type());
348  }
349 
355  template <size_t arg_idx>
356  Arg_type<arg_idx> &
358  {
359  return std::get<arg_idx>(args);
360  }
361 
362 private:
364  typename std::remove_reference<Class_ptr>::type obj_ptr;
366  typename callback_internal::Adapt_callable_type<Method>::type method;
368  Args_tuple args;
369 
371  template <int... s>
372  typename Base_type::Result_t
373  Invoke(callback_internal::Sequence<s...>)
374  {
375  return ((*obj_ptr).*method)(std::get<s>(args)...);
376  }
377 };
378 
389 template <class Callable, typename... Args>
390 typename Callback<Callable, void, Args...>::Ptr
391 Make_callback(Callable &&callable, Args&& ...args)
392 {
393  return Callback<Callable,
394  void,
395  Args...>::Create
396  (std::forward<Callable>(callable), std::forward<Args>(args)...);
397 }
398 
399 namespace callback_internal {
400 
402 template <class Result, typename... Args>
404 public:
406  using Callable = std::function<Result(Args...)>;
408  using Callback_type = Callback<Callable, void, Args...>;
409 
411  static Callable
413  {
414  return [](Args __UNUSED... args) {
415  return Result();
416  };
417  }
418 };
419 
421 template <typename... Args>
422 class Dummy_callback_helper<void, Args...> {
423 public:
425  using Callable = std::function<void(Args...)>;
427  using Callback_type = Callback<Callable, void, Args...>;
428 
430  static Callable
432  {
433  return [](Args __UNUSED... args) {};
434  }
435 };
436 
437 } /* namespace callback_internal */
438 
446 template <class Result, typename... Args>
447 typename callback_internal::Dummy_callback_helper<Result, Args...>::Callback_type::Ptr
449 {
450  using Helper = callback_internal::Dummy_callback_helper<Result, Args...>;
451  return Make_callback<typename Helper::Callable>(Helper::Create(), Args()...);
452 }
453 
454 namespace callback_internal {
455 
457 template <class Callback, size_t idx, typename... Args>
459 
461 template <class Callback>
464  constexpr static bool value = true;
465 };
466 
468 template <class Callback, size_t idx, typename Arg>
469 struct Callback_args_checker<Callback, idx, Arg> {
471  using Cbk_arg = typename Callback::template Arg_type<idx>;
474 
475  static_assert(value, "Argument type mismatch");
476 };
477 
479 template <class Callback, size_t idx, typename Arg, typename... Args>
480 struct Callback_args_checker<Callback, idx, Arg, Args...> {
482  using Cbk_arg = typename Callback::template Arg_type<idx>;
485  Callback_args_checker<Callback, idx + 1, Args...>::value;
486 
487  static_assert(value, "Argument type mismatch");
488 };
489 
490 } /* namespace callback_internal */
491 
501 template <class Callback_ptr, typename Result, typename... Args>
502 constexpr void
504 {
505  using Callback = typename std::remove_reference<decltype(*std::declval<Callback_ptr>())>::type;
506 
507  /* Check result type. */
509  "Callback result value type mismatch");
510  /* Check argument types. */
512  "Arguments type mismatch");
513 }
514 
515 
516 #ifndef NO_DOXYGEN
517 namespace callback_internal {
518 
525 template <class Callable, typename Enable, typename... Args>
526 class Callback_forced_args_helper {
527 public:
528  template <typename... Forced_args>
529  static typename Callback<Callable, void, Forced_args..., Args...>::Ptr
530  Create(Callable &&callable, std::tuple<Forced_args...> &&forced_args,
531  Args &&... args)
532  {
533  return Create_impl<decltype(forced_args)>(
534  std::forward<Callable>(callable),
535  std::tuple_cat(std::forward<std::tuple<Forced_args...>>(forced_args),
536  std::forward_as_tuple(std::forward<Args>(args)...)),
537  typename callback_internal::Sequence_generator<sizeof...(Forced_args) + sizeof...(Args)>::Sequence_type());
538  }
539 
541  template <class Forced_args_tuple>
542  using Callback_ptr = decltype(Callback_forced_args_helper::Create(
543  std::declval<Callable>(),
544  std::declval<Forced_args_tuple>(),
545  std::declval<Args>()...));
546 
547  template <class Forced_args_tuple>
548  using Callback_type = decltype(*std::declval<Callback_ptr<Forced_args_tuple>>());
549 
550 private:
551  template <class Forced_args_tuple, class All_args_tuple, int... args_seq>
552  static Callback_ptr<Forced_args_tuple>
553  Create_impl(Callable &&callable, All_args_tuple &&all_args_tuple,
554  callback_internal::Sequence<args_seq...>)
555  {
556  return Make_callback(
557  std::forward<Callable>(callable),
558  std::forward<typename std::tuple_element<args_seq, All_args_tuple>::type>
559  (std::get<args_seq>(all_args_tuple))...);
560  }
561 };
562 
564 template <class Method, class Class_ptr, typename... Args>
565 class Callback_forced_args_helper<
566  Method,
567  typename std::enable_if<callback_internal::Is_method_ptr<Method>()>::type,
568  Class_ptr, Args...> {
569 public:
570  template <typename... Forced_args>
571  static typename Callback<Method, void, Class_ptr, Forced_args..., Args...>::Ptr
572  Create(Method &&method, std::tuple<Forced_args...> &&forced_args,
573  Class_ptr &&class_ptr, Args &&... args)
574  {
575  return Create_impl<decltype(forced_args)>(
576  std::forward<Method>(method),
577  std::tuple_cat(std::forward_as_tuple(std::forward<Class_ptr>(class_ptr)),
578  std::forward<std::tuple<Forced_args...>>(forced_args),
579  std::forward_as_tuple(std::forward<Args>(args)...)),
580  typename callback_internal::Sequence_generator<
581  1 + sizeof...(Forced_args) + sizeof...(Args)>::Sequence_type());
582  }
583 
585  template <class Forced_args_tuple>
586  using Callback_ptr = decltype(Callback_forced_args_helper::Create(
587  std::declval<Method>(),
588  std::declval<Forced_args_tuple>(),
589  std::declval<Class_ptr>(),
590  std::declval<Args>()...));
591 
592 private:
593  template <class Forced_args_tuple, class All_args_tuple, int... args_seq>
594  static Callback_ptr<Forced_args_tuple>
595  Create_impl(Method &&method, All_args_tuple &&all_args_tuple,
596  callback_internal::Sequence<args_seq...>)
597  {
598  return Make_callback(
599  std::forward<Method>(method),
600  std::forward<typename std::tuple_element<args_seq, All_args_tuple>::type>
601  (std::get<args_seq>(all_args_tuple))...);
602  }
603 };
604 
605 } /* namespace callback_internal */
606 #endif
607 
608 
632 template <class Callable, class Forced_args_tuple, typename... Args>
634  public callback_internal::Callback_forced_args_helper<Callable, void, Args...>::
635  template Callback_ptr<Forced_args_tuple> {
636 public:
638  using Helper = callback_internal::Callback_forced_args_helper<Callable, void, Args...>;
640  using Callback_ptr = typename Helper::template Callback_ptr<Forced_args_tuple>;
641 
651  static Callback_ptr
652  Create(Callable &&callable, Forced_args_tuple &&forced_args_tuple,
653  Args &&... args)
654  {
655  return Helper::Create(std::forward<Callable>(callable),
656  std::forward<Forced_args_tuple>(forced_args_tuple),
657  std::forward<Args>(args)...);
658  }
659 };
660 
661 namespace internal {
662 
666 template <class Ptr_tuple, size_t arg_idx>
667 void
668 Assign_ptr_tuple_impl(Ptr_tuple &tuple __UNUSED)
669 {}
670 
672 template <class Ptr_tuple, size_t arg_idx, typename Arg, typename... Args>
673 void
674 Assign_ptr_tuple_impl(Ptr_tuple &tuple, Arg &&arg, Args &&... args)
675 {
676  *std::get<arg_idx>(tuple) = std::forward<Arg>(arg);
677  Assign_ptr_tuple_impl<Ptr_tuple, arg_idx + 1, Args...>
678  (tuple, std::forward<Args>(args)...);
679 }
680 
683 template <class Ptr_tuple, typename... Args>
684 void
685 Assign_ptr_tuple(Ptr_tuple &tuple, Args &&... args)
686 {
687  Assign_ptr_tuple_impl<Ptr_tuple, 0, Args...>(tuple, std::forward<Args>(args)...);
688 }
689 
690 } /* namespace internal */
691 
698 template <class Result, typename... Args>
700 public:
704  using Callback_ptr = typename Callback_type::template Ptr<>;
705 
706 private:
708  using Args_ref_tuple = std::tuple<typename std::add_lvalue_reference<Args>::type...>;
710  using Args_ptr_tuple = std::tuple<typename std::add_pointer<Args>::type...> ;
711 
712 public:
714  template <size_t arg_idx>
715  using Arg_ref_type = typename std::tuple_element<arg_idx, Args_ref_tuple>::type;
716 
718  template <size_t arg_idx>
719  using Arg_ptr_type = typename std::tuple_element<arg_idx, Args_ptr_tuple>::type;
720 
722  Callback_proxy() = default;
723 
725  template <class Callback_ptr>
727  cbk(cbk), args_ptr(Get_args_ptr_tuple(cbk, Args_seq()))
728  {
729  Callback_check_type<Callback_ptr, Result, Args...>();
730  }
731 
733  template <typename... Invoke_args>
734  void
735  Set_args(Invoke_args &&... invoke_args) const
736  {
737  internal::Assign_ptr_tuple(args_ptr, std::forward<Invoke_args>(invoke_args)...);
738  }
739 
741  template <typename... Invoke_args>
742  Result
743  operator()(Invoke_args &&... invoke_args) const
744  {
745  Set_args<Invoke_args...>(std::forward<Invoke_args>(invoke_args)...);
746  return Invoke();
747  }
748 
750  Result
751  Invoke() const
752  {
753  return cbk();
754  }
755 
759  {
760  return cbk;
761  }
762 
764  explicit operator bool() const
765  {
766  return cbk != nullptr;
767  }
768 
770  operator Callback_ptr()
771  {
772  return cbk;
773  }
774 
780  template <size_t arg_idx>
781  Arg_ref_type<arg_idx>
783  {
784  /*
785  * Proxy should be bound to be able to access arguments.
786  * In release build the code will anyway crash somewhere else.
787  */
788  ASSERT(*this);
789  return *std::get<arg_idx>(args_ptr);
790  }
791 
797  template <size_t arg_idx, typename Arg_type>
798  void
799  Set_arg(Arg_type &&arg)
800  {
801  Get_arg<arg_idx>() = std::forward<Arg_type>(arg);
802  }
803 
807  bool
808  operator ==(const Callback_proxy& other) const
809  {
810  return other.cbk == cbk;
811  }
812 
816  bool
817  operator !=(const Callback_proxy& other) const
818  {
819  return other.cbk != cbk;
820  }
821 
823  class Hasher {
824  public:
826  size_t
827  operator()(const Callback_proxy& proxy) const
828  {
829  static std::hash<decltype(proxy.cbk.get())> hasher;
830 
831  return hasher(proxy.cbk.get());
832  }
833  };
834 
835 private:
837  using Args_seq = typename callback_internal::Sequence_generator<sizeof...(Args)>::Sequence_type;
838 
840  mutable Callback_ptr cbk;
842  Args_ptr_tuple args_ptr;
843 
847  template <class Callback_ptr, int... args_seq>
848  static Args_ptr_tuple
849  Get_args_ptr_tuple(Callback_ptr cbk, callback_internal::Sequence<args_seq...>)
850  {
851  return Args_ptr_tuple(&cbk->template Get_arg<args_seq>()...);
852  }
853 };
854 
855 } /* namespace vsm */
856 } /* namespace ugcs */
857 
858 #endif /* _UGCS_VSM_CALLBACK_H_ */
bool operator==(const Callback_proxy &other) const
Equality operator.
Definition: callback.h:808
static Callable Create()
Create callable object.
Definition: callback.h:412
Helper structure for checking callback argument types.
Definition: callback.h:458
void Set_arg(Arg_type &&arg)
Set argument value at the specified position.
Definition: callback.h:799
void Set_args(Invoke_args &&...invoke_args) const
Set arguments values for callback invocation.
Definition: callback.h:735
Base_type::Result_t Invoke(callback_internal::Sequence< s...>)
Invoke callable entity with user provided arguments.
Definition: callback.h:286
virtual Result_t operator()()=0
Execute callback.
callback_internal::Callback_forced_args_helper< Callable, void, Args...> Helper
Helper type.
Definition: callback.h:638
Debugging and troubleshooting helpers.
Helper class for creating dummy callbacks.
Definition: callback.h:403
Result Invoke() const
Invoke the callback with the previously set argument values.
Definition: callback.h:751
typename std::tuple_element< arg_idx, Args_tuple >::type Arg_type
Get type of the specified argument.
Definition: callback.h:234
Arg_ref_type< arg_idx > Get_arg()
Get reference to an argument at the specified position.
Definition: callback.h:782
Common preprocessor definitions.
Callback which can be executed.
Definition: callback.h:86
std::function< Result(Args...)> Callable
Callable type.
Definition: callback.h:406
#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:279
#define __UNUSED
Use with unused arguments if you like to declare that it is not (yet) used a the function.
Definition: defs.h:30
constexpr void Callback_check_type()
Check if the specified callback type corresponds to the partial prototype.
Definition: callback.h:503
Result_t operator()()
Call the associated callback.
Definition: callback.h:109
Args_tuple args
User provided arguments pack.
Definition: callback.h:281
Callback(Callable &&callable, Args &&...args)
Construct callback instance.
Definition: callback.h:249
Arg_type< arg_idx > & Get_arg()
Get reference to an argument at the specified position.
Definition: callback.h:272
typename Callback_type::template Ptr<> Callback_ptr
Pointer to the underlying callback object.
Definition: callback.h:704
Arg_type< arg_idx > & Get_arg()
Get reference to an argument at the specified position.
Definition: callback.h:357
static Ptr Create(Method method, Class_ptr &&obj_ptr, Args &&...args)
Create callback instance.
Definition: callback.h:326
Pointer class type.
Definition: callback.h:93
Helper class for proxying callback invocation.
Definition: callback.h:699
Callback< Callable, void, Args...>::Ptr Make_callback(Callable &&callable, Args &&...args)
Create a callback.
Definition: callback.h:391
Callback_proxy(Callback_ptr cbk)
Constructs instance bound to the provided callback object.
Definition: callback.h:726
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:715
static Callable Create()
Create callable object.
Definition: callback.h:431
std::function< void(Args...)> Callable
Callable type.
Definition: callback.h:425
typename Base_type::template Ptr< Callback > Ptr
Callable pointer class type.
Definition: callback.h:223
typename Helper::template Callback_ptr< Forced_args_tuple > Callback_ptr
Resulted callback type.
Definition: callback.h:640
typename Callback::template Arg_type< idx > Cbk_arg
Corresponding real argument type in the callback.
Definition: callback.h:482
virtual Base_type::Result_t operator()() override
Execute callback.
Definition: callback.h:259
typename std::tuple_element< arg_idx, Args_tuple >::type Arg_type
Get type of the specified argument.
Definition: callback.h:322
Result operator()(Invoke_args &&...invoke_args) const
Invoke the callback with the specified first arguments.
Definition: callback.h:743
Helper class for defining custom callback creation functions which force several first arguments for ...
Definition: callback.h:633
bool operator!=(const Callback_proxy &other) const
Non-equality operator.
Definition: callback.h:817
Callback proxy hasher based on referenced callback.
Definition: callback.h:823
static Ptr Create(Callable &&callable, Args &&...args)
Create callback instance.
Definition: callback.h:238
Generic callback.
Definition: callback.h:217
Callback_ptr Get_callback()
Get the associated callback.
Definition: callback.h:758
Callback(Method method, Class_ptr &&obj_ptr, Args &&...args)
Constructor for class method bound callback.
Definition: callback.h:334
callback_internal::Dummy_callback_helper< Result, Args...>::Callback_type::Ptr Make_dummy_callback()
Create dummy callback.
Definition: callback.h:448
static Callback_ptr Create(Callable &&callable, Forced_args_tuple &&forced_args_tuple, Args &&...args)
Create callback with forced first arguments.
Definition: callback.h:652
Ptr(Args &&...args)
Constructor accepts the same arguments as std::shared_ptr.
Definition: callback.h:101
typename Base_type::template Ptr< Callback > Ptr
Callable pointer class type.
Definition: callback.h:311
#define VSM_EXCEPTION(__exc_class, __msg,...)
Throw VSM exception instance.
Definition: exception.h:168
Callback_proxy()=default
Default constructor creates unbound instance.
std::result_of< Callable(Args...)>::type Result_t
Result type.
Definition: callback.h:89
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:719
virtual Base_type::Result_t operator()() override
Execute callback.
Definition: callback.h:344
T value
Stored value (in wire byte order).
Definition: endian.h:376
size_t operator()(const Callback_proxy &proxy) const
Hash value operator.
Definition: callback.h:827
typename Callback::template Arg_type< idx > Cbk_arg
Corresponding real argument type in the callback.
Definition: callback.h:471