fw4spl
fwRuntime::Bundle Struct Reference

Defines the bundle class. More...

#include <Bundle.hpp>

+ Inheritance diagram for fwRuntime::Bundle:
+ Collaboration diagram for fwRuntime::Bundle:

Public Types

Type definitions
typedef std::set< std::shared_ptr< ExecutableFactory > > ExecutableFactoryContainer
 Defines the executable.
 
typedef ExecutableFactoryContainer::const_iterator ExecutableFactoryConstIterator
 Defines the executable.
 
typedef std::set< std::shared_ptr< Extension > > ExtensionContainer
 Defines the extension container.
 
typedef ExtensionContainer::const_iterator ExtensionConstIterator
 Defines the extension container.
 
typedef std::set< std::shared_ptr< ExtensionPoint > > ExtensionPointContainer
 Defines the extension point.
 
typedef ExtensionPointContainer::const_iterator ExtensionPointConstIterator
 Defines the extension point.
 
typedef std::set< std::shared_ptr< dl::Library > > LibraryContainer
 Defines the dynamic library container.
 
typedef LibraryContainer::const_iterator LibraryConstIterator
 Defines the dynamic library container.
 

Public Member Functions

FWRUNTIME_API void initialize ()
 Initialize the bundle. More...
 
FWRUNTIME_API void uninitialize ()
 
bool isStarted ()
 
bool isInitialized ()
 
Dynamic Libraries
FWRUNTIME_API void addLibrary (std::shared_ptr< dl::Library > library)
 Adds the specified library to the bundle. More...
 
FWRUNTIME_API LibraryConstIterator librariesBegin () const
 Retrieves the iterator on the first item in the managed dynamic library collection. More...
 
FWRUNTIME_API LibraryConstIterator librariesEnd () const
 Retrieves the iterator on the ending item in the managed dynamic library collection. More...
 
Executable Factories & Dynamic Objects Instantiation
FWRUNTIME_API void addExecutableFactory (std::shared_ptr< ExecutableFactory > factory)
 Adds an executable factory instance to the bundle. More...
 
FWRUNTIME_API IExecutablecreateExecutableInstance (const std::string &type)
 Create an instance of the given executable object type. More...
 
FWRUNTIME_API ExecutableFactoryConstIterator executableFactoriesBegin () const
 Retrieves the iterator on the first item in the managed executable factory collection. More...
 
FWRUNTIME_API ExecutableFactoryConstIterator executableFactoriesEnd () const
 Retrieves the iterator on the ending item in the managed executable factory collection. More...
 
FWRUNTIME_API std::shared_ptr< ExecutableFactoryfindExecutableFactory (const std::string &type) const
 Retrieves the executable factory instance for the specified type name. More...
 
Extensions
void addExtension (std::shared_ptr< Extension > extension)
 Adds the specified extension to the bundle. More...
 
FWRUNTIME_API bool hasExtension (const std::string &identifier) const
 Tells if an specific extension exists. More...
 
FWRUNTIME_API void setEnableExtension (const std::string &identifier, const bool enable)
 Search a specific extension in the bundle to enable or disable it. More...
 
FWRUNTIME_API ExtensionConstIterator extensionsBegin () const
 Retrieves the iterator on the first item in the managed extension collection. More...
 
FWRUNTIME_API ExtensionConstIterator extensionsEnd () const
 Retrieves the iterator on the ending item in the managed extension collection. More...
 
Extension Points
void addExtensionPoint (std::shared_ptr< ExtensionPoint > extension)
 Adds the specified extension point to the bundle. More...
 
FWRUNTIME_API std::shared_ptr< ExtensionPointfindExtensionPoint (const std::string &identifier) const
 Retrieves the extension point for the given identifier. More...
 
FWRUNTIME_API bool hasExtensionPoint (const std::string &identifier) const
 Tells if a specific extension point exists. More...
 
FWRUNTIME_API void setEnableExtensionPoint (const std::string &identifier, const bool enable)
 Search a specific extension point in the bundle to enable or disable it. More...
 
