OSVR-Core
|
Internal class backing the context of registrations performed by a single plugin. More...
#include <PluginSpecificRegistrationContextImpl.h>
Public Member Functions | |
PluginSpecificRegistrationContextImpl (std::string const &name) | |
Constructor. | |
~PluginSpecificRegistrationContextImpl () | |
Destructor. More... | |
void | takePluginHandle (libfunc::PluginHandle &handle) |
Assume ownership of the plugin handle keeping the plugin library loaded. More... | |
void | setParent (RegistrationContext &parent) |
Set parent registration context. More... | |
virtual RegistrationContext & | getParent () |
Get parent registration context. More... | |
virtual RegistrationContext const & | getParent () const |
Get parent registration context. More... | |
void | triggerHardwareDetectCallbacks () |
Call all hardware detect callbacks registered by this plugin, if any. More... | |
void | instantiateDriver (const std::string &driverName, const std::string ¶ms=std::string()) const |
Call a driver instantiation callback for the given driver name. More... | |
virtual util::AnyMap & | data () |
Access the data storage map. | |
virtual util::AnyMap const & | data () const |
Const access the data storage map. | |
Plugin API | |
Called by the C API wrappers in the plugin registration headers. | |
virtual void | registerDataWithDeleteCallback (OSVR_PluginDataDeleteCallback deleteCallback, void *pluginData) |
Register data and a delete callback to be called on plugin unload. More... | |
virtual void | registerHardwareDetectCallback (OSVR_HardwareDetectCallback detectCallback, void *userData) |
Register a callback to be invoked on some hardware detection event. More... | |
virtual void | registerDriverInstantiationCallback (const char *name, OSVR_DriverInstantiationCallback constructor, void *userData) |
Register a callback for constructing a driver by name with parameters. More... | |
![]() | |
OSVR_PLUGINHOST_EXPORT OSVR_PluginRegContext | extractOpaquePointer () |
Extracts the opaque pointer for this interface to send to C. | |
virtual OSVR_PLUGINHOST_EXPORT | ~PluginSpecificRegistrationContext () |
Destructor. | |
OSVR_PLUGINHOST_EXPORT const std::string & | getName () const |
Accessor for plugin name. | |
OSVR_PLUGINHOST_EXPORT void | log (util::log::LogLevel severity, const char *message) |
Log a message to the plugin-specific channel. More... | |
template<typename T > | |
T * | registerDataWithGenericDelete (T *data) |
Register data allocated with new to be deleted on plugin unload. More... | |
Additional Inherited Members | |
![]() | |
static OSVR_PLUGINHOST_EXPORT PluginRegPtr | create (std::string const &name) |
Factory function that creates a plugin-specific registration context. More... | |
static OSVR_PLUGINHOST_EXPORT PluginSpecificRegistrationContext & | get (OSVR_PluginRegContext ctx) |
Retrieve this interface from an OSVR_PluginRegContext opaque pointer. More... | |
![]() | |
PluginSpecificRegistrationContext (std::string const &name) | |
Constructor for derived class use only. | |
Internal class backing the context of registrations performed by a single plugin.
osvr::pluginhost::PluginSpecificRegistrationContextImpl::~PluginSpecificRegistrationContextImpl | ( | ) |
Destructor.
Responsible for destroying plugin data in reverse order.
|
virtual |
Get parent registration context.
std::logic_error | if called when no parent is yet set. |
Implements osvr::pluginhost::PluginSpecificRegistrationContext.
|
virtual |
Get parent registration context.
std::logic_error | if called when no parent is yet set. |
Implements osvr::pluginhost::PluginSpecificRegistrationContext.
void osvr::pluginhost::PluginSpecificRegistrationContextImpl::instantiateDriver | ( | const std::string & | driverName, |
const std::string & | params = std::string() |
||
) | const |
Call a driver instantiation callback for the given driver name.
std::runtime_error | if there is no driver registered by that name in the given plugin, or if the callback returns failure. |
|
virtual |
Register data and a delete callback to be called on plugin unload.
Implements osvr::pluginhost::PluginSpecificRegistrationContext.
|
virtual |
Register a callback for constructing a driver by name with parameters.
name | Driver type name - must be non-empty and unique within this plugin. |
constructor | The callback function. |
userData | Optional opaque pointer to pass to callback |
std::logic_error | if name is empty or already used within this plugin. |
Implements osvr::pluginhost::PluginSpecificRegistrationContext.
|
virtual |
Register a callback to be invoked on some hardware detection event.
Implements osvr::pluginhost::PluginSpecificRegistrationContext.
void osvr::pluginhost::PluginSpecificRegistrationContextImpl::setParent | ( | RegistrationContext & | parent | ) |
Set parent registration context.
Should usually called only by RegistrationContext, and only once. If called multiple times with the same parent, this is OK.
std::logic_error | if called when a different parent is already set. |
void osvr::pluginhost::PluginSpecificRegistrationContextImpl::takePluginHandle | ( | libfunc::PluginHandle & | handle | ) |
Assume ownership of the plugin handle keeping the plugin library loaded.
void osvr::pluginhost::PluginSpecificRegistrationContextImpl::triggerHardwareDetectCallbacks | ( | ) |
Call all hardware detect callbacks registered by this plugin, if any.