OSVR-Core
Namespaces | Functions
Plugin Registration (C++ wrappers)

How to start writing a plugin and advertise your capabilities to the core library. More...

Namespaces

 osvr::pluginkit::detail
 Internal implementation-only namespace.
 

Functions

template<typename T >
Tosvr::pluginkit::registerObjectForDeletion (OSVR_PluginRegContext ctx, T *obj)
 Registers an object to be destroyed with delete when the plugin is unloaded. More...
 
template<typename T >
void osvr::pluginkit::registerHardwareDetectCallback (OSVR_PluginRegContext ctx, T functor)
 Registers a function object to be called when the core requests a hardware detection. More...
 
template<typename T >
void osvr::pluginkit::registerDriverInstantiationCallback (OSVR_PluginRegContext ctx, const char driverName[], T functor)
 Registers a function object to be called when the server is told to instantiate a driver by name with parameters. More...
 

Detailed Description

How to start writing a plugin and advertise your capabilities to the core library.

Function Documentation

§ registerDriverInstantiationCallback()

template<typename T >
void osvr::pluginkit::registerDriverInstantiationCallback ( OSVR_PluginRegContext  ctx,
const char  driverName[],
T  functor 
)
inline

Registers a function object to be called when the server is told to instantiate a driver by name with parameters.

Your callback should take a parameter of type OSVR_PluginRegContext and a parameter of type const char * (the JSON parameters as a string) and return a value of type ::OSVR_ReturnCode

Also provides for deletion of the function object.

Parameters
ctxThe registration context passed to your entry point.
driverNameThe driver name you're advertising.
functorAn function object (with operator() defined). Pass either a pointer, which will transfer ownership, or an object by value, which will result in a copy being made.
See also
PluginContext::registerDriverInstantiationCallback

§ registerHardwareDetectCallback()

template<typename T >
void osvr::pluginkit::registerHardwareDetectCallback ( OSVR_PluginRegContext  ctx,
T  functor 
)
inline

Registers a function object to be called when the core requests a hardware detection.

Your callback should take one parameter of type OSVR_PluginRegContext and return a value of type ::OSVR_ReturnCode

Also provides for deletion of the function object.

Parameters
ctxThe registration context passed to your entry point.
functorAn function object (with operator() defined). Pass either a pointer, which will transfer ownership, or an object by value, which will result in a copy being made.
See also
PluginContext::registerHardwareDetectCallback

§ registerObjectForDeletion()

template<typename T >
T* osvr::pluginkit::registerObjectForDeletion ( OSVR_PluginRegContext  ctx,
T obj 
)
inline

Registers an object to be destroyed with delete when the plugin is unloaded.

The template parameter does not need to be specified - it is deduced automatically.

The plugin remains nominally the owner of the object, but your code should no longer concern itself with the destruction of this object. Thus, if you have it in a smart pointer of any kind, release it from that pointer when you pass it to your function.

Parameters
ctxThe registration context passed to your entry point.
objA pointer to your object to register for deletion.

Internally uses osvrPluginRegisterDataWithDeleteCallback()