11#ifndef O2_FRAMEWORK_CALLBACKREGISTRY_H_
12#define O2_FRAMEWORK_CALLBACKREGISTRY_H_
21template <
typename KeyT, KeyT _
id,
typename CallbackT>
23 using id = std::integral_constant<KeyT, _id>;
28template <
typename CallbackId,
typename... Args>
32 static constexpr std::size_t
size =
sizeof...(Args);
38 template <CallbackId ID,
typename U>
42 mStore[(
int)
ID].push_back(
reinterpret_cast<void*
>(
new CallbackType(std::forward<U>(cb))));
46 template <CallbackId
ID,
typename... TArgs>
50 static_assert(std::is_same_v<CallbackType, std::function<
void(TArgs...)>>,
"callback type mismatch");
53 auto cb =
reinterpret_cast<CallbackType*
>(
ptr);
57 (*cb)(std::forward<TArgs>(args)...);
void call(TArgs &&... args)
CallbackRegistry()=default
std::array< std::vector< void * >, size > CallbackStore
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
Defining PrimaryVertex explicitly as messageable.
typename pack_element< I, T >::type pack_element_t
std::integral_constant< KeyT, _id > id