OSVR-Core
Public Member Functions | List of all members
osvr::pluginhost::PluginSpecificRegistrationContextImpl Class Reference

Internal class backing the context of registrations performed by a single plugin. More...

#include <PluginSpecificRegistrationContextImpl.h>

Inheritance diagram for osvr::pluginhost::PluginSpecificRegistrationContextImpl:
osvr::pluginhost::PluginSpecificRegistrationContext

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 RegistrationContextgetParent ()
 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 &params=std::string()) const
 Call a driver instantiation callback for the given driver name. More...
 
virtual util::AnyMapdata ()
 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...
 
- Public Member Functions inherited from osvr::pluginhost::PluginSpecificRegistrationContext
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 >
TregisterDataWithGenericDelete (T *data)
 Register data allocated with new to be deleted on plugin unload. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from osvr::pluginhost::PluginSpecificRegistrationContext
static OSVR_PLUGINHOST_EXPORT PluginRegPtr create (std::string const &name)
 Factory function that creates a plugin-specific registration context. More...
 
static OSVR_PLUGINHOST_EXPORT PluginSpecificRegistrationContextget (OSVR_PluginRegContext ctx)
 Retrieve this interface from an OSVR_PluginRegContext opaque pointer. More...
 
- Protected Member Functions inherited from osvr::pluginhost::PluginSpecificRegistrationContext
 PluginSpecificRegistrationContext (std::string const &name)
 Constructor for derived class use only.
 

Detailed Description

Internal class backing the context of registrations performed by a single plugin.

Constructor & Destructor Documentation

§ ~PluginSpecificRegistrationContextImpl()

osvr::pluginhost::PluginSpecificRegistrationContextImpl::~PluginSpecificRegistrationContextImpl ( )

Destructor.

Responsible for destroying plugin data in reverse order.

Member Function Documentation

§ getParent() [1/2]

RegistrationContext & osvr::pluginhost::PluginSpecificRegistrationContextImpl::getParent ( )
virtual

Get parent registration context.

Exceptions
std::logic_errorif called when no parent is yet set.

Implements osvr::pluginhost::PluginSpecificRegistrationContext.

§ getParent() [2/2]

RegistrationContext const & osvr::pluginhost::PluginSpecificRegistrationContextImpl::getParent ( ) const
virtual

Get parent registration context.

Exceptions
std::logic_errorif called when no parent is yet set.

Implements osvr::pluginhost::PluginSpecificRegistrationContext.

§ instantiateDriver()

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.

Exceptions
std::runtime_errorif there is no driver registered by that name in the given plugin, or if the callback returns failure.

§ registerDataWithDeleteCallback()

void osvr::pluginhost::PluginSpecificRegistrationContextImpl::registerDataWithDeleteCallback ( OSVR_PluginDataDeleteCallback  deleteCallback,
void *  pluginData 
)
virtual

Register data and a delete callback to be called on plugin unload.

Implements osvr::pluginhost::PluginSpecificRegistrationContext.

§ registerDriverInstantiationCallback()

void osvr::pluginhost::PluginSpecificRegistrationContextImpl::registerDriverInstantiationCallback ( const char *  name,
OSVR_DriverInstantiationCallback  constructor,
void *  userData 
)
virtual

Register a callback for constructing a driver by name with parameters.

Parameters
nameDriver type name - must be non-empty and unique within this plugin.
constructorThe callback function.
userDataOptional opaque pointer to pass to callback
Exceptions
std::logic_errorif name is empty or already used within this plugin.

Implements osvr::pluginhost::PluginSpecificRegistrationContext.

§ registerHardwareDetectCallback()

void osvr::pluginhost::PluginSpecificRegistrationContextImpl::registerHardwareDetectCallback ( OSVR_HardwareDetectCallback  detectCallback,
void *  userData 
)
virtual

Register a callback to be invoked on some hardware detection event.

Implements osvr::pluginhost::PluginSpecificRegistrationContext.

§ setParent()

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.

Exceptions
std::logic_errorif called when a different parent is already set.

§ takePluginHandle()

void osvr::pluginhost::PluginSpecificRegistrationContextImpl::takePluginHandle ( libfunc::PluginHandle &  handle)

Assume ownership of the plugin handle keeping the plugin library loaded.

§ triggerHardwareDetectCallbacks()

void osvr::pluginhost::PluginSpecificRegistrationContextImpl::triggerHardwareDetectCallbacks ( )

Call all hardware detect callbacks registered by this plugin, if any.


The documentation for this class was generated from the following files: