TensorRT 10.5.0
nvinfer1::safe::IPluginRegistry Class Referenceabstract

Single registration point for all plugins in an application. It is used to find plugin implementations during engine deserialization. Internally, the plugin registry is considered to be a singleton so all plugins in an application are part of the same global registry. Note that the plugin registry is only supported for plugins of type IPluginV2 and must also have a corresponding IPluginCreator implementation. More...

#include <NvInferSafeRuntime.h>

Public Member Functions

virtual bool registerCreator (IPluginCreator &creator, AsciiChar const *const pluginNamespace) noexcept=0
 Register a plugin creator. More...
 
virtual IPluginCreator *const * getPluginCreatorList (int32_t *const numCreators) const noexcept=0
 Return all the registered plugin creators and the number of registered plugin creators. Returns nullptr if none is found. More...
 
virtual IPluginCreatorgetPluginCreator (AsciiChar const *const pluginName, AsciiChar const *const pluginVersion, AsciiChar const *const pluginNamespace="") noexcept=0
 Return plugin creator based on plugin name, version, and namespace associated with plugin during network creation. More...
 
virtual void setErrorRecorder (IErrorRecorder *const recorder) noexcept=0
 Set the ErrorRecorder for this interface. More...
 
virtual IErrorRecordergetErrorRecorder () const noexcept=0
 Get the ErrorRecorder assigned to this interface. More...
 
virtual bool deregisterCreator (IPluginCreator const &creator) noexcept=0
 Deregister a previously registered plugin creator. More...
 

Protected Member Functions

virtual ~IPluginRegistry () noexcept=default
 

Detailed Description

Single registration point for all plugins in an application. It is used to find plugin implementations during engine deserialization. Internally, the plugin registry is considered to be a singleton so all plugins in an application are part of the same global registry. Note that the plugin registry is only supported for plugins of type IPluginV2 and must also have a corresponding IPluginCreator implementation.

See also
IPluginV2 and IPluginCreator
Warning
Do not inherit from this class, as doing so will break forward-compatibility of the API and ABI.
IPluginRegistry::setErrorRecorder() must be called to register an error recorder with the registry before using other methods in the registry.

Constructor & Destructor Documentation

◆ ~IPluginRegistry()

virtual nvinfer1::safe::IPluginRegistry::~IPluginRegistry ( )
protectedvirtualdefaultnoexcept

Member Function Documentation

◆ deregisterCreator()

virtual bool nvinfer1::safe::IPluginRegistry::deregisterCreator ( IPluginCreator const &  creator)
pure virtualnoexcept

Deregister a previously registered plugin creator.

Since there may be a desire to limit the number of plugins, this function provides a mechanism for removing plugin creators registered in TensorRT. The plugin creator that is specified by creator is removed from TensorRT and no longer tracked.

Parameters
creatorThe plugin creator to deregister.
Returns
True if the plugin creator was deregistered, false if it was not found in the registry or otherwise could not be deregistered.


Usage considerations

  • Allowed context for the API call
    • Thread-safe: Yes

◆ getErrorRecorder()

virtual IErrorRecorder * nvinfer1::safe::IPluginRegistry::getErrorRecorder ( ) const
pure virtualnoexcept

Get the ErrorRecorder assigned to this interface.

Retrieves the assigned error recorder object for the given class. A default error recorder does not exist, so a nullptr will be returned if setErrorRecorder has not been called, or an ErrorRecorder has not been inherited.

Returns
A pointer to the IErrorRecorder object that has been registered, or nullptr if:
  • no error recorder has been set, or
  • the last error recorder has been deregistered via setErrorRecorder(nullptr).
See also
setErrorRecorder()


Usage considerations

  • Allowed context for the API call
    • Thread-safe: Yes

◆ getPluginCreator()

virtual IPluginCreator * nvinfer1::safe::IPluginRegistry::getPluginCreator ( AsciiChar const *const  pluginName,
AsciiChar const *const  pluginVersion,
AsciiChar const *const  pluginNamespace = "" 
)
pure virtualnoexcept

Return plugin creator based on plugin name, version, and namespace associated with plugin during network creation.

Warning
The strings pluginName, pluginVersion, and pluginNamespace must be NULL terminated and have a length of 1024 bytes or less including the NULL terminator.
Parameters
pluginNameThe plugin name string
pluginVersionThe plugin version string
pluginNamespaceThe plugin namespace (by default empty string)
Returns
If a plugin creator corresponding to the passed name, version and namespace can be found in the registry, it is returned. nullptr is returned in the following situations:
  • Any of the input arguments is nullptr.
  • Any of the input arguments exceeds the string length limit.
  • No plugin creator corresponding to the input arguments can be found in the registry.
  • A plugin creator can be found, but its stored namespace attribute does not match the pluginNamespace.


Usage considerations

  • Allowed context for the API call
    • Thread-safe: Yes

◆ getPluginCreatorList()

virtual IPluginCreator *const * nvinfer1::safe::IPluginRegistry::getPluginCreatorList ( int32_t *const  numCreators) const
pure virtualnoexcept

Return all the registered plugin creators and the number of registered plugin creators. Returns nullptr if none is found.

Parameters
[out]numCreatorsIf the call completes successfully, the number of registered plugin creators (which will be an integer between 0 and 100 inclusive)
Returns
The start address of an IPluginCreator* array of length numCreators if at least one plugin creator has been registered, or nullptr if there are no registered plugin creators.


Usage considerations

  • Allowed context for the API call
    • Thread-safe: No

◆ registerCreator()

virtual bool nvinfer1::safe::IPluginRegistry::registerCreator ( IPluginCreator creator,
AsciiChar const *const  pluginNamespace 
)
pure virtualnoexcept

Register a plugin creator.

Parameters
creatorThe plugin creator to be registered.
pluginNamespaceA NULL-terminated namespace string, which must be 1024 bytes or less including the NULL terminator. It must be identical with the result of calling IPluginCreator::getPluginNamespace() on the creator object.
Returns
True if the registration succeeded, else false.

Registration may fail for any of the following reasons:

  • The pluginNamespace string is a nullptr.
  • The pluginNamespace string exceeds the maximum length.
  • The pluginNamespace string does not match the result of creator.getPluginNamespace().
  • There have already been 100 plugin creators registered (maximum number of plugins exceeded).
  • Another plugin creator with the same combination of plugin name, version and namespace has already been registered.


Usage considerations

  • Allowed context for the API call
    • Thread-safe: Yes; calls to this method will be synchronized by a mutex.

◆ setErrorRecorder()

virtual void nvinfer1::safe::IPluginRegistry::setErrorRecorder ( IErrorRecorder *const  recorder)
pure virtualnoexcept

Set the ErrorRecorder for this interface.

Assigns the ErrorRecorder to this interface. The ErrorRecorder will track all errors during execution. This function will call incRefCount of the registered ErrorRecorder at least once. If the recorder is set to nullptr, the error code ErrorCode::kINVALID_ARGUMENT will be emitted if the recorder has been registered.

Parameters
recorderThe error recorder to register with this interface, or nullptr to deregister the current recorder.
See also
getErrorRecorder()


Usage considerations

  • Allowed context for the API call
    • Thread-safe: No

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

  Copyright © 2024 NVIDIA Corporation
  Privacy Policy | Manage My Privacy | Do Not Sell or Share My Data | Terms of Service | Accessibility | Corporate Policies | Product Security | Contact