25 #ifndef INCLUDED_WrapCallback_h_GUID_4C52D585_7A4B_49BA_D069_B1F3B42E9896 26 #define INCLUDED_WrapCallback_h_GUID_4C52D585_7A4B_49BA_D069_B1F3B42E9896 41 template <
typename ReportType>
42 using WrappedCallbackFunction =
43 std::function<void(const OSVR_TimeValue *, const ReportType *)>;
45 template <
typename ReportType>
46 using WrappedCallbackPtr =
47 std::unique_ptr<WrappedCallbackFunction<ReportType>>;
48 template <
typename ReportType>
49 void callbackCaller(
void *userdata,
const OSVR_TimeValue *timestamp,
50 const ReportType *report) {
52 *
static_cast<WrappedCallbackFunction<ReportType> *
>(userdata);
59 template <
typename ReportType>
62 template <
typename ReportType>
63 inline CallbackType<ReportType> getCaller() {
64 return &callbackCaller<ReportType>;
67 template <
typename ReportType,
typename F>
68 inline std::pair<CallbackType<ReportType>,
69 WrappedCallbackPtr<ReportType>>
71 auto functor = WrappedCallbackPtr<ReportType>{
72 new WrappedCallbackFunction<ReportType>{std::forward<F>(f)}};
73 return std::make_pair(getCaller<ReportType>(), std::move(functor));
76 using detail::wrapCallback;
77 using detail::WrappedCallbackPtr;
81 #endif // INCLUDED_WrapCallback_h_GUID_4C52D585_7A4B_49BA_D069_B1F3B42E9896 The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
Definition: newuoa.h:1888
Header providing a C++ wrapper around TimeValueC.h.
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
Definition: TimeValueC.h:81
Definition: WrapCallback.h:55