fw4spl
fwRuntime::Runtime Struct Reference

Defines the runtime class. More...

#include <Runtime.hpp>

Public Types

Type Definitions
typedef std::set< std::shared_ptr< Bundle > > BundleContainer
 Defines the bundle container type.
 
typedef BundleContainer::iterator BundleIterator
 Defines the bundle container iterator type.
 
typedef std::set< std::shared_ptr< Extension > > ExtensionContainer
 Defines the extension container type.
 
typedef ExtensionContainer::iterator ExtensionIterator
 Defines the extension container type.
 

Public Member Functions

 ~Runtime ()
 Destructor : does nothing.
 
FWRUNTIME_API void setWorkingPath (const ::boost::filesystem::path &workingPath)
 Set the working path where Bundles and share folder are located. More...
 
FWRUNTIME_API::boost::filesystem::path getWorkingPath () const
 Get the path where Bundles and share folder are located. More...
 
Bundles
FWRUNTIME_API void addBundle (std::shared_ptr< Bundle > bundle)
 Adds a new bundle instance to the runtime system. More...
 
FWRUNTIME_API void unregisterBundle (std::shared_ptr< Bundle > bundle)
 Unregister a bundle instance to the runtime system. More...
 
FWRUNTIME_API void addBundles (const ::boost::filesystem::path &repository)
 Adds all bundle found in the given path. More...
 
FWRUNTIME_API void addDefaultBundles ()
 Adds all bundle found at the default location. More...
 
FWRUNTIME_API BundleIterator bundlesBegin ()
 Retrieves the iterator on the begining of the bundle collection. More...
 
FWRUNTIME_API BundleIterator bundlesEnd ()
 Retrieves the iterator on the end of the bundle collection. More...
 
FWRUNTIME_API std::shared_ptr< BundlefindBundle (const std::string &identifier, const Version &version=Version()) const
 Retrieves the bundle for the specified idenfier. More...
 
FWRUNTIME_API std::shared_ptr< BundlefindEnabledBundle (const std::string &identifier, const Version &version=Version()) const
 Retrieves the enabled bundle for the specified idenfier. More...
 
Executable, Executable Factories & Dynamic Executable Instanciation
FWRUNTIME_API void addExecutableFactory (std::shared_ptr< ExecutableFactory > factory)
 Adds a new executable factory instance to the runtime system. More...
 
FWRUNTIME_API void unregisterExecutableFactory (std::shared_ptr< ExecutableFactory > factory)
 Unregister a new executable factory instance to the runtime system. More...
 
FWRUNTIME_API IExecutablecreateExecutableInstance (const std::string &type)
 Create an instance of the given executable object type. More...
 
FWRUNTIME_API IExecutablecreateExecutableInstance (const std::string &type, std::shared_ptr< ConfigurationElement > configurationElement)
 Create an instance of the given executable object type and configuration element. More...
 
FWRUNTIME_API std::shared_ptr< ExecutableFactoryfindExecutableFactory (const std::string &type) const
 Retrieves the executable factory for the given identifier. More...
 
FWRUNTIME_API std::shared_ptr< IPlugingetPlugin (const std::shared_ptr< Bundle > bundle) const
 Retrieves the plugin instance for the specified bundle. More...
 
Extensions
FWRUNTIME_API void addExtension (std::shared_ptr< Extension > extension)
 Registers a new extension. More...
 
FWRUNTIME_API void unregisterExtension (std::shared_ptr< Extension > extension)
 Unregister a new extension. More...
 
FWRUNTIME_API ExtensionIterator extensionsBegin ()
 Retrieves the iterator on the beginning of the extension collection. More...
 
FWRUNTIME_API ExtensionIterator extensionsEnd ()
 Retrieves the iterator on the end of the extension collection. More...
 
FWRUNTIME_API std::shared_ptr< ExtensionfindExtension (const std::string &identifier) const
 Retrieves the extension instance matching the specified identifier. More...
 
Extension Points
FWRUNTIME_API void addExtensionPoint (std::shared_ptr< ExtensionPoint > point)
 Registers a new extension point. More...
 
FWRUNTIME_API void unregisterExtensionPoint (std::shared_ptr< ExtensionPoint > point)
 Unregister a new extension point. More...
 
FWRUNTIME_API std::shared_ptr< ExtensionPointfindExtensionPoint (const std::string &identifier) const
 Retrieves the extension point instance matching the specified identifier. More...
 

Static Public Member Functions

static FWRUNTIME_API RuntimegetDefault ()
 Retrieves the default runtime instance.
 

Detailed Description

Defines the runtime class.

Definition at line 37 of file Runtime.hpp.

Member Function Documentation