FWRUNTIME_API ExtensionPointConstIterator extensionPointsBegin () const
 Retrieves the iterator on the first item in the managed extension point collection. More...
 
FWRUNTIME_API ExtensionPointConstIterator extensionPointsEnd () const
 Retrieves the iterator on the ending item in the managed extension point collection. More...
 
Misc
FWRUNTIME_API void addRequirement (const std::string &requirement)
 Adds a requirement to the bundle. More...
 
FWRUNTIME_API const std::string & getIdentifier () const
 Retrieves the bundle identifier. More...
 
FWRUNTIME_APIconst::boost::filesystem::path & getLibraryLocation () const
 Retrieves the bundle location. More...
 
FWRUNTIME_APIconst::boost::filesystem::path & getResourcesLocation () const
 Retrieves the bundle location. More...
 
FWRUNTIME_API const std::string getClass () const
 Retrieves the class representing the bundle executable part. More...
 
FWRUNTIME_API const VersiongetVersion () const
 Retrieves the version of the bundle. More...
 
FWRUNTIME_API std::shared_ptr< IPlugingetPlugin () const
 Retrieves the plugin instance for the specified bundle identifier. More...
 
State Management
FWRUNTIME_API bool isEnable () const
 Tells if the bundle is enable.
 
FWRUNTIME_API void setEnable (const bool state)
 Changes the enable state of the bundle. More...
 
FWRUNTIME_API void start ()
 Starts the bundle. More...
 
FWRUNTIME_API void stop ()
 Tells if the bundle is enable.
 
Parameters Management
FWRUNTIME_API void addParameter (const std::string &identifier, const std::string &value)
 Adds a parameter to the bundle. More...
 
FWRUNTIME_API const std::string getParameterValue (const std::string &identifier) const
 Retrieves the value of the given parameter. More...
 
FWRUNTIME_API bool hasParameter (const std::string &name) const
 Tells if a parameter exists. More...
 

Static Public Member Functions

static std::shared_ptr< BundlegetLoadingBundle ()
 Retrieves the pointer to the bundle that is currently loading its dynamic libraries.
 
static FWRUNTIME_API std::string getBundleStr (const std::string &identifier, const Version &version)
 

Static Public Attributes

static const char s_VERSION_DELIMITER = '-'
 

Protected Member Functions

 Bundle (const ::boost::filesystem::path &location, const std::string &id, const std::string &version)
 Constructor. More...
 
 Bundle (const ::boost::filesystem::path &location, const std::string &id, const std::string &version, const std::string &pluginClass)
 Constructor. More...
 

Friends

struct ::fwRuntime::io::BundleDescriptorReader
 

Detailed Description

Defines the bundle class.

Definition at line 45 of file Bundle.hpp.

Constructor & Destructor Documentation

fwRuntime::Bundle::Bundle ( const ::boost::filesystem::path &  location,
const std::string &  id,
const std::string &  version 
)
protected

Constructor.

Parameters
[in]locationa path to the directory containing the bundle
[in]ida string containing the bundle identifier
[in]versiona string containing the bundle version

Definition at line 44 of file Bundle.cpp.

fwRuntime::Bundle::Bundle ( const ::boost::filesystem::path &  location,
const std::string &  id,
const std::string &  version,
const std::string &  pluginClass 
)
protected

Constructor.

Parameters
[in]locationa path to the directory containing the bundle
[in]ida string containing the bundle identifier
[in]versiona string containing the bundler version
[in]pluginClassa string containing the bundle's pugin class name

Definition at line 53 of file Bundle.cpp.

References SLM_ASSERT.

Member Function Documentation

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

Adds an executable factory instance to the bundle.

Parameters
[in]factorya shared pointer to the executable factory instance to add

Definition at line 78 of file Bundle.cpp.

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

Adds the specified extension to the bundle.

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

Definition at line 115 of file Bundle.cpp.

void fwRuntime::Bundle::addExtensionPoint ( std::shared_ptr< ExtensionPoint extension)

Adds the specified extension point to the bundle.

Parameters
[in]extensiona shared pointer to the extension point to add

Definition at line 165 of file Bundle.cpp.

void fwRuntime::Bundle::addLibrary ( std::shared_ptr< dl::Library library)

Adds the specified library to the bundle.

Parameters
[in]librarya shared pointer to the library to add

Definition at line 232 of file Bundle.cpp.

References fwRuntime::dl::LibraryBridge< Implementor >::setBundle().

+ Here is the call graph for this function:

void fwRuntime::Bundle::addParameter ( const std::string &  identifier,
const std::string &  value 
)

Adds a parameter to the bundle.

Parameters
[in]identifiera string containing the parameter identifier
[in]valuea string containing the parameter value

Definition at line 554 of file Bundle.cpp.

void fwRuntime::Bundle::addRequirement ( const std::string &  requirement)

Adds a requirement to the bundle.

Parameters
[in]requirementa string containing a bundle identifier that is required

Definition at line 254 of file Bundle.cpp.

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

Create an instance of the given executable object type.

Parameters
typea string containing an executable type
Returns
a pointer to the created executable instance
Bundle::ExecutableFactoryConstIterator fwRuntime::Bundle::executableFactoriesBegin ( ) const

Retrieves the iterator on the first item in the managed executable factory collection.

Returns
an iterator

Definition at line 85 of file Bundle.cpp.

Bundle::ExecutableFactoryConstIterator fwRuntime::Bundle::executableFactoriesEnd ( ) const

Retrieves the iterator on the ending item in the managed executable factory collection.

Returns
an iterator

Definition at line 92 of file Bundle.cpp.

Bundle::ExtensionPointConstIterator fwRuntime::Bundle::extensionPointsBegin ( ) const

Retrieves the iterator on the first item in the managed extension point collection.

Returns
an iterator

Definition at line 218 of file Bundle.cpp.

Bundle::ExtensionPointConstIterator fwRuntime::Bundle::extensionPointsEnd ( ) const

Retrieves the iterator on the ending item in the managed extension point collection.

Returns
an iterator

Definition at line 225 of file Bundle.cpp.

Bundle::ExtensionConstIterator fwRuntime::Bundle::extensionsBegin ( ) const

Retrieves the iterator on the first item in the managed extension collection.

Returns
an iterator

Definition at line 152 of file Bundle.cpp.

Bundle::ExtensionConstIterator fwRuntime::Bundle::extensionsEnd ( ) const

Retrieves the iterator on the ending item in the managed extension collection.

Returns
an iterator

Definition at line 159 of file Bundle.cpp.

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

Retrieves the executable factory instance for the specified type name.

Parameters
[in]typea string containing a type name
Returns
a shared pointer to the found executable factory instance or null if none

Definition at line 99 of file Bundle.cpp.

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

Retrieves the extension point for the given identifier.

Parameters
[in]identifiera string containing the extension point identifier
Returns
a shared pointer to the found extensoin point, may be empty if none

Definition at line 172 of file Bundle.cpp.

const std::string fwRuntime::Bundle::getClass ( ) const

Retrieves the class representing the bundle executable part.

Returns
a string containing the bundle's plugin class

Definition at line 261 of file Bundle.cpp.

Referenced by start().

+ Here is the caller graph for this function:

const std::string & fwRuntime::Bundle::getIdentifier ( ) const

Retrieves the bundle identifier.

Returns
a string containing the bundle identifier

Definition at line 268 of file Bundle.cpp.

Referenced by getVersion(), initialize(), and start().

+ Here is the caller graph for this function:

const ::boost::filesystem::path & fwRuntime::Bundle::getLibraryLocation ( ) const

Retrieves the bundle location.

Returns
a path representing the bundle location

Definition at line 275 of file Bundle.cpp.

Referenced by fwRuntime::dl::Native::~Native().

+ Here is the caller graph for this function:

const std::string fwRuntime::Bundle::getParameterValue ( const std::string &  identifier) const

Retrieves the value of the given parameter.

Remarks
When no such parameter has been found, an empty string is returned.
See also
hasParameter
Parameters
[in]identifiera string containing a parameter identifier
Returns
a string containing the parameter value

Definition at line 561 of file Bundle.cpp.

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

Retrieves the plugin instance for the specified bundle identifier.

Returns
a shared pointer to a plugin instance or null if the bundle has not been started.

Definition at line 289 of file Bundle.cpp.

const ::boost::filesystem::path & fwRuntime::Bundle::getResourcesLocation ( ) const

Retrieves the bundle location.

Returns
a path representing the bundle location

Definition at line 282 of file Bundle.cpp.

const Version & fwRuntime::Bundle::getVersion ( ) const

Retrieves the version of the bundle.

Returns
the bundle version

Definition at line 296 of file Bundle.cpp.

References fwRuntime::Runtime::findEnabledBundle(), fwRuntime::Runtime::getDefault(), getIdentifier(), SLM_ASSERT, SLM_ERROR, SLM_TRACE, and SPTR.

Referenced by fwRuntime::dl::Native::getNativeName(), and start().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool fwRuntime::Bundle::hasExtension ( const std::string &  identifier) const

Tells if an specific extension exists.

Parameters
[in]identifierthe extension identifier
Returns
true or false

Definition at line 122 of file Bundle.cpp.

bool fwRuntime::Bundle::hasExtensionPoint ( const std::string &  identifier) const

Tells if a specific extension point exists.

Parameters
[in]identifierthe extension point identifier
Returns
true or false

Definition at line 188 of file Bundle.cpp.

bool fwRuntime::Bundle::hasParameter ( const std::string &  name) const

Tells if a parameter exists.

Returns
true or false

Definition at line 570 of file Bundle.cpp.

References fwRuntime::Version::string().

+ Here is the call graph for this function:

void fwRuntime::Bundle::initialize ( )

Initialize the bundle.

Remarks
The bundle and it's own dependencies must be started to be able to be initialized.

Definition at line 501 of file Bundle.cpp.

References getIdentifier(), SLM_ASSERT, and SLM_TRACE.

+ Here is the call graph for this function:

Bundle::LibraryConstIterator fwRuntime::Bundle::librariesBegin ( ) const

Retrieves the iterator on the first item in the managed dynamic library collection.

Returns
an iterator

Definition at line 240 of file Bundle.cpp.

Bundle::LibraryConstIterator fwRuntime::Bundle::librariesEnd ( ) const

Retrieves the iterator on the ending item in the managed dynamic library collection.

Returns
an iterator

Definition at line 247 of file Bundle.cpp.

void fwRuntime::Bundle::setEnable ( const bool  state)

Changes the enable state of the bundle.

Remarks
It is possible to disable a started bundle but this will have no effect.

Definition at line 547 of file Bundle.cpp.

void fwRuntime::Bundle::setEnableExtension ( const std::string &  identifier,
const bool  enable 
)

Search a specific extension in the bundle to enable or disable it.

Remarks
if the extension is not found, the method do nothing.
Parameters
[in]identifierthe extension identifier
[in]enableenable or disable this extension

Definition at line 138 of file Bundle.cpp.

void fwRuntime::Bundle::setEnableExtensionPoint ( const std::string &  identifier,
const bool  enable 
)

Search a specific extension point in the bundle to enable or disable it.

Remarks
if the extension point is not found, the method do nothing.
Parameters
[in]identifierthe extension point identifier
[in]enableenable or disable this extension point

Definition at line 204 of file Bundle.cpp.

void fwRuntime::Bundle::start ( )

Starts the bundle.

Remarks
The bundle must be enabled to be able to start.

Definition at line 389 of file Bundle.cpp.

References fwRuntime::Runtime::createExecutableInstance(), getClass(), fwRuntime::Runtime::getDefault(), getIdentifier(), getVersion(), SLM_ASSERT, SLM_TRACE, and SPTR.

+ Here is the call graph for this function:


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