fw4spl
|
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< Bundle > | findBundle (const std::string &identifier, const Version &version=Version()) const |
Retrieves the bundle for the specified idenfier. More... | |
FWRUNTIME_API std::shared_ptr< Bundle > | findEnabledBundle (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 IExecutable * | createExecutableInstance (const std::string &type) |
Create an instance of the given executable object type. More... | |
FWRUNTIME_API IExecutable * | createExecutableInstance (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< ExecutableFactory > | findExecutableFactory (const std::string &type) const |
Retrieves the executable factory for the given identifier. More... | |
FWRUNTIME_API std::shared_ptr< IPlugin > | getPlugin (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< Extension > | findExtension (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< ExtensionPoint > | findExtensionPoint (const std::string &identifier) const |
Retrieves the extension point instance matching the specified identifier. More... | |
Static Public Member Functions | |
static FWRUNTIME_API Runtime * | getDefault () |
Retrieves the default runtime instance. | |
Defines the runtime class.
Definition at line 37 of file Runtime.hpp.
void fwRuntime::Runtime::addBundle | ( | std::shared_ptr< Bundle > | bundle | ) |
Adds a new bundle instance to the runtime system.
[in] | bundle | a shared pointer to the bundle instance to add |
Definition at line 83 of file Runtime.cpp.
References addExecutableFactory(), addExtension(), and addExtensionPoint().
Referenced by addBundles().
void fwRuntime::Runtime::addBundles | ( | const ::boost::filesystem::path & | repository | ) |
Adds all bundle found in the given path.
[in] | repository | a path that may containing bundles |
Definition at line 103 of file Runtime.cpp.
References addBundle().
Referenced by addDefaultBundles(), and fwRuntime::getBundleResourcePath().
void fwRuntime::Runtime::addDefaultBundles | ( | ) |
Adds all bundle found at the default location.
Definition at line 119 of file Runtime.cpp.
References addBundles(), bundlesBegin(), bundlesEnd(), getWorkingPath(), and SLM_ASSERT.
void fwRuntime::Runtime::addExecutableFactory | ( | std::shared_ptr< ExecutableFactory > | factory | ) |
Adds a new executable factory instance to the runtime system.
[in] | factory | a shared pointer to an executable factory |
Definition at line 147 of file Runtime.cpp.
References findExecutableFactory().
Referenced by addBundle(), and fwRuntime::ExecutableFactoryRegistrar::ExecutableFactoryRegistrar().
void fwRuntime::Runtime::addExtension | ( | std::shared_ptr< Extension > | extension | ) |
Registers a new extension.
[in] | extension | a shared pointer to the extension to register |
Definition at line 188 of file Runtime.cpp.
References findExtension().
Referenced by addBundle().
void fwRuntime::Runtime::addExtensionPoint | ( | std::shared_ptr< ExtensionPoint > | point | ) |
Registers a new extension point.
[in] | point | a pointer to the extension point to register |
Definition at line 228 of file Runtime.cpp.
References findExtensionPoint().
Referenced by addBundle().
Runtime::BundleIterator fwRuntime::Runtime::bundlesBegin | ( | ) |
Retrieves the iterator on the begining of the bundle collection.
Definition at line 133 of file Runtime.cpp.
Referenced by addDefaultBundles(), fwRuntime::Convert::runningBundlesToXml(), and monitorQt::action::ComponentsTree::updating().
Runtime::BundleIterator fwRuntime::Runtime::bundlesEnd | ( | ) |
Retrieves the iterator on the end of the bundle collection.
Definition at line 140 of file Runtime.cpp.
Referenced by addDefaultBundles(), fwRuntime::Convert::runningBundlesToXml(), and monitorQt::action::ComponentsTree::updating().
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.
[in] | type | a string containing an executable type |
Definition at line 329 of file Runtime.cpp.
References findExecutableFactory(), fwRuntime::IExecutable::setBundle(), and fwRuntime::IExecutable::setInitializationData().
Referenced by fwRuntime::Bundle::start().
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.
[in] | type | a string containing an executable type |
[in] | configurationElement | a shared pointer to the configuration element to use for the executable initialization |
Runtime::ExtensionIterator fwRuntime::Runtime::extensionsBegin | ( | ) |
Retrieves the iterator on the beginning of the extension collection.
Definition at line 214 of file Runtime.cpp.
Referenced by fwRuntime::ExtensionPoint::getAllExtensions(), and fwRuntime::profile::Profile::start().
Runtime::ExtensionIterator fwRuntime::Runtime::extensionsEnd | ( | ) |
Retrieves the iterator on the end of the extension collection.
Definition at line 221 of file Runtime.cpp.
Referenced by fwRuntime::ExtensionPoint::getAllExtensions(), and fwRuntime::profile::Profile::start().
std::shared_ptr< Bundle > fwRuntime::Runtime::findBundle | ( | const std::string & | identifier, |
const Version & | version = Version() |
||
) | const |
Retrieves the bundle for the specified idenfier.
[in] | identifier | a string containing a bundle identifier |
[in] | version | the version of the bundle (undefined by default) |
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().
std::shared_ptr< Bundle > fwRuntime::Runtime::findEnabledBundle | ( | const std::string & | identifier, |
const Version & | version = Version() |
||
) | const |
Retrieves the enabled bundle for the specified idenfier.
[in] | identifier | a string containing a bundle identifier |
[in] | version | the version of the bundle (undefined by default) |
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().
std::shared_ptr< ExecutableFactory > fwRuntime::Runtime::findExecutableFactory | ( | const std::string & | type | ) | const |
Retrieves the executable factory for the given identifier.
[in] | type | a string containing a type identifier |
Definition at line 172 of file Runtime.cpp.
Referenced by addExecutableFactory(), createExecutableInstance(), and unregisterExecutableFactory().
std::shared_ptr< Extension > fwRuntime::Runtime::findExtension | ( | const std::string & | identifier | ) | const |
Retrieves the extension instance matching the specified identifier.
[in] | identifier | a string containing an extension identifier |
Definition at line 297 of file Runtime.cpp.
Referenced by addExtension(), fwRuntime::findExtension(), and unregisterExtension().
std::shared_ptr< ExtensionPoint > fwRuntime::Runtime::findExtensionPoint | ( | const std::string & | identifier | ) | const |
Retrieves the extension point instance matching the specified identifier.
[in] | identifier | a string containing an extension point identifier |
Definition at line 313 of file Runtime.cpp.
Referenced by addExtensionPoint(), fwRuntime::findExtensionPoint(), unregisterExtensionPoint(), and fwRuntime::Extension::validate().
FWRUNTIME_API std::shared_ptr< IPlugin > fwRuntime::Runtime::getPlugin | ( | const std::shared_ptr< Bundle > | bundle | ) | const |
Retrieves the plugin instance for the specified bundle.
[in] | bundle | a shared pointer to a bundle instance |
boost::filesystem::path fwRuntime::Runtime::getWorkingPath | ( | ) | const |
Get the path where Bundles and share folder are located.
Definition at line 402 of file Runtime.cpp.
Referenced by addDefaultBundles(), fwRuntime::io::BundleDescriptorReader::createBundle(), fwRuntime::getLibraryResourceFilePath(), and fwTools::System::getTempPath().
void fwRuntime::Runtime::setWorkingPath | ( | const ::boost::filesystem::path & | workingPath | ) |
Set the working path where Bundles and share folder are located.
[in] | workingPath | a 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.
[in] | bundle | a shared pointer to the bundle instance to unregister |
Definition at line 96 of file Runtime.cpp.
Referenced by fwRuntime::Bundle::stop().
void fwRuntime::Runtime::unregisterExecutableFactory | ( | std::shared_ptr< ExecutableFactory > | factory | ) |
Unregister a new executable factory instance to the runtime system.
[in] | factory | a shared pointer to an executable factory |
Definition at line 161 of file Runtime.cpp.
References findExecutableFactory(), and SLM_WARN_IF.
void fwRuntime::Runtime::unregisterExtension | ( | std::shared_ptr< Extension > | extension | ) |
Unregister a new extension.
[in] | extension | a shared pointer to the extension to register |
Definition at line 202 of file Runtime.cpp.
References findExtension(), and SLM_WARN_IF.
void fwRuntime::Runtime::unregisterExtensionPoint | ( | std::shared_ptr< ExtensionPoint > | point | ) |
Unregister a new extension point.
[in] | point | a pointer to the extension point to register |
Definition at line 242 of file Runtime.cpp.
References findExtensionPoint(), and SLM_WARN_IF.