fw4spl
fwRuntime Namespace Reference

The namespace fwRuntime contains classes to manage bundle, configuration element, extension point in the runtime environment from a configuration file . More...

Namespaces

 dl
 The namespace fwRuntime::dl contains classes to manage library module.
 
 io
 The namespace fwRuntime::io contains classes to read and perform profile file .
 
 profile
 The namespace fwRuntime::profile contains classes to manage bundle declares in profile.xml file (activate/start/stop).
 
 utils
 The namespace fwRuntime::utils contains template executable factory classes.
 

Classes

struct  Bundle
 Defines the bundle class. More...
 
struct  BundleElement
 Implements the base class for all element managed by a bundle. More...
 
struct  ConfigurationElement
 Defines the configuration element class. More...
 
struct  ConfigurationElementContainer
 Defines the generic configuration element container class. More...
 
class  Convert
 Defines the convert class. More...
 
class  EConfigurationElement
 Editable configuration element : allow the self configuration element building, which reading XML structure provided by bundle descriptions. More...
 
struct  EmptyPlugin
 Implements a default plugin for bundles that don't provide a fwRuntime::IPlugin interface implementation. This plugin does nothing by default. It has not been design to be subclassed, but subclassing is neither forbidden. More...
 
struct  Executable
 Provides a default fwRuntime::IExecutable interface implementation.This class provides a default implementation of the fwRuntime::IExecutable interface and is intended to be used as base class for user defined executable classes being exported by bundles. More...
 
struct  ExecutableFactory
 Defines the abstract executable factory class. More...
 
struct  ExecutableFactoryRegistrar
 Defines an executable factory registrar class.An instance of this class is responsible for the registration of an executable factory instance in the runtime environment. The factory instace gets registered as soon as a registrar instance gets created. That's why this class is design to be instanciated as static object. More...
 
struct  Extension
 Defines the extension class. More...
 
struct  ExtensionPoint
 Defines the extension point class. More...
 
struct  IExecutable
 Defines the base executable interface.An executable object is an instance created by an extension point of a plugin. More...
 
struct  IPlugin
 Defines the plugin interface. More...
 
struct  Plugin
 Provides a default plugin implementation. More...
 
struct  Runtime
 Defines the runtime class. More...
 
struct  RuntimeException
 Defines the runtime exception class. More...
 
struct  Version
 Holds version information for libraries and bundles. More...
 

Functions

FWRUNTIME_API std::pair< bool, std::string > validateConfigurationElement (std::shared_ptr< ::fwRuntime::io::Validator > _validator,::fwRuntime::ConfigurationElement::sptr _element)
 Check configuration element (its XML representation) with respect to the validator (referencing the xsd schema) More...
 
FWRUNTIME_API void ConfigurationElement2XML (::fwRuntime::ConfigurationElement::sptr _cfgElement, xmlNodePtr pNode)
 Update pNode content according to _cfgElement. More...
 
FWRUNTIME_API ConfigurationElement::sptr getCfgAsAnExtension (ConfigurationElement::sptr _config, std::string _extension_pt)
 Returns the configuration element embedding the configuration to be considered for initializing an object or a service. More...
 
FWRUNTIME_API std::vector< ConfigurationElement::sptr > getAllCfgForPoint (std::string _extension_pt)
 Returns configuration elements extending the _extension_pt extension point.
 
FWRUNTIME_API std::vector< std::shared_ptr< ::fwRuntime::Extension > > getAllExtensionsForPoint (std::string extension_pt)
 Returns extensions extending the _extension_pt extension point.
 
FWRUNTIME_API std::map< std::string, ConfigurationElement::sptr > getAllIdAndConfigurationElementsForPoint (std::string _extension_pt)
 Returns contribution ids and configuration elements related to a given extension point. More...
 
FWRUNTIME_API std::vector< std::string > getAllIdsForPoint (std::string _extension_pt)
 Returns contribution ids to a given extension point. More...
 
FWRUNTIME_API std::string getInfoForPoint (std::string _extension_pt)
 Get information for the point. More...
 
FWRUNTIME_API std::shared_ptr< ExtensionPointfindExtensionPoint (const std::string &identifier)
 Retrieves the extension point having the specified identifier. More...
 
template<typename T >
T * createExecutableInstance (const std::shared_ptr< Extension > extension, const std::string &element="executable", const std::string &attribute="class")
 Creates an executable instance for the specified configuration element. More...
 
template<typename T >
T * createExecutableInstance (const std::shared_ptr< ConfigurationElement > element, const std::string &attribute="class")
 Creates an executable instance for the specifed configuration element. More...
 
