24 #ifndef PXR_IMAGING_HF_PLUGIN_REGISTRY_H
25 #define PXR_IMAGING_HF_PLUGIN_REGISTRY_H
28 #include "pxr/imaging/hf/api.h"
29 #include "pxr/imaging/hf/perfLog.h"
30 #include "pxr/imaging/hf/pluginDesc.h"
31 #include "pxr/base/tf/type.h"
34 PXR_NAMESPACE_OPEN_SCOPE
121 virtual ~HfPluginRegistry();
139 template<
typename T,
typename PluginBaseType,
typename... Bases>
143 typedef std::vector<Hf_PluginEntry> _PluginEntryVector;
144 typedef std::map<TfToken, size_t> _TokenMap;
151 typedef std::function<HfPluginBase *()> _FactoryFn;
156 static void _SetFactory(
TfType &type, _FactoryFn &func);
164 _PluginEntryVector _pluginEntries;
165 _TokenMap _pluginIndex;
168 bool _pluginCachePopulated;
171 void _DiscoverPlugins();
174 Hf_PluginEntry *_GetEntryForPlugin(
HfPluginBase *plugin);
179 HfPluginRegistry() =
delete;
180 HfPluginRegistry(
const HfPluginRegistry &) =
delete;
181 HfPluginRegistry &operator=(
const HfPluginRegistry &) =
delete;
186 HfPluginRegistry::_CreatePlugin()
188 HF_MALLOC_TAG_FUNCTION();
193 template<
typename T,
typename PluginBaseType,
typename... Bases>
200 _FactoryFn func = &_CreatePlugin<T>;
201 _SetFactory(type, func);
206 PXR_NAMESPACE_CLOSE_SCOPE
208 #endif //PXR_IMAGING_HF_PLUGIN_REGISTRY_H
Base class for registering Hydra plugins using the plug mechanism.
HF_API bool IsRegisteredPlugin(const TfToken &pluginId)
Returns true if a plugin has been registered for the given id.
HF_API void ReleasePlugin(HfPluginBase *plugin)
Decrement the reference count on the plugin.
HF_API void GetPluginDescs(HfPluginDescVector *plugins)
Returns an ordered list of all registered plugins.
static void Define()
Entry point for registering a types implementation.
Base class for all hydra plugin classes.
Token for efficient comparison, assignment, and hashing of known strings.
HF_API HfPluginBase * GetPlugin(const TfToken &pluginId)
Returns the plugin from the given pluginId.
HF_API bool GetPluginDesc(const TfToken &pluginId, HfPluginDesc *desc)
Returns the description for the given plugin id.
A type-list of C++ base types.
HF_API void AddPluginReference(HfPluginBase *plugin)
Increment the reference count on an existing plugin.
static TfType const & Define()
Define a TfType with the given C++ type T and C++ base types B.
TfType represents a dynamic runtime type.
Common structure used to report registered plugins in one of the plugin registries.