9 #include "fwCore/base.hpp" 11 #include "fwRuntime/config.hpp" 12 #include "fwRuntime/dl/Library.hpp" 13 #include "fwRuntime/RuntimeException.hpp" 14 #include "fwRuntime/Version.hpp" 16 #include <boost/filesystem/path.hpp> 25 struct ExtensionPoint;
26 struct ExtensionRegistry;
28 struct ExecutableFactory;
45 struct Bundle :
public std::enable_shared_from_this< Bundle >
47 friend struct ::fwRuntime::io::BundleDescriptorReader;
49 static const char s_VERSION_DELIMITER =
'-';
90 FWRUNTIME_API
void addLibrary(
SPTR( dl::Library ) library );
98 FWRUNTIME_API LibraryConstIterator librariesBegin() const;
106 FWRUNTIME_API LibraryConstIterator librariesEnd() const;
137 FWRUNTIME_API ExecutableFactoryConstIterator executableFactoriesBegin() const;
145 FWRUNTIME_API ExecutableFactoryConstIterator executableFactoriesEnd() const;
175 FWRUNTIME_API
bool hasExtension(const
std::
string& identifier) const;
186 FWRUNTIME_API
void setEnableExtension(const
std::
string& identifier, const
bool enable);
194 FWRUNTIME_API ExtensionConstIterator extensionsBegin() const;
202 FWRUNTIME_API ExtensionConstIterator extensionsEnd() const;
232 FWRUNTIME_API
bool hasExtensionPoint(const
std::
string& identifier) const;
243 FWRUNTIME_API
void setEnableExtensionPoint(const
std::
string& identifier, const
bool enable);
251 FWRUNTIME_API ExtensionPointConstIterator extensionPointsBegin() const;
259 FWRUNTIME_API ExtensionPointConstIterator extensionPointsEnd() const;
271 FWRUNTIME_API
void addRequirement( const
std::
string& requirement );
278 FWRUNTIME_API const
std::
string& getIdentifier() const;
285 FWRUNTIME_API const ::
boost::filesystem::path& getLibraryLocation() const;
292 FWRUNTIME_API const ::
boost::filesystem::path& getResourcesLocation() const;
299 FWRUNTIME_API const
std::
string getClass() const;
306 FWRUNTIME_API const
Version& getVersion() const;
323 FWRUNTIME_API
bool isEnable() const;
331 FWRUNTIME_API
void setEnable( const
bool state );
338 FWRUNTIME_API
void start();
340 FWRUNTIME_API
void stop();
348 FWRUNTIME_API
void initialize();
350 FWRUNTIME_API
void uninitialize();
363 FWRUNTIME_API
void addParameter( const
std::
string& identifier, const
std::
string& value );
376 FWRUNTIME_API const
std::
string getParameterValue( const
std::
string& identifier ) const;
383 FWRUNTIME_API
bool hasParameter( const
std::
string& name ) const;
394 return m_initialized;
397 FWRUNTIME_API
static std::string getBundleStr(
const std::string& identifier,
const Version& version);
411 Bundle( const ::boost::filesystem::path& location,
412 const std::string&
id,
413 const std::string& version );
426 Bundle( const ::boost::filesystem::path& location,
427 const std::string&
id,
428 const std::string& version,
429 const std::string& pluginClass );
433 typedef std::set< std::string > RequirementContainer;
435 typedef std::map< std::string, std::string > ParameterContainer;
440 ::boost::filesystem::path m_libraryLocation;
441 const ::boost::filesystem::path m_resourcesLocation;
442 const std::string m_identifier;
444 const std::string m_class;
445 bool m_enable {
false };
447 ExtensionContainer m_extensions;
448 ExtensionPointContainer m_extensionPoints;
449 ExecutableFactoryContainer m_executableFactories;
450 LibraryContainer m_libraries;
451 RequirementContainer m_requirements;
453 ParameterContainer m_parameters;
455 bool m_started {
false };
456 bool m_initialized {
false };
463 void operator= (
const Bundle& );
468 void loadLibraries();
473 void loadRequirements();
Defines the extension class.
Defines the abstract executable factory class.
std::set< std::shared_ptr< ExecutableFactory > > ExecutableFactoryContainer
Defines the executable.
Defines the extension point class.
Defines the base executable interface.An executable object is an instance created by an extension poi...
std::set< std::shared_ptr< ExtensionPoint > > ExtensionPointContainer
Defines the extension point.
Contains fwAtomsFilter::factory utilities.
The namespace fwRuntime contains classes to manage bundle, configuration element, extension point in ...
FWRUNTIME_API std::shared_ptr< ExtensionPoint > findExtensionPoint(const std::string &identifier)
Retrieves the extension point having the specified identifier.
LibraryContainer::const_iterator LibraryConstIterator
Defines the dynamic library container.
Defines the plugin interface.
std::set< std::shared_ptr< Extension > > ExtensionContainer
Defines the extension container.
ExtensionContainer::const_iterator ExtensionConstIterator
Defines the extension container.
ExecutableFactoryContainer::const_iterator ExecutableFactoryConstIterator
Defines the executable.
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.
Defines the bundle class.
Holds version information for libraries and bundles.
std::set< std::shared_ptr< dl::Library > > LibraryContainer
Defines the dynamic library container.
ExtensionPointContainer::const_iterator ExtensionPointConstIterator
Defines the extension point.
Defines the bundle descriptor reader class.