void fwRuntime::Runtime::addBundle ( std::shared_ptr< Bundle bundle)

Adds a new bundle instance to the runtime system.

Remarks
The given bundle state will be altered according to the current configuration rules.
Parameters
[in]bundlea shared pointer to the bundle instance to add

Definition at line 83 of file Runtime.cpp.

References addExecutableFactory(), addExtension(), and addExtensionPoint().

Referenced by addBundles().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fwRuntime::Runtime::addBundles ( const ::boost::filesystem::path &  repository)

Adds all bundle found in the given path.

Parameters
[in]repositorya path that may containing bundles

Definition at line 103 of file Runtime.cpp.

References addBundle().

Referenced by addDefaultBundles(), and fwRuntime::getBundleResourcePath().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fwRuntime::Runtime::addDefaultBundles ( )

Adds all bundle found at the default location.

Remarks
The given bundle state will be altered according to the current configuration rules.

Definition at line 119 of file Runtime.cpp.

References addBundles(), bundlesBegin(), bundlesEnd(), getWorkingPath(), and SLM_ASSERT.

+ Here is the call graph for this function:

void fwRuntime::Runtime::addExecutableFactory ( std::shared_ptr< ExecutableFactory factory)

Adds a new executable factory instance to the runtime system.

Parameters
[in]factorya shared pointer to an executable factory

Definition at line 147 of file Runtime.cpp.

References findExecutableFactory().

Referenced by addBundle(), and fwRuntime::ExecutableFactoryRegistrar::ExecutableFactoryRegistrar().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fwRuntime::Runtime::addExtension ( std::shared_ptr< Extension extension)

Registers a new extension.

Parameters
[in]extensiona shared pointer to the extension to register

Definition at line 188 of file Runtime.cpp.

References findExtension().

Referenced by addBundle().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fwRuntime::Runtime::addExtensionPoint ( std::shared_ptr< ExtensionPoint point)

Registers a new extension point.

Parameters
[in]pointa pointer to the extension point to register

Definition at line 228 of file Runtime.cpp.

References findExtensionPoint().

Referenced by addBundle().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Runtime::BundleIterator fwRuntime::Runtime::bundlesBegin ( )

Retrieves the iterator on the begining of the bundle collection.

Returns
an iterator

Definition at line 133 of file Runtime.cpp.

Referenced by addDefaultBundles(), fwRuntime::Convert::runningBundlesToXml(), and monitorQt::action::ComponentsTree::updating().

+ Here is the caller graph for this function:

Runtime::BundleIterator fwRuntime::Runtime::bundlesEnd ( )

Retrieves the iterator on the end of the bundle collection.

Returns
an iterator

Definition at line 140 of file Runtime.cpp.

Referenced by addDefaultBundles(), fwRuntime::Convert::runningBundlesToXml(), and monitorQt::action::ComponentsTree::updating().

+ Here is the caller graph for this function:

IExecutable * fwRuntime::Runtime::createExecutableInstance ( const std::string &  type)

Create an instance of the given executable object type.

An attempt is made to retrieve a registered executable factory. If none is found, the creation will fail.

Remarks
This method will not try to load any bundle.
Parameters
[in]typea string containing an executable type
Returns
a pointer to the created executable instance

Definition at line 329 of file Runtime.cpp.

References findExecutableFactory(), fwRuntime::IExecutable::setBundle(), and fwRuntime::IExecutable::setInitializationData().

Referenced by fwRuntime::Bundle::start().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

FWRUNTIME_API IExecutable* fwRuntime::Runtime::createExecutableInstance ( const std::string &  type,
std::shared_ptr< ConfigurationElement configurationElement 
)

Create an instance of the given executable object type and configuration element.

An attempt is made to find a registered executable factory. If none is found, the bundle of the given configuration element is started in the hope it will register a executable factory for the given type. Then an executable factory for the given type is searched once again and the instantiation procedure goes further.

Parameters
[in]typea string containing an executable type
[in]configurationElementa shared pointer to the configuration element to use for the executable initialization
Returns
a pointer to the created executable instance
Runtime::ExtensionIterator fwRuntime::Runtime::extensionsBegin ( )

Retrieves the iterator on the beginning of the extension collection.

Returns
an iterator

Definition at line 214 of file Runtime.cpp.

Referenced by fwRuntime::ExtensionPoint::getAllExtensions(), and fwRuntime::profile::Profile::start().

+ Here is the caller graph for this function:

Runtime::ExtensionIterator fwRuntime::Runtime::extensionsEnd ( )

Retrieves the iterator on the end of the extension collection.

Returns
an iterator

Definition at line 221 of file Runtime.cpp.

Referenced by fwRuntime::ExtensionPoint::getAllExtensions(), and fwRuntime::profile::Profile::start().

+ Here is the caller graph for this function:

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

Retrieves the bundle for the specified idenfier.

Parameters
[in]identifiera string containing a bundle identifier
[in]versionthe version of the bundle (undefined by default)
Returns
a shared pointer to the found bundle or null if none

Definition at line 254 of file Runtime.cpp.

Referenced by fwRuntime::profile::Activater::apply(), fwRuntime::findBundle(), fwRuntime::getBundleResourceFilePath(), fwRuntime::getBundleResourcePath(), fwRuntime::io::BundleDescriptorReader::processConfigurationElement(), and fwRuntime::startBundle().

+ Here is the caller graph for this function:

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

Retrieves the enabled bundle for the specified idenfier.

Parameters
[in]identifiera string containing a bundle identifier
[in]versionthe version of the bundle (undefined by default)
Returns
a shared pointer to the found bundle or null if none

Definition at line 270 of file Runtime.cpp.

Referenced by fwRuntime::profile::Initializer::apply(), fwRuntime::profile::Uninitializer::apply(), fwRuntime::profile::Stopper::apply(), fwRuntime::profile::Starter::apply(), and fwRuntime::Bundle::getVersion().

+ Here is the caller graph for this function:

std::shared_ptr< ExecutableFactory > fwRuntime::Runtime::findExecutableFactory ( const std::string &  type) const

Retrieves the executable factory for the given identifier.

Parameters
[in]typea string containing a type identifier
Returns
a sgared pointer to the found executable factory or null of none

Definition at line 172 of file Runtime.cpp.

Referenced by addExecutableFactory(), createExecutableInstance(), and unregisterExecutableFactory().

+ Here is the caller graph for this function:

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

Retrieves the extension instance matching the specified identifier.

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

Definition at line 297 of file Runtime.cpp.

Referenced by addExtension(), fwRuntime::findExtension(), and unregisterExtension().

+ Here is the caller graph for this function:

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

Retrieves the extension point instance matching the specified identifier.

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

Definition at line 313 of file Runtime.cpp.

Referenced by addExtensionPoint(), fwRuntime::findExtensionPoint(), unregisterExtensionPoint(), and fwRuntime::Extension::validate().

+ Here is the caller graph for this function:

FWRUNTIME_API std::shared_ptr< IPlugin > fwRuntime::Runtime::getPlugin ( const std::shared_ptr< Bundle bundle) const

Retrieves the plugin instance for the specified bundle.

Parameters
[in]bundlea shared pointer to a bundle instance
Returns
a shared pointer to a plugin instance or null if none
boost::filesystem::path fwRuntime::Runtime::getWorkingPath ( ) const

Get the path where Bundles and share folder are located.

Returns
a boost path.

Definition at line 402 of file Runtime.cpp.

Referenced by addDefaultBundles(), fwRuntime::io::BundleDescriptorReader::createBundle(), fwRuntime::getLibraryResourceFilePath(), and fwTools::System::getTempPath().

+ Here is the caller graph for this function:

void fwRuntime::Runtime::setWorkingPath ( const ::boost::filesystem::path &  workingPath)

Set the working path where Bundles and share folder are located.

Parameters
[in]workingPatha boost path.

Definition at line 395 of file Runtime.cpp.

void fwRuntime::Runtime::unregisterBundle ( std::shared_ptr< Bundle bundle)

Unregister a bundle instance to the runtime system.

Parameters
[in]bundlea shared pointer to the bundle instance to unregister

Definition at line 96 of file Runtime.cpp.

Referenced by fwRuntime::Bundle::stop().

+ Here is the caller graph for this function:

void fwRuntime::Runtime::unregisterExecutableFactory ( std::shared_ptr< ExecutableFactory factory)

Unregister a new executable factory instance to the runtime system.

Parameters
[in]factorya shared pointer to an executable factory

Definition at line 161 of file Runtime.cpp.

References findExecutableFactory(), and SLM_WARN_IF.

+ Here is the call graph for this function:

void fwRuntime::Runtime::unregisterExtension ( std::shared_ptr< Extension extension)

Unregister a new extension.

Parameters
[in]extensiona shared pointer to the extension to register

Definition at line 202 of file Runtime.cpp.

References findExtension(), and SLM_WARN_IF.

+ Here is the call graph for this function:

void fwRuntime::Runtime::unregisterExtensionPoint ( std::shared_ptr< ExtensionPoint point)

Unregister a new extension point.

Parameters
[in]pointa pointer to the extension point to register

Definition at line 242 of file Runtime.cpp.

References findExtensionPoint(), and SLM_WARN_IF.

+ Here is the call graph for this function:


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