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

#include <pluginRegistry.h>

+ Inheritance diagram for HfPluginRegistry:

Public Member Functions

HF_API void GetPluginDescs (HfPluginDescVector *plugins)
 
HF_API bool GetPluginDesc (const TfToken &pluginId, HfPluginDesc *desc)
 
HF_API void AddPluginReference (HfPluginBase *plugin)
 
HF_API void ReleasePlugin (HfPluginBase *plugin)
 
HF_API bool IsRegisteredPlugin (const TfToken &pluginId)
 
HF_API TfToken GetPluginId (const HfPluginBase *plugin) const
 

Protected Member Functions

HF_API HfPluginRegistry (const TfType &pluginBaseType)
 
virtual HF_API ~HfPluginRegistry ()
 
HF_API HfPluginBaseGetPlugin (const TfToken &pluginId)
 
virtual HF_API void _CollectAdditionalMetadata (const PlugRegistry &plugRegistry, const TfType &pluginType)
 

Static Protected Member Functions

template<typename T , typename PluginBaseType , typename... Bases>
static void Define ()
 

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 71 of file pluginRegistry.h.

Constructor & Destructor Documentation

HF_API HfPluginRegistry::HfPluginRegistry ( const TfType pluginBaseType)
protected

Constructs a Plugin Registry. pluginBaseType is the TfType of the class derived from HfPluginBase that provides the plugin API.

virtual HF_API HfPluginRegistry::~HfPluginRegistry ( )
protectedvirtual

Member Function Documentation

virtual HF_API void HfPluginRegistry::_CollectAdditionalMetadata ( const PlugRegistry plugRegistry,
const TfType pluginType 
)
protectedvirtual

Gives subclasses an opportunity to inspect plugInfo-based metadata at the time of discovery.

Reimplemented in HdSceneIndexPluginRegistry.

HF_API void HfPluginRegistry::AddPluginReference ( HfPluginBase plugin)

Increment the reference count on an existing plugin.

template<typename T , typename PluginBaseType , typename... Bases>
void HfPluginRegistry::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 204 of file pluginRegistry.h.

HF_API HfPluginBase* HfPluginRegistry::GetPlugin ( const TfToken pluginId)
protected

Returns the plugin from the given pluginId. The reference count on the plugin is automatically increased.

HF_API bool HfPluginRegistry::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 HfPluginRegistry::GetPluginDescs ( HfPluginDescVector plugins)

Returns an ordered list of all registered plugins. The plugins are ordered by priority then alphabetically

HF_API TfToken HfPluginRegistry::GetPluginId ( const HfPluginBase plugin) const
HF_API bool HfPluginRegistry::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 HfPluginRegistry::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: