ImFusion C++ SDK 4.4.0
ImFusion::Framework Namespace Reference

Namespace containing general framework initialization methods. More...

Detailed Description

Namespace containing general framework initialization methods.

See also
What is the correct way to initialize the ImFusionLib and its plugins? License System

Classes

struct  InitConfig
 Record to configure the initialization of the ImFusion SDK. More...
struct  PluginInfo

Functions

std::function< void()> defaultLicenseInitFunction ()
 Returns the license initialization function which is set in the InitConfig by default.
void init (InitConfig &&initializationSettings={})
 Performs general initialization of the framework.
void deinit ()
 De-intializes the framework.
bool isInitialized ()
 Returns whether the framework was successfully initialized.
void installSignalHandlers ()
 Installs signal handlers for SIGINT and SIGTERM that call deinit() and exit gracefully.
void loadPlugins (const std::vector< std::string > &pluginFolders=std::vector< std::string >())
 Load and register/initializes all ImFusion plugins from the specified folders.
bool loadPlugin (const std::string &pluginFilename)
 Load and register/initialize a single ImFusion plugin, returns true on success.
bool loadRequiredPlugins (const std::vector< std::string > &pluginLibraryNames, const std::vector< std::string > &pluginFolders=std::vector< std::string >())
 Load and register/initialize all requested plugins, returns true on success.
void addBlacklistedPluginLibraryName (std::string libraryName)
 Blacklist a libraryName in the plugin folder and prevent it from being loaded.
std::vector< PluginInfoloadedPlugins ()
 Returns a list of all currently loaded plugins.
template<typename T>
T * queryLoadedPlugin ()
 Returns the ImFusionLibPlugin of the given type if it has been loaded.
ImFusionLibPluginqueryLoadedPlugin (const std::string &pluginName)
 Returns the ImFusionLibPlugin with the given name if it has been loaded.
Utils::Version version ()
 Returns the version of the ImFusion SDK.
std::string versionInfoString ()
 Returns a string containing information about the version of the ImFusionLib.
void init (const InitConfig &initializationSettings)=delete

Function Documentation

◆ defaultLicenseInitFunction()

std::function< void()> ImFusion::Framework::defaultLicenseInitFunction ( )

Returns the license initialization function which is set in the InitConfig by default.

The returned function tries to activate a license if no license is active by using the environment variable IMFUSION_LICENSE_KEY if set or by migrating a legacy license if present on the system. If license activation fails it throws a MissingLicenseException.

◆ init()

void ImFusion::Framework::init ( InitConfig && initializationSettings = {})

Performs general initialization of the framework.

Default initialization settings are defined by the default values of the InitConfig struct. You can customize the initialization process by providing a custom instance. Be advised that due to the std::unique_ptr in this struct, you can only move it into the init() function.

By default, (with default Framework::InitConfig) this function does not load any plugins yet. If you are using an ApplicationController, it can take care of SDK initialization as well, so that you don't have to call this function directly. If the framework has already been initialized, this function does nothing.

A license must be activated inside Framework::InitConfig::licenseInitFunction. If nothing is specified, the default implementation is used, which reads the license key from the environment variable IMFUSION_LICENSE_KEY. Alternatively, you can set your own function (see below and ImFusion::LicenseManagerSDK)

Example of a complete initialization:

initConfig.licenseInitFunction = []() {
LicenseManagerSDK::setLicenseKey("XXXX-XXXX-XXXX-XXXX");
};
initConfig.loadPlugins = true;
Framework::init(std::move(initConfig));
void init(InitConfig &&initializationSettings={})
Performs general initialization of the framework.
bool isActivated()
Check whether a valid license is installed.
int setLicenseKey(std::string_view key)
Set license key An online activation is performed.
Record to configure the initialization of the ImFusion SDK.
Definition Framework.h:38
bool loadPlugins
Flag whether to search for plugins using Framework::loadPlugins().
Definition Framework.h:70
std::function< void()> licenseInitFunction
Function will be called once during framework initialization just before checking the license state.
Definition Framework.h:77
Exceptions
MissingLicenseExceptionif the license is invalid
GL::OpenGLNotFoundExceptionif the OpenGL context could not be initialized

◆ deinit()

void ImFusion::Framework::deinit ( )

De-intializes the framework.

Deinitialize the logging framework.

Deletes the main OpenGL context and unloads all plugins. This should only be called at the end of the application and if init() was called before. Does nothing if the framework was not initialized yet.

◆ installSignalHandlers()

void ImFusion::Framework::installSignalHandlers ( )