template<typename OutputIterator >
void getAllExtensionsForPoint (const std::string &identifier, OutputIterator output)
 Retrieves all extensions for the point having the specified identifier. More...
 
template<typename OutputIterator >
void getAllConfigurationElementsForPoint (const std::string &identifier, OutputIterator output)
 Retrieves all configuration elements for the point having the specified identifier. More...
 
template<typename Container >
const Container getAllConfigurationElementsForPoint (const std::string &identifier)
 Retrieves all configuration elements for the point having the specified identifier. More...
 
template<typename Container , typename T >
const Container getAllExecutableForPoint (const std::string &identifier, const std::string &attribute="class")
 Retrieves all executable objects for the point having the specified identifier. More...
 
FWRUNTIME_API std::shared_ptr< ConfigurationElementfindConfigurationElement (const std::string &identifier, const std::string &pointIdentifier)
 Retrieve the configuation element with the given identifier for the given extension point. More...
 
FWRUNTIME_API std::shared_ptr< ExtensionfindExtension (const std::string &identifier)
 Retrieve the extension having the specified identifier. More...
 
FWRUNTIME_API::boost::filesystem::path getBundleResourcePath (const std::string &bundleIdentifier) noexcept
 Retrieve the filesystem valid path of resources of a bundle. More...
 
FWRUNTIME_API::boost::filesystem::path getBundleResourceFilePath (const std::string &bundleIdentifier, const ::boost::filesystem::path &path) noexcept
 Retrieve a filesystem valid path for a path relative to the bundle having the specified identifier. More...
 
FWRUNTIME_API::boost::filesystem::path getBundleResourceFilePath (const ::boost::filesystem::path &path) noexcept
 Retrieve a filesystem valid path for a resource path whose first element is a bundle identifier. For instance for "bundle-0.2/dir/file.txt", the function returns "/home/login/f4s/build/share/bundle-0.2/dir/file.txt". More...
 
FWRUNTIME_API::boost::filesystem::path getLibraryResourceFilePath (const ::boost::filesystem::path &path) noexcept
 Retrieve a filesystem valid path for a resource path whose first element is a library identifier. For instance for "fwLib-0.2/dir/file.txt", the function returns "/home/login/f4s/build/share/fwLib-0.2/dir/file.txt". More...
 
FWRUNTIME_API::boost::filesystem::path getResourceFilePath (const ::boost::filesystem::path &path) noexcept
 Retrieve a filesystem valid path for a resource path whose first element is a library or a bundle identifier. More...
 
FWRUNTIME_API::boost::filesystem::path getBundleResourcePath (std::shared_ptr< Bundle > bundle, const ::boost::filesystem::path &path) noexcept
 Retrieve a filesystem valid path for a path relative to the specified bundle. More...
 
FWRUNTIME_API::boost::filesystem::path getBundleResourcePath (std::shared_ptr< ConfigurationElement > element, const ::boost::filesystem::path &path) noexcept
 Retrieve a filesystem valid path for a path relative to the bundle of the specified configuration element. More...
 
FWRUNTIME_API::boost::filesystem::path getBundleResourcePath (const IExecutable *executable, const ::boost::filesystem::path &path) noexcept
 Retrieve a filesystem valid path for a path relative to the specified executable instance. More...
 
FWRUNTIME_API void addBundles (const boost::filesystem::path &directory)
 Loads all bundles that can be found in the specified directory. More...
 
FWRUNTIME_API std::shared_ptr< ::fwRuntime::profile::ProfilestartProfile (const boost::filesystem::path &path)
 Starts the given bundle set profile. More...
 
FWRUNTIME_API std::shared_ptr< BundlefindBundle (const std::string &identifier, const Version &version=Version())
 Retrieves the bundle with the given identifier and version. More...
 
FWRUNTIME_API void startBundle (const std::string &identifier)
 Starts the bundle specified by the given identifier. More...
 
std::ostream & operator<< (std::ostream &_sstream, ConfigurationElement &_configurationElement)
 
::boost::filesystem::path getBundleResourcePath (ConfigurationElement::sptr element, const ::boost::filesystem::path &path) noexcept
 
void addBundles (const ::boost::filesystem::path &directory)
 
::fwRuntime::profile::Profile::sptr startProfile (const ::boost::filesystem::path &path)
 
std::ostream & operator<< (std::ostream &os, const Version &version)
 

Detailed Description

The namespace fwRuntime contains classes to manage bundle, configuration element, extension point in the runtime environment from a configuration file .

Function Documentation

FWRUNTIME_API void fwRuntime::addBundles ( const boost::filesystem::path &  directory)

Loads all bundles that can be found in the specified directory.

