Computer Assisted Medical Intervention Tool Kit  version 5.2
camitk::ExtensionManager Class Reference

This class is used to manage all plugins loaded by the application. More...

#include <ExtensionManager.h>

+ Inheritance diagram for camitk::ExtensionManager:
+ Collaboration diagram for camitk::ExtensionManager:

Public Types

enum  ExtensionType { ACTION , COMPONENT , APPLICATION , VIEWER }
 describes the CamiTK Extension Type (Action, Component, Application...). More...
 

Static Public Member Functions

static void autoload ()
 Autoload component and action extensions. More...
 
static void autoload (ExtensionType type)
 Autoload all the extension of a given type. More...
 
static QString getInstallationString (QString file, const QString &globalInstallDir, const QString &userInstallDir, const QString &currentWorkingDir)
 Returns a three char string that corresponds to the installation directory of a given shared library. More...
 
static bool loadExtension (ExtensionType type, QString file)
 Load a specific extension from a file. More...
 
Component extension list management
static ComponentExtensiongetComponentExtension (QString)
 get the plugin corresponding to a given extension or name. More...
 
static const QList< ComponentExtension * > getComponentExtensionsList ()
 Get the list of registered ComponentExtension. More...
 
static ComponentExtensiongetDataDirectoryComponentExtension (QString)
 get the plugin corresponding to a given data directory component extension's name. More...
 
static const QList< ComponentExtension * > getDataDirectoryComponentsList ()
 Get the list of registered ComponentExtension working on directory. More...
 
static QStringList getFileExtensions ()
 get the list of all the suffixes managed by registered component extensions (all possible file suffix) More...
 
static QStringList getDataDirectoryExtNames ()
 get the list of all the name of the registered Component data directory More...
 
static void registerFileExtension (QString fileExtension)
 Register the file extension with the current application for opening This function is called by registerFileExtensions. More...
 
static bool unloadComponentExtension (QString)
 Unload a plugin corresponding to a given extension or component name. More...
 
Action extension list management
static void unloadAllActionExtensions ()
 unload all action extensions and delete instantiated actions More...
 
static const QList< ActionExtension * > getActionExtensionsList ()
 Get the list of registered ActionExtension. More...
 
static ActionExtensiongetActionExtension (QString)
 Get the ActionExtension corresponding to the given shared library file. More...
 
static bool unloadActionExtension (QString)
 Unload an action extension using its .dll/.so/.dylib filename. More...
 
Viewer extension list management
static void unloadAllViewerExtensions ()
 unload all viewer extensions and delete instantiated actions More...
 
static const QList< ViewerExtension * > getViewerExtensionsList ()
 Get the list of registered ViewerExtension. More...
 
static ViewerExtensiongetViewerExtension (QString)
 Get the Viewer Extension corresponding to the given shared library file. More...
 
static bool unloadViewerExtension (QString)
 Unload an viewer extension using its .dll/.so/.dylib filename. More...
 

Detailed Description

This class is used to manage all plugins loaded by the application.

The current version is able to load dynamic library for

This class is a contained for all the loaded extension. It contains only static members.

Member Enumeration Documentation

◆ ExtensionType

describes the CamiTK Extension Type (Action, Component, Application...).

CamiTK follows Component-Based programming architecture. The Service Layer defines four types of extensions.

Enumerator
ACTION 

Action extensions: manages the processing logic.

COMPONENT 

Component extensions: manages the data logic.

APPLICATION 

MainWindow extensions: manages the application logic.

VIEWER 

Viewer extensions: manages the presentation and user interaction logic.

Member Function Documentation

◆ autoload() [1/2]

void camitk::ExtensionManager::autoload ( )
static

Autoload component and action extensions.

References ACTION, COMPONENT, and VIEWER.

Referenced by camitk::Application::Application(), and main().

+ Here is the caller graph for this function:

◆ autoload() [2/2]

void camitk::ExtensionManager::autoload ( ExtensionManager::ExtensionType  type)
static

Autoload all the extension of a given type.