Installs signal handlers for SIGINT and SIGTERM that call deinit() and exit gracefully.

This only has an effect on UNIX-like systems.

◆ loadPlugins()

void ImFusion::Framework::loadPlugins ( const std::vector< std::string > & pluginFolders = std::vectorstd::string >())

Load and register/initializes all ImFusion plugins from the specified folders.

If pluginFolders is empty, the following default search paths are used:

Windows platforms:

  • IMFUSION_PLUGIN_PATH environment variable
  • <executable-path>/plugins
  • <ImFusionLib.dll-path>/plugins

Unix platforms:

  • IMFUSION_PLUGIN_PATH environment variable
  • <ImFusionLib.so-path>/../lib/ImFusionLib/plugins

Plugin names defined in the environment variable IMFUSION_PLUGIN_BLACKLIST as a semi-colon-separated list (e.g. "Foo.dll;Bar.dll") will not be loaded by this function. This mechanism can also be used to explicitly ignore libraries that might conflict with or crash the application.

Deprecated
"Use PluginManager::registerPlugins() and PluginManager::initAllRegisteredPlugins() instead"

◆ loadPlugin()

bool ImFusion::Framework::loadPlugin ( const std::string & pluginFilename)

Load and register/initialize a single ImFusion plugin, returns true on success.

This is useful to load a single plugin from a non-standard path without setting the IMFUSION_PLUGIN_PATH environment variable. If the plugin name is blacklisted, loading of such library will be skipped, see addBlacklistedPluginLibraryName

Parameters
pluginFilenameFull path to the .dll/.so/.dylib plugin file to load.
Deprecated
"Use PluginManager::registerPlugin() and PluginManager::initPlugin() instead"

◆ loadRequiredPlugins()

bool ImFusion::Framework::loadRequiredPlugins ( const std::vector< std::string > & pluginLibraryNames,
const std::vector< std::string > & pluginFolders = std::vectorstd::string >() )

Load and register/initialize all requested plugins, returns true on success.

This is useful, in particular for regulatory purposes, to ensure that the application has these plugins and no additional ones. One can provide a folder location for the plugins. If that is empty, the following default search paths are used:

Windows platforms:

  • IMFUSION_PLUGIN_PATH environment variable
  • <executable-path>/plugins
  • <ImFusionLib.dll-path>/plugins

Unix platforms:

  • IMFUSION_PLUGIN_PATH environment variable
  • <ImFusionLib.so-path>/../lib/ImFusionLib/plugins
Parameters
pluginLibraryNamesThe names of the desired plugins e.g. { "ImFusionSeg", "ImFusionReg", "TorchPlugin" }
pluginFoldersThe folder(s) where the plugins are located. If empty, default paths will be searched.
Deprecated
"Use PluginManager::registerPlugins() and PluginManager::initAllRegisteredPlugins() instead"

◆ addBlacklistedPluginLibraryName()

void ImFusion::Framework::addBlacklistedPluginLibraryName ( std::string libraryName)

Blacklist a libraryName in the plugin folder and prevent it from being loaded.

Adds the name of a library to the list of blacklisted .dll/.so/.dylib which shall not be loaded by Framework::loadPlugins(). This can useful to skip loading of libraries which are not ImFusion plugins but might be required to sit next to an ImFusion plugin. Call this function in your main.cpp, before calling Framework::loadPlugins()

Deprecated
"Use PluginManager::addLibraryNameToBlacklist() instead"

◆ loadedPlugins()

std::vector< PluginInfo > ImFusion::Framework::loadedPlugins ( )

Returns a list of all currently loaded plugins.

Deprecated
"Use PluginManager::plugins() instead"

◆ queryLoadedPlugin() [1/2]

template<typename T>
T * ImFusion::Framework::queryLoadedPlugin ( )

Returns the ImFusionLibPlugin of the given type if it has been loaded.

Returns nullptr, if no such plugin has been loaded.

Deprecated
"Use PluginManager::pluginInstance() instead"

◆ queryLoadedPlugin() [2/2]

ImFusionLibPlugin * ImFusion::Framework::queryLoadedPlugin ( const std::string & pluginName)

Returns the ImFusionLibPlugin with the given name if it has been loaded.

Returns nullptr, if no such plugin has been loaded.

Deprecated
"Use PluginManager::pluginInstance() instead"

◆ versionInfoString()

std::string ImFusion::Framework::versionInfoString ( )

Returns a string containing information about the version of the ImFusionLib.

Format: "ImFusionLib Version <Version> built on <Year>-<Month>-<Day>.";

Search Tab / S to search, Esc to close