Parameters
directorya path to the directory to explore for bundles

Referenced by getAllExecutableForPoint(), and getBundleResourcePath().

+ Here is the caller graph for this function:

void fwRuntime::ConfigurationElement2XML ( ::fwRuntime::ConfigurationElement::sptr  _cfgElement,
xmlNodePtr  pNode 
)

Update pNode content according to _cfgElement.

Note
Used to validate a configuration element vs a xsd schema.
Values are not managed yet (cases where curChild->type == XML_TEXT_NODE ).
To be integrated to configuration element.

Definition at line 51 of file fwRuntime/src/helper.cpp.

template<typename T >
T* fwRuntime::createExecutableInstance ( const std::shared_ptr< Extension extension,
const std::string &  element = "executable",
const std::string &  attribute = "class" 
)

Creates an executable instance for the specified configuration element.

Parameters
[in]extensiona shared to an extension containing a configuration element to use for the executable instance creation
[in]elementa string containing the name of a configuration element
[in]attributea string containing an element attribute name to use as the executable type
Returns
a shared pointer to the built executable object

Definition at line 61 of file operations.hpp.

template<typename T >
T* fwRuntime::createExecutableInstance ( const std::shared_ptr< ConfigurationElement element,
const std::string &  attribute = "class" 
)

Creates an executable instance for the specifed configuration element.

Parameters
[in]elementa shared pointer to a configuration element
[in]attributea string containing an element attribute name to use as the executable type
Returns
a shared pointer to the built executable object

Definition at line 87 of file operations.hpp.

References fwRuntime::Runtime::getDefault().

+ Here is the call graph for this function:

std::shared_ptr< Bundle > fwRuntime::findBundle ( const std::string &  identifier,
const Version version = Version() 
)

Retrieves the bundle with the given identifier and version.

Parameters
identifiera string containing a bunle identifier
versiona version (none by default)
Returns
a shared pointer to the found bundle, or empty when none

Definition at line 233 of file operations.cpp.

References fwRuntime::Runtime::findBundle(), and fwRuntime::Runtime::getDefault().

Referenced by getAllExecutableForPoint().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ConfigurationElement::sptr fwRuntime::findConfigurationElement ( const std::string &  identifier,
const std::string &  pointIdentifier 
)

Retrieve the configuation element with the given identifier for the given extension point.

Parameters
identifiera string containing the configuration element identifier
pointIdentifiera string containing the extension point identifier
Returns
a shared pointer to the found configuration element or null if none

Definition at line 56 of file operations.cpp.

Referenced by getAllExecutableForPoint().

+ Here is the caller graph for this function:

std::shared_ptr< Extension > fwRuntime::findExtension ( const std::string &  identifier)

Retrieve the extension having the specified identifier.

Parameters
identifiera string containing an extension identifier
Returns
a shared pointer to the found extension or null if none

Definition at line 75 of file operations.cpp.

References fwRuntime::Runtime::findExtension(), and fwRuntime::Runtime::getDefault().

Referenced by getAllExecutableForPoint().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::shared_ptr< ExtensionPoint > fwRuntime::findExtensionPoint ( const std::string &  identifier)

Retrieves the extension point having the specified identifier.

Parameters
[in]identifiera string containing an extension point identifier
Returns
a pointer to the found extension point or null if none

Definition at line 83 of file operations.cpp.

References fwRuntime::Runtime::findExtensionPoint(), and fwRuntime::Runtime::getDefault().

Referenced by getAllConfigurationElementsForPoint(), getAllExtensionsForPoint(), and getInfoForPoint().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename OutputIterator >
void fwRuntime::getAllConfigurationElementsForPoint ( const std::string &  identifier,
OutputIterator  output 
)

Retrieves all configuration elements for the point having the specified identifier.

Parameters
identifiera string containing an extension point identifier
outputan insert iterator used to store found configuration elements

Definition at line 146 of file operations.hpp.

References findExtensionPoint(), OSLM_DEBUG, and OSLM_TRACE.

Referenced by getAllConfigurationElementsForPoint().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename Container >
const Container fwRuntime::getAllConfigurationElementsForPoint ( const std::string &  identifier)

Retrieves all configuration elements for the point having the specified identifier.

This method use the container type specified by the template parameter. The type of the elements of the container must be std::shared_ptr< ConfigurationElement > or the compilation will fail.

Returns
a container containing shared pointers to all found configuration elements

Definition at line 185 of file operations.hpp.

References getAllConfigurationElementsForPoint().

+ Here is the call graph for this function:

template<typename Container , typename T >
const Container fwRuntime::getAllExecutableForPoint ( const std::string &  identifier,
const std::string &  attribute = "class" 
)

