50 const char *VRPNGotFirstConnection::identifier() {
51 return "VRPN_Connection_Got_First_Connection";
53 const char *VRPNGotConnection::identifier() {
54 return "VRPN_Connection_Got_Connection";
56 const char *VRPNDroppedConnection::identifier() {
57 return "VRPN_Connection_Dropped_Connection";
59 const char *VRPNDroppedLastConnection::identifier() {
60 return "VRPN_Connection_Dropped_Last_Connection";
71 registerHandler(ping, handler);
76 registerHandler(pong, handler);
79 void CommonComponent::m_registerHandlerImpl(
81 Handler
const &handler) {
82 if (handlers.empty()) {
86 handlers.push_back(handler);
89 CommonComponent::CommonComponent() {}
90 void CommonComponent::m_parentSet() {
99 int CommonComponent::m_baseHandler(
void *userdata, vrpn_HANDLERPARAM) {
102 auto &handlers = *
static_cast<std::vector<Handler> *
>(userdata);
103 for (
auto const &cb : handlers) {
static shared_ptr< CommonComponent > create()
Factory method.
static const char * identifier()
static const char * identifier()
BaseDevice component, for the VRPN built-in common messages.
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...
void m_registerHandler(vrpn_MESSAGEHANDLER handler, void *userdata, RawMessageType const &msgType)
Registers a handler whose lifetime is tied to the lifetime of the component.
void registerPingHandler(Handler const &handler)
Register a ping handler: a ping is sent from a client device to the corresponding server device upon ...
Parent & m_getParent()
Gets the parent - only call if m_hasParent() is true.
Type-safe wrapper with built-in default for a VRPN "message type" integer.
void registerMessageType(MessageRegistration< T > &messageReg)
Call with a MessageRegistration object, and the message type will be registered and stored in the typ...