All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HfPluginRegistry Class Reference

Base class for registering Hydra plugins using the plug mechanism. More...

Inherited by HdRendererPluginRegistry.

Public Member Functions

HF_API void GetPluginDescs (HfPluginDescVector *plugins)
 Returns an ordered list of all registered plugins. More...
 
HF_API bool GetPluginDesc (const TfToken &pluginId, HfPluginDesc *desc)
 Returns the description for the given plugin id. More...
 
HF_API void AddPluginReference (HfPluginBase *plugin)
 Increment the reference count on an existing plugin. More...
 
HF_API void ReleasePlugin (HfPluginBase *plugin)
 Decrement the reference count on the plugin. More...
 
HF_API bool IsRegisteredPlugin (const TfToken &pluginId)
 Returns true if a plugin has been registered for the given id. More...
 
HF_API TfToken GetPluginId (const HfPluginBase *plugin) const
 

Protected Member Functions

HF_API HfPluginRegistry (const TfType &pluginBaseType)
 Constructs a Plugin Registry. More...
 
HF_API HfPluginBaseGetPlugin (const TfToken &pluginId)
 Returns the plugin from the given pluginId. More...
 

Static Protected Member Functions

template<typename T , typename PluginBaseType , typename... Bases>
static void Define ()
 Entry point for registering a types implementation. More...
 

Detailed Description

Base class for registering Hydra plugins using the plug mechanism.

It is expected that each plugin has a pluginfo.json file that contains a list of types, where each type provides a list of base classes, displayName and priority.

The priority is used to order plugins, with the plugin with the highest priority being at the front of the order. priority is a signed integer. In the event of two plugins having the same priority, the plugins are sorted alphabetically on the type name.

The plugin sorted to the front is used as the default plugin, when not specified.

Example:

{ "Types": { "CPPTypeName": { "bases": ["BaseTypeName"], "displayName": "Human Readable Name", "priority" : 0 } } }

Definition at line 69 of file pluginRegistry.h.

Constructor & Destructor Documentation

HF_API HfPluginRegistry ( const TfType pluginBaseType)
protected

Constructs a Plugin Registry.

pluginBaseType is the TfType of the class derived from HfPluginBase that provides the plugin API.

Member Function Documentation

HF_API void AddPluginReference ( HfPluginBase plugin)

Increment the reference count on an existing plugin.

void Define ( )
staticprotected

Entry point for registering a types implementation.

T is the plugin being registered. PluginBaseType is the HfPluginBase derived class that specifies the API (the same one the TfType is for in the constructor).

Bases optionally specifies other classes that T is derived from.

Definition at line 195 of file pluginRegistry.h.

HF_API HfPluginBase* GetPlugin ( const TfToken pluginId)
protected

Returns the plugin from the given pluginId.

The reference count on the plugin is automatically increased.

HF_API bool GetPluginDesc ( const TfToken pluginId,
HfPluginDesc desc 
)

Returns the description for the given plugin id.

The plugin may not be loaded or been actually created yet.

HF_API void GetPluginDescs ( HfPluginDescVector *  plugins)

Returns an ordered list of all registered plugins.

The plugins are ordered by priority then alphabetically

HF_API bool IsRegisteredPlugin ( const TfToken pluginId)

Returns true if a plugin has been registered for the given id.

The plugin may not be loaded or been actually created yet.

HF_API void ReleasePlugin ( HfPluginBase plugin)

Decrement the reference count on the plugin.

If the reference count get to 0, the plugin is freed.


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