Retrieves all executable objects for the point having the specified identifier.

Parameters
identifiera string containing the extension point identifier
attributea string containing the name of the element attribute containing the executable identifier (default is "class")

This method use the container type specified by the template parameter. The type of the elements of the container must be std::shared_ptr< T > or the compilation will fail (where T is the type of the executable you want to create).

Returns
a container containing shared pointers to all created executable instances

Definition at line 213 of file operations.hpp.

References addBundles(), fwRuntime::ConfigurationElementContainer::begin(), fwRuntime::ConfigurationElementContainer::end(), findBundle(), findConfigurationElement(), findExtension(), getBundleResourceFilePath(), getBundleResourcePath(), getLibraryResourceFilePath(), getResourceFilePath(), startBundle(), and startProfile().

+ Here is the call graph for this function:

template<typename OutputIterator >
void fwRuntime::getAllExtensionsForPoint ( const std::string &  identifier,
OutputIterator  output 
)

Retrieves all extensions for the point having the specified identifier.

Parameters
identifiera string containing an extension point identifier
outputan insert iterator used to store each found extension

Definition at line 123 of file operations.hpp.

References findExtensionPoint().

+ Here is the call graph for this function:

std::map< std::string, ConfigurationElement::sptr > fwRuntime::getAllIdAndConfigurationElementsForPoint ( std::string  _extension_pt)

Returns contribution ids and configuration elements related to a given extension point.

Parameters
[in]_extension_pt: identifier of the extension point to which configuration elements contribute
Returns
Map associating contribution ids and associated configuration elements contributing to the extension point _extension_pt
Note
Configuration element identifiers are value of attributes "id".

Definition at line 190 of file fwRuntime/src/helper.cpp.

std::vector< std::string > fwRuntime::getAllIdsForPoint ( std::string  _extension_pt)

Returns contribution ids to a given extension point.

Parameters
[in]_extension_pt: identifier of the extension point to which configuration elements contribute
Returns
Map associating contribution ids and associated configuration elements contributing to the extension point _extension_pt
Note
Configuration element identifiers are value of attributes "id".

Definition at line 137 of file fwRuntime/src/helper.cpp.

boost::filesystem::path fwRuntime::getBundleResourceFilePath ( const std::string &  bundleIdentifier,
const ::boost::filesystem::path &  path 
)
noexcept

Retrieve a filesystem valid path for a path relative to the bundle having the specified identifier.

Parameters
bundleIdentifiera string containing a bundle identifier
patha bundle relative path
Returns
a system valid path

Definition at line 106 of file operations.cpp.

References fwRuntime::Runtime::findBundle(), getBundleResourcePath(), fwRuntime::Runtime::getDefault(), and SLM_ERROR.

Referenced by getAllExecutableForPoint(), uiImageQt::WindowLevel::starting(), and guiQt::Plugin::stop().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

boost::filesystem::path fwRuntime::getBundleResourceFilePath ( const ::boost::filesystem::path &  path)
noexcept

Retrieve a filesystem valid path for a resource path whose first element is a bundle identifier. For instance for "bundle-0.2/dir/file.txt", the function returns "/home/login/f4s/build/share/bundle-0.2/dir/file.txt".

Parameters
pathrelative path whose first element is a bundle identifier
Returns
a system valid path

Definition at line 122 of file operations.cpp.

References fwRuntime::Runtime::findBundle(), getBundleResourcePath(), fwRuntime::Runtime::getDefault(), SLM_ASSERT, SLM_ERROR, and fwRuntime::Version::string().

+ Here is the call graph for this function:

boost::filesystem::path fwRuntime::getBundleResourcePath ( const std::string &  bundleIdentifier)
noexcept

Retrieve the filesystem valid path of resources of a bundle.

Parameters
bundleIdentifiera string containing a bundle identifier
Returns
a system valid path

Definition at line 91 of file operations.cpp.

References fwRuntime::Runtime::findBundle(), fwRuntime::Runtime::getDefault(), and SLM_ERROR.

Referenced by getAllExecutableForPoint(), getBundleResourceFilePath(), and getBundleResourcePath().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

boost::filesystem::path fwRuntime::getBundleResourcePath ( std::shared_ptr< Bundle bundle,
const ::boost::filesystem::path &  path 
)
noexcept

Retrieve a filesystem valid path for a path relative to the specified bundle.

Parameters
bundlea pointer to a bundle instance
patha path relative to the bundle
Returns
a system valid path

Definition at line 185 of file operations.cpp.

References getBundleResourcePath().

+ Here is the call graph for this function:

FWRUNTIME_API ::boost::filesystem::path fwRuntime::getBundleResourcePath ( std::shared_ptr< ConfigurationElement element,
const ::boost::filesystem::path &  path 
)
noexcept

Retrieve a filesystem valid path for a path relative to the bundle of the specified configuration element.

Parameters
elementa shared pointer to a configuration element instance
patha path relative to the bundle
Returns
a system valid path
boost::filesystem::path fwRuntime::getBundleResourcePath ( const IExecutable executable,
const ::boost::filesystem::path &  path 
)
noexcept

Retrieve a filesystem valid path for a path relative to the specified executable instance.

Parameters
executablea pointer to an executable instance
patha path relative to the bundle
Returns
a system valid path

Definition at line 201 of file operations.cpp.

References fwRuntime::Runtime::addBundles(), addBundles(), fwRuntime::io::ProfileReader::createProfile(), getBundleResourcePath(), fwRuntime::Runtime::getDefault(), and startProfile().

+ Here is the call graph for this function:

ConfigurationElement::sptr fwRuntime::getCfgAsAnExtension ( ConfigurationElement::sptr  _config,
std::string  _extension_pt 
)

Returns the configuration element embedding the configuration to be considered for initializing an object or a service.

Parameters
[in]_config: configuration element containing an attribute "config" specifying the name of the contribution to consider
[in]_extension_pt: extension point to which the configuration should contribute with the name indicated by the previous "config" attribute value

Definition at line 83 of file fwRuntime/src/helper.cpp.

References OSLM_FATAL_IF, OSLM_WARN_IF, and SLM_WARN_IF.

std::string fwRuntime::getInfoForPoint ( std::string  _extension_pt)

Get information for the point.

Returns
a string with the information of the extension point

Definition at line 160 of file fwRuntime/src/helper.cpp.

References findExtensionPoint().

+ Here is the call graph for this function:

boost::filesystem::path fwRuntime::getLibraryResourceFilePath ( const ::boost::filesystem::path &  path)
noexcept

Retrieve a filesystem valid path for a resource path whose first element is a library identifier. For instance for "fwLib-0.2/dir/file.txt", the function returns "/home/login/f4s/build/share/fwLib-0.2/dir/file.txt".

Parameters
pathrelative path whose first element is a library identifier
Returns
a system valid path

Definition at line 161 of file operations.cpp.

References fwRuntime::Runtime::getDefault(), and fwRuntime::Runtime::getWorkingPath().

Referenced by getAllExecutableForPoint().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

boost::filesystem::path fwRuntime::getResourceFilePath ( const ::boost::filesystem::path &  path)
noexcept

Retrieve a filesystem valid path for a resource path whose first element is a library or a bundle identifier.

For instance for a library:

  • "fwLib-0.2/dir/file.txt" the function returns:
  • "/home/login/f4s/build/share/fwLib-0.2/dir/file.txt"

For instance for a bundle:

  • "bundle-0.2/dir/file.txt" the function returns:

"/home/login/f4s/build/share/bundle-0.2/dir/file.txt"

Parameters
pathrelative path whose first element is a bundle or library identifier
Returns
a system valid path or an empty path if nothing is found

Definition at line 171 of file operations.cpp.

References SLM_ERROR_IF.

Referenced by getAllExecutableForPoint().

+ Here is the caller graph for this function:

void fwRuntime::startBundle ( const std::string &  identifier)

Starts the bundle specified by the given identifier.

Parameters
identifiera string containing a bundle identifier

Definition at line 240 of file operations.cpp.

References fwRuntime::Runtime::findBundle(), and fwRuntime::Runtime::getDefault().

Referenced by getAllExecutableForPoint().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

FWRUNTIME_API std::shared_ptr< ::fwRuntime::profile::Profile > fwRuntime::startProfile ( const boost::filesystem::path &  path)

Starts the given bundle set profile.

Parameters
patha path to an xml profile file
Returns
a shared pointer to the started profile

Referenced by getAllExecutableForPoint(), and getBundleResourcePath().

+ Here is the caller graph for this function:

std::pair< bool, std::string > fwRuntime::validateConfigurationElement ( std::shared_ptr< ::fwRuntime::io::Validator _validator,
::fwRuntime::ConfigurationElement::sptr  _element 
)

Check configuration element (its XML representation) with respect to the validator (referencing the xsd schema)

Note
Used to check any service/object based configurations as well as runtime extensions.
Returns
(true,"") if configuration element is correct vs validator, else (false,std::string(error message)) otherwise

Definition at line 20 of file fwRuntime/src/helper.cpp.

References SLM_ASSERT.