This class is used to manage all plugins loaded by the application. More...
#include <ExtensionManager.h>
Public Types | |
enum | ExtensionType { ACTION, COMPONENT, APPLICATION, VIEWER } |
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 ¤tWorkingDir) |
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 ComponentExtension * | getComponentExtension (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 ComponentExtension * | getDataDirectoryComponentExtension (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 ActionExtension * | getActionExtension (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 ViewerExtension * | getViewerExtension (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... | |
Static Private Member Functions | |
static void | addLibraryPath (QDir potentialPath, QString potentialLibDir) |
check if the given directory contains an extension repository and if it does update PATH (on windows) and call QCoreApplication::addLibraryPath for the given directory and all derived possible extension directories (actions, components and viewers) To check if it contains an extension repository, the given QString is used More... | |
static QMap< QString, ActionExtension * > & | getActionExtensionMap () |
get the singleton map of loaded action plugins (the key is the shared object/dll/dylib filename) This is the private (intern) method. More... | |
static QMap< QString, ComponentExtension * > & | getComponentExtensionMap () |
get the singleton map of loaded component plugins for files (the key is the file extension) This is the private (intern) method. More... | |
static QMap< QString, ComponentExtension * > & | getDataDirectoryComponentExtensionMap () |
get the singleton map of loaded component plugins for data directory (the key is the name) This is the private (intern) method. More... | |
static QStringList | getExtensionFilter () |
return the extensions file filter More... | |
static QStringList | getPluginFileNames (QDir) |
return the list of shared objects in a directory considering debug/release on MSVC More... | |
static QMap< QString, ViewerExtension * > & | getViewerExtensionMap () |
get the singleton map of loaded viewer plugins (the key is the shared object/dll/dylib filename) This is the private (intern) method. More... | |
static void | initPrivateLibDirs () |
Add the private library directories (lib/camitk-version) in the current session PATH: More... | |
Custom comparaison methods | |
static bool | componentExtensionLessThan (const ComponentExtension *left, const ComponentExtension *right) |
Custom comparaison method between two ComponentExtension* This method uses the QString::<() (less than operator) to perform the comparaison of two ComponentExtension* based on their name. More... | |
static bool | actionExtensionLessThan (ActionExtension *left, ActionExtension *right) |
Custom comparaison method between two ActionExtension* This method uses the QString::<() (less than operator) to perform the comparaison of two ActionExtension* based on their name. More... | |
static bool | viewerExtensionLessThan (ViewerExtension *left, ViewerExtension *right) |
Custom comparaison method between two ViewerExtension* based on the same principle as actionExtensionLessThan(..) More... | |
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.
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. |
|
staticprivate |
Custom comparaison method between two ActionExtension* This method uses the QString::<() (less than operator) to perform the comparaison of two ActionExtension* based on their name.
This method is used for sorting alphabitically a list of ActionExtension*.
left | left ActionExtension* to compare |
right | right ActionExtension* to compare |
|
staticprivate |
check if the given directory contains an extension repository and if it does update PATH (on windows) and call QCoreApplication::addLibraryPath for the given directory and all derived possible extension directories (actions, components and viewers) To check if it contains an extension repository, the given QString is used
|
static |
Autoload component and action extensions.
Referenced by camitk::Application::Application(), and main().
|
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) :
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).
type | the extension type |
References CAMITK_TRACE_ALT, and getPluginFileNames().
|
staticprivate |
Custom comparaison method between two ComponentExtension* This method uses the QString::<() (less than operator) to perform the comparaison of two ComponentExtension* based on their name.
This method is used for sorting alphabitically a list of ComponentExtension*.
left | left ComponentExtension* to compare |
right | right ComponentExtension* to compare |
Referenced by getComponentExtension().
|
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.
References unloadViewerExtension().
|
staticprivate |
get the singleton map of loaded action plugins (the key is the shared object/dll/dylib filename) This is the private (intern) method.
The action extension map is updated by loadActionExtension, unloadActionExtension and autoloadActionExtensions. This method follows the "construct on first use" idiom/design-pattern. It therefore avoids the infamous "static initialization order fiasco", see http://www.parashift.com/c++-faq/ctors.html
References unloadActionExtension().
|
static |
Get the list of registered ActionExtension.
The list contains unique elements (no duplicates possible) and is alphabitically sorted.
|
static |
get the plugin corresponding to a given extension or name.
References componentExtensionLessThan(), and getComponentExtensionMap().
Referenced by camitk::Application::open(), and camitk::Application::save().
|
staticprivate |
get the singleton map of loaded component plugins for files (the key is the file extension) This is the private (intern) method.
The component extension map is updated by loadComponentExtension, unloadComponentExtension and autoloadComponentExtensions. This method follows the "construct on first use" idiom/design-pattern. It therefore avoids the infamous "static initialization order fiasco", see http://www.parashift.com/c++-faq/ctors.html
Referenced by getComponentExtension(), and unloadActionExtension().
|
static |
Get the list of registered ComponentExtension.
The list contains unique elements (no duplicates possible) and is alphabitically sorted.
Referenced by main().
|
static |
get the plugin corresponding to a given data directory component extension's name.
Referenced by camitk::Application::openDirectory().
|
staticprivate |
get the singleton map of loaded component plugins for data directory (the key is the name) This is the private (intern) method.
The data directory component extension map is updated by loadExtension, unloadExtension and autoloadExtensions. This method follows the "construct on first use" idiom/design-pattern. It therefore avoids the infamous "static initialization order fiasco", see http://www.parashift.com/c++-faq/ctors.html
|
static |
Get the list of registered ComponentExtension working on directory.
The list contains unique elements (no duplicates possible) and is alphabitically sorted.
|
static |
get the list of all the name of the registered Component data directory
|
staticprivate |
return the extensions file filter
|
static |
get the list of all the suffixes managed by registered component extensions (all possible file suffix)
Referenced by camitk::Application::Application().
|
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:
file | the extension plugin file |
globalInstallDir | the global installation directory |
userInstallDir | the user installation directory |
currentWorkingDir | the current working directory |
|
staticprivate |
return the list of shared objects in a directory considering debug/release on MSVC
Referenced by autoload().
|
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.
|
staticprivate |
get the singleton map of loaded viewer plugins (the key is the shared object/dll/dylib filename) This is the private (intern) method.
The viewer extension map is updated by loadViewerExtension, unloadViewerExtension and autoloadViewerExtensions. This method follows the "construct on first use" idiom/design-pattern. It therefore avoids the infamous "static initialization order fiasco", see http://www.parashift.com/c++-faq/ctors.html
Referenced by unloadAllActionExtensions(), and unloadAllViewerExtensions().
|
static |
Get the list of registered ViewerExtension.
The list contains unique elements (no duplicates possible) and is alphabitically sorted.
Referenced by camitk::Application::getNewViewer(), and camitk::Application::getViewerExtension().
|
staticprivate |
Add the private library directories (lib/camitk-version) in the current session PATH:
|
static |
Load a specific extension from a file.
This methods loads a ActionExtension, ComponentExtension,... plugin from a .dll/.so/.dylib filename
type | the extension type |
file | the plugin filename (.dll/.so/.dylib) |
Referenced by main().
|
static |
Register the file extension with the current application for opening This function is called by registerFileExtensions.
fileExtension | the file extension to associate with the current application for opening |
Referenced by camitk::Application::Application().
|
static |
Unload an action extension using its .dll/.so/.dylib filename.
References getComponentExtensionMap().
Referenced by getActionExtensionMap().
|
static |
unload all action extensions and delete instantiated actions
References getViewerExtensionMap(), and viewerExtensionLessThan().
Referenced by camitk::Application::quitting().
|
static |
unload all viewer extensions and delete instantiated actions
References getViewerExtensionMap(), and camitk::Application::unregisterAllViewers().
Referenced by camitk::Application::quitting().
|
static |
Unload a plugin corresponding to a given extension or component name.
|
static |
Unload an viewer extension using its .dll/.so/.dylib filename.
Referenced by getActionExtension().
|
staticprivate |
Custom comparaison method between two ViewerExtension* based on the same principle as actionExtensionLessThan(..)
Referenced by unloadAllActionExtensions().