This method try to load all the extensions of the given type that are found (in this specific order) :

  • in the current working directory (considered as an install directory), this should be the build directory (load extensions that are just being compiled, before their installation
  • in the user config directory (CamiTK user install)
  • in the system-wide install (CamiTK global install)
  • and in the list of user-registered extensions (stored in the configuration directory)

Duplicates found within the installation directory are removed (e.g. if you have the extension x.so in the build directory as well as the user directory, only the extension in the build directory will be loaded (it takes precedence).

Parameters
typethe extension type

References ACTION, CAMITK_ERROR_ALT, CAMITK_TRACE_ALT, COMPONENT, camitk::Core::getActionDirectories(), camitk::Core::getComponentDirectories(), camitk::Application::getSettings(), camitk::Core::getViewerDirectories(), loadExtension(), and VIEWER.

+ Here is the call graph for this function:

◆ getActionExtension()

ActionExtension * camitk::ExtensionManager::getActionExtension ( QString  file)
static

Get the ActionExtension corresponding to the given shared library file.

If the given shared library is not loaded return nullptr. The shared library file should be given as a complete filepath in the QString.

Returns
nullptr if the given shared library complete path is not loaded.

◆ getActionExtensionsList()

const QList< ActionExtension * > camitk::ExtensionManager::getActionExtensionsList ( )
static

Get the list of registered ActionExtension.

The list contains unique elements (no duplicates possible) and is alphabitically sorted.

Note
The list is read-only and cannot be modified. This list is useful to loop over the loaded ActionExtension, especially when order counts.
Returns
list of unique ActionExtension loaded in the Core.

Referenced by camitk::Core::getConfig().

+ Here is the caller graph for this function:

◆ getComponentExtension()

ComponentExtension * camitk::ExtensionManager::getComponentExtension ( QString  extOrName)
static

get the plugin corresponding to a given extension or name.

Referenced by camitk::Application::open(), and camitk::Application::save().

+ Here is the caller graph for this function:

◆ getComponentExtensionsList()

const QList< ComponentExtension * > camitk::ExtensionManager::getComponentExtensionsList ( )
static

Get the list of registered ComponentExtension.

The list contains unique elements (no duplicates possible) and is alphabitically sorted.

Note
The list is read-only and cannot be modified. This list is useful to loop over the loaded ComponentExtension, especially when order counts.
Returns
list of unique ComponentExtension loaded in the Core.

Referenced by camitk::Core::getConfig(), camitk::ImageAcquisitionComponentExtension::getImagerList(), camitk::ImageAcquisitionComponentExtension::getInstance(), and main().

+ Here is the caller graph for this function:

◆ getDataDirectoryComponentExtension()

ComponentExtension * camitk::ExtensionManager::getDataDirectoryComponentExtension ( QString  pluginName)
static

get the plugin corresponding to a given data directory component extension's name.

Referenced by camitk::Application::openDirectory().

+ Here is the caller graph for this function:

◆ getDataDirectoryComponentsList()

const QList< ComponentExtension * > camitk::ExtensionManager::getDataDirectoryComponentsList ( )
static

Get the list of registered ComponentExtension working on directory.

The list contains unique elements (no duplicates possible) and is alphabitically sorted.

Note
The list is read-only and cannot be modified. This list is useful to loop over the loaded ComponentExtension, especially when order counts.
Returns
list of unique ComponentExtension working on data directory loaded in the Core.

Referenced by camitk::Core::getConfig().

+ Here is the caller graph for this function:

◆ getDataDirectoryExtNames()

QStringList camitk::ExtensionManager::getDataDirectoryExtNames ( )
static

get the list of all the name of the registered Component data directory

◆ getFileExtensions()

QStringList camitk::ExtensionManager::getFileExtensions ( )
static

get the list of all the suffixes managed by registered component extensions (all possible file suffix)

Referenced by camitk::Application::Application().

+ Here is the caller graph for this function:

◆ getInstallationString()

QString camitk::ExtensionManager::getInstallationString ( QString  file,
const QString &  globalInstallDir,
const QString &  userInstallDir,
const QString &  currentWorkingDir 
)
static

Returns a three char string that corresponds to the installation directory of a given shared library.

The shared library should be the complete filename corresponding to a component or action extension.

The following string code are returned:

  • "[G]" for an extension installed in the global installation directory (where CamiTK SDK is installed)
  • "[L]" for an extension installed in the user configuration directory (local install)
  • "[W]" for an extension loaded directly from the current working directory (build installation tree)
  • "[U]" for an extension loaded manually by the user
Returns
the string coding for the installation
Parameters
filethe extension plugin file
globalInstallDirthe global installation directory
userInstallDirthe user installation directory
currentWorkingDirthe current working directory

References camitk::Core::libDir.

Referenced by camitk::Core::getConfig().

+ Here is the caller graph for this function:

◆ getViewerExtension()

ViewerExtension * camitk::ExtensionManager::getViewerExtension ( QString  file)
static

Get the Viewer Extension corresponding to the given shared library file.

If the given shared library is not loaded return nullptr. The shared library file should be given as a complete filepath in the QString.

Returns
nullptr if the given shared library complete path is not loaded.

◆ getViewerExtensionsList()

const QList< ViewerExtension * > camitk::ExtensionManager::getViewerExtensionsList ( )
static

Get the list of registered ViewerExtension.

The list contains unique elements (no duplicates possible) and is alphabitically sorted.

Note
The list is read-only and cannot be modified. This list is useful to loop over the loaded ViewerExtension, especially when order counts.
Returns
list of unique ViewerExtension loaded in the Core.

Referenced by camitk::Core::getConfig(), camitk::Application::getNewViewer(), and loadExtension().

+ Here is the caller graph for this function:

◆ loadExtension()

bool camitk::ExtensionManager::loadExtension ( ExtensionManager::ExtensionType  type,
QString  file 
)
static

Load a specific extension from a file.

This methods loads a ActionExtension, ComponentExtension,... plugin from a .dll/.so/.dylib filename

Parameters
typethe extension type
filethe plugin filename (.dll/.so/.dylib)
Returns
false if it cannot be loaded

References ACTION, CAMITK_INFO_ALT, CAMITK_TRACE_ALT, COMPONENT, camitk::ComponentExtension::getFileExtensions(), camitk::Core::getGlobalInstallDir(), camitk::ComponentExtension::getLocation(), camitk::ComponentExtension::getName(), camitk::ViewerExtension::getName(), camitk::ViewerExtension::getViewerClassName(), getViewerExtensionsList(), camitk::ComponentExtension::hasDataDirectory(), camitk::ActionExtension::init(), camitk::ViewerExtension::init(), camitk::ActionExtension::initResources(), camitk::ComponentExtension::initResources(), camitk::ViewerExtension::initResources(), camitk::Core::libDir, camitk::Application::registerAllActions(), camitk::Application::registerAllViewers(), camitk::ActionExtension::setLocation(), camitk::ComponentExtension::setLocation(), camitk::ViewerExtension::setLocation(), camitk::Core::shortVersion, and VIEWER.

Referenced by autoload(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ registerFileExtension()

void camitk::ExtensionManager::registerFileExtension ( QString  fileExtension)
static

Register the file extension with the current application for opening This function is called by registerFileExtensions.

Parameters
fileExtensionthe file extension to associate with the current application for opening

Referenced by camitk::Application::Application().

+ Here is the caller graph for this function:

◆ unloadActionExtension()

bool camitk::ExtensionManager::unloadActionExtension ( QString  fileName)
static

Unload an action extension using its .dll/.so/.dylib filename.

Returns
false if the plugin could not be unloaded - still in use somewhere

References camitk::Application::unregisterAllActions().

Referenced by unloadAllActionExtensions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unloadAllActionExtensions()

void camitk::ExtensionManager::unloadAllActionExtensions ( )
static

unload all action extensions and delete instantiated actions

References unloadActionExtension().

+ Here is the call graph for this function:

◆ unloadAllViewerExtensions()

void camitk::ExtensionManager::unloadAllViewerExtensions ( )
static

unload all viewer extensions and delete instantiated actions

◆ unloadComponentExtension()

bool camitk::ExtensionManager::unloadComponentExtension ( QString  extOrName)
static

Unload a plugin corresponding to a given extension or component name.

Returns
false if the plugin could not be unloaded - still in use somewhere

References camitk::ComponentExtension::getLocation().

+ Here is the call graph for this function:

◆ unloadViewerExtension()

bool camitk::ExtensionManager::unloadViewerExtension ( QString  fileName)
static

Unload an viewer extension using its .dll/.so/.dylib filename.

Returns
false if the plugin could not be unloaded - still in use somewhere

References camitk::Application::unregisterAllViewers().

+ Here is the call graph for this function:

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