holoscan::gxf::GXFExtensionManager
holoscan::gxf::GXFExtensionManager
Class to manage GXF extensions.
This class is a helper class to manage GXF extensions.
Since GXF API doesn’t provide a way to ignore duplicate extensions, this class is used to manage the extensions, prevent duplicate extensions from being loaded, and unload the extension handlers when the class is destroyed.
Example:
Example
Inherits from: holoscan::ExtensionManager (public)
Constructors
GXFExtensionManager
Construct a new GXFExtensionManager object.
Parameters
The GXF context
Destructor
~GXFExtensionManager
Destroy the GXFExtensionManager object.
This method closes all the extension handles that are loaded by this class. Note that the shared library is opened with RTLD_NODELETE flag, so the library is not unloaded when the handle is closed.
Methods
reset_context
Reset the extension manager with the context (1)
Reset the extension manager with the context (2)
Reset the extension manager with the context.
Parameters
The GXF context.
refresh
Refresh the extension list.
Based on the current GXF context, it gets the list of extensions and stores the type IDs of the extensions so that duplicate extensions can be ignored.
Also loads extensions that were previously loaded & cached.
load_extension
Load an extension
Load an extension from a pointer
Load an extension.
This method loads an extension and stores the extension handler so that it can be unloaded when the class is destroyed.
Returns: true if the extension is loaded successfully, false otherwise.
Parameters
The file name of the extension (e.g. libgxf_std.so).
If true, no error message will be printed if the extension is not found.
The environment variable names that contains the search paths for the extension. The environment variable names are separated by a comma (,). (default: “HOLOSCAN_LIB_PATH”).
load_extensions_from_yaml
Load extensions from a yaml file.
The yaml file should contain a list of extension file names under the key “extensions”.
For example:
Returns: true if the extension is loaded successfully, false otherwise.
Parameters
The yaml node.
If true, no error message will be printed if the extension is not found.
The environment variable names that contains the search paths for the extension. The environment variable names are separated by a comma (,). (default: “HOLOSCAN_LIB_PATH”).
The key in the yaml node that contains the extension file names (default: “extensions”).
Example
is_extension_loaded
Check if the extension is loaded.
Returns: true if the extension is loaded. false otherwise.
Parameters
The type ID of the extension.
open_extension_library
Loads a dynamic library containing a GXF extension.
Uses dlopen() to load the specified extension library and returns its handle. If the extension has already been loaded, returns the existing handle from cache instead of loading it again.
Returns: Handle to the loaded dynamic library.
Parameters
Path to the extension library file (e.g., “libgxf_std.so”).
Static methods
tokenize
Tokenize a string.
Returns: The vector of tokens.
Parameters
The string to tokenize.
The delimiters.