25 #ifndef INCLUDED_CommonComponent_h_GUID_199AFD54_3489_4295_30F9_00B7CE33FE31
26 #define INCLUDED_CommonComponent_h_GUID_199AFD54_3489_4295_30F9_00B7CE33FE31
47 OSVR_COMMON_EXPORT
static const char *
identifier();
51 OSVR_COMMON_EXPORT
static const char *
identifier();
56 OSVR_COMMON_EXPORT
static const char *identifier();
61 OSVR_COMMON_EXPORT
static const char *identifier();
66 OSVR_COMMON_EXPORT
static const char *identifier();
71 OSVR_COMMON_EXPORT
static const char *identifier();
88 static OSVR_COMMON_EXPORT shared_ptr<CommonComponent>
create();
90 typedef std::function<void()> Handler;
109 template <
typename T>
111 Handler
const &handler) {
112 auto &handlers = typepack::get<T>(m_handlers);
113 m_registerHandlerImpl(handlers, message.getMessageType(), handler);
118 void m_parentSet()
override;
120 using HandlerList = std::vector<Handler>;
121 OSVR_COMMON_EXPORT
void
122 m_registerHandlerImpl(HandlerList &handlers,
124 Handler
const &handler);
126 static int VRPN_CALLBACK m_baseHandler(
void *userdata,
130 std::vector<Handler>> m_handlers;
135 #endif // INCLUDED_CommonComponent_h_GUID_199AFD54_3489_4295_30F9_00B7CE33FE31
static shared_ptr< CommonComponent > create()
Factory method.
static const char * identifier()
A wrapper for a template parameter pack of types.
static const char * identifier()
A class that uses types as an index into a container with uniform-typed contents, somewhat like a map...
BaseDevice component, for the VRPN built-in common messages.
Header with a run-time extensions to the TypePack simple template-parameter-pack-based metaprogrammin...
void registerPongHandler(Handler const &handler)
Register a pong handler: a pong replies to a ping, and is sent from a server device to the correspond...
CRTP class template wrapping message-specific data and/or logic.
void registerPingHandler(Handler const &handler)
Register a ping handler: a ping is sent from a client device to the corresponding server device upon ...
Automatically-generated export header - do not edit!
Type-safe wrapper with built-in default for a VRPN "message type" integer.