ImFusion C++ SDK 4.4.0
ImFusion::PluginBase Class Referenceabstract

#include <ImFusion/Core/Plugin.h>

Base interface to interact with a plugin that can be loaded into an application at runtime. More...

Inheritance diagram for ImFusion::PluginBase:

Detailed Description

Base interface to interact with a plugin that can be loaded into an application at runtime.

Plugins are a mechanism to dynamically extend an application with functionality without the application a-priori knowing all plugins that will be available at runtime. On the OS/filesystem level, they correspond to a dynamically linked shared library (on Windows: DLL). In the context of the ImFusion SDK such a plugin library must:

  1. Implement a plugin-specific specialization of the PluginBase interface. The class must have a static member function const char* id() that returns a unique identifier of the plugin. For consistency, we recommend to use the following scheme: <Namespace>.<PluginName>, where <Namespace> is a consistent identifier for all plugins from a single author/vendor.
  2. Export a set of C functions and symbols to query plugin ID and descriptor, and to instantiate the PluginBase specialization instance. Use the IMFUSION_REGISTER_PLUGIN() macro in a cpp file (not a header file) to do so.
Warning
You must not do any non-trivial initialization in the plugin class constructor. Otherwise you might deadlock the OS on library load if using the automatic plugin self-registration feature. All non-trivial initialization must happen in the init() function.
https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-best-practices
See also
Plugin Architecture, PluginManager, IMFUSION_REGISTER_PLUGIN, IMFUSION_REGISTER_PLUGIN_NO_AUTO
Examples
ExamplePlugin.cpp.

Public Types

enum class  Status { Success = 0 , LicenseCheckFailed , Unsupported , UnknownError }
 Enumeration of status codes for plugin initialization. More...

Public Member Functions

std::string pluginId () const
 Convenience function to query the plugin ID of a concrete instance at runtime.
PluginManager::PluginStatus pluginStatus () const
 Convenience function to query the plugin status of a concrete instance at runtime.
virtual std::string author () const =0
 Name of the author of the plugin for informative purposes.
virtual std::string description () const =0
 Description of the plugin purpose/functionality for informative purposes.
Utils::Version version () const
 Convenience function to query the version number of the plugin for informative purposes.
virtual std::vector< std::stringdependencies () const
 Optional list of plugin IDs on which this plugin depends.

Protected Member Functions

virtual Status init ()=0
 Perform plugin initialization, for instance by populating factories and registering custom types with the host application.

Member Enumeration Documentation

◆ Status

enum class ImFusion::PluginBase::Status
strong

Enumeration of status codes for plugin initialization.

Enumerator
Success 

Requested action completed successfully.

LicenseCheckFailed 

Failure due to failed license check.

Unsupported 

The requested action is unsupported by the plugin.

UnknownError 

Failure due to unknown/other error.

Member Function Documentation

◆ pluginId()

std::string ImFusion::PluginBase::pluginId ( ) const

Convenience function to query the plugin ID of a concrete instance at runtime.

This function requires the plugin to be registered with PluginManager.

◆ pluginStatus()

PluginManager::PluginStatus ImFusion::PluginBase::pluginStatus ( ) const

Convenience function to query the plugin status of a concrete instance at runtime.

This function requires the plugin to be registered with PluginManager.

◆ author()

◆ description()

◆ version()

Utils::Version ImFusion::PluginBase::version ( ) const

Convenience function to query the version number of the plugin for informative purposes.

This function requires the plugin to be registered with PluginManager.

◆ dependencies()

virtual std::vector< std::string > ImFusion::PluginBase::dependencies ( ) const
inlinevirtual

Optional list of plugin IDs on which this plugin depends.

Initialization of this plugin will fail if any of the plugins in this list can not be loaded or initialized for any reason.

Reimplemented in ImFusion::CT::CTPlugin, ImFusion::DicomGuiPlugin, ImFusion::MLPlugin, ImFusion::NavigationPlugin, ImFusion::SegPlugin, ImFusion::SpinePlugin, ImFusion::US::LiveUSPlugin, ImFusion::US::USPlugin, and ImFusion::VisionPlugin.

◆ init()

virtual Status ImFusion::PluginBase::init ( )
protectedpure virtual

The documentation for this class was generated from the following file:
  • ImFusion/Core/Plugin.h
Search Tab / S to search, Esc to close