25 #ifndef INCLUDED_VRPNDeviceRegistration_h_GUID_1D69B168_9B9C_47B9_A9F3_9A569E9710D2
26 #define INCLUDED_VRPNDeviceRegistration_h_GUID_1D69B168_9B9C_47B9_A9F3_9A569E9710D2
29 #include <osvr/VRPNServer/Export.h>
31 #include <osvr/PluginHost/PluginSpecificRegistrationContext.h>
42 class vrpn_Connection;
45 namespace vrpnserver {
46 class VRPNDeviceRegistration_impl;
52 static OSVR_ReturnCode callMainloop(
void *userdata) {
53 T *obj =
static_cast<T *
>(userdata);
59 class VRPNDeviceRegistration {
62 VRPNDeviceRegistration(VRPNDeviceRegistration
const &) =
delete;
64 VRPNDeviceRegistration &
65 operator=(VRPNDeviceRegistration
const &) =
delete;
68 OSVR_VRPNSERVER_EXPORT
71 OSVR_VRPNSERVER_EXPORT VRPNDeviceRegistration(
72 pluginhost::PluginSpecificRegistrationContext &context);
74 OSVR_VRPNSERVER_EXPORT ~VRPNDeviceRegistration();
87 OSVR_VRPNSERVER_EXPORT std::string
88 useDecoratedName(std::string
const &name);
99 template <
typename T> T *registerDevice(T *dev) {
101 m_ctx.extractOpaquePointer(), dev);
102 m_registerDevice(&detail::callMainloop<T>,
103 static_cast<void *>(dev));
118 template <
typename T>
119 T *constructAndRegisterDevice(std::string
const &name) {
122 return registerDevice(ret.release());
125 OSVR_VRPNSERVER_EXPORT
void
126 setDeviceDescriptor(std::string
const &jsonString);
129 OSVR_VRPNSERVER_EXPORT
void
131 pluginhost::PluginSpecificRegistrationContext &m_ctx;
132 unique_ptr<VRPNDeviceRegistration_impl> m_impl;
137 #endif // INCLUDED_VRPNDeviceRegistration_h_GUID_1D69B168_9B9C_47B9_A9F3_9A569E9710D2
Header providing C++ interface wrappers around functionality in PluginRegistrationC.h.
The main namespace for all C++ elements of the framework, internal and external.
Header to bring unique_ptr into the osvr namespace.
vrpn_Connection * getVRPNConnection(OSVR_PluginRegContext ctx)
Retrieves the vrpn_Connection pointer from an OSVR_PluginRegContext.
T * registerObjectForDeletion(OSVR_PluginRegContext ctx, T *obj)
Registers an object to be destroyed with delete when the plugin is unloaded.
#define OSVR_RETURN_SUCCESS
The "success" value for an OSVR_ReturnCode.
Header declaring the opaque plugin registration context type.
OSVR_EXTERN_C_BEGIN typedef void * OSVR_PluginRegContext
A context pointer passed in to your plugin's entry point and other locations of control flow transfer...
OSVR_ReturnCode(* OSVR_DeviceUpdateCallback)(void *userData)
Function type of a Device Update callback.