RAII handle owning a dynamically loaded plugin shared library and the Module instance the library produced via its createModule() entry point.
More...
#include <kanzi/core/module/plugin_metadata_extractor.hpp>
RAII handle owning a dynamically loaded plugin shared library and the Module instance the library produced via its createModule() entry point.
On destruction the Module is destroyed first and the library is closed afterwards. Move-only.
- Since
- Kanzi 4.1.0
◆ LoadedPlugin() [1/3]
| kanzi::LoadedPlugin::LoadedPlugin |
( |
| ) |
|
|
defaultnoexcept |
Constructs an empty handle that owns nothing.
◆ LoadedPlugin() [2/3]
Move-constructs from other, transferring ownership.
◆ ~LoadedPlugin()
| kanzi::LoadedPlugin::~LoadedPlugin |
( |
| ) |
|
Destroys the owned Module (if any) and then closes the owned library handle (if any).
◆ LoadedPlugin() [3/3]
◆ operator=() [1/2]
Move-assigns from other, destroying any previously owned module and library handle before taking ownership of other's resources.
◆ operator=() [2/2]
◆ operator bool()
| kanzi::LoadedPlugin::operator bool |
( |
| ) |
const |
|
explicitnoexcept |
Returns whether the handle owns a loaded plugin.
◆ getModule()
| Module * kanzi::LoadedPlugin::getModule |
( |
| ) |
const |
|
noexcept |
Returns the loaded Module, or null if the handle is empty or moved-from.
The pointer remains valid for the lifetime of this handle.
◆ loadPluginForMetadata
Opens a plugin shared library, invokes its createModule() entry point, and returns a handle owning the resulting Module together with the library handle.
Does NOT register the module into any Domain and does NOT invoke Module::registerMetadataOverride().
- Note
- The plugin's Module subclass constructor fires at createModule() time. Subclasses that perform initialization in their constructor pay that cost here. Subclasses whose getMetaclassesOverride() output depends on setup that happens in registerMetadataOverride() will produce incomplete metadata, because the helper does not invoke that hook.
-
Configuration of the OS-level shared-library search path (SetDllDirectory on Windows, LD_LIBRARY_PATH on POSIX) is the caller's responsibility.
- Parameters
-
| pluginPath | Path to the plugin shared library. |
- Returns
- LoadedPlugin handle owning the module and library.
- Exceptions
-
| runtime_error | if the library fails to open, the createModule entry point is missing, or createModule() returns null. |
- Since
- Kanzi 4.1.0
The documentation for this class was generated from the following file: