fw4spl
BundleDescriptorReader.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWRUNTIME_IO_BUNDLEDESCRIPTORREADER_HPP__
8 #define __FWRUNTIME_IO_BUNDLEDESCRIPTORREADER_HPP__
9 
10 #if defined(__GNUC__)
11 #pragma GCC visibility push(default)
12 #endif
13 #include <string>
14 #include <vector>
15 #include <boost/filesystem/path.hpp>
16 #include <libxml/parser.h>
17 #if defined(__GNUC__)
18 #pragma GCC visibility pop
19 #endif
20 
21 #include "fwRuntime/ExtensionPoint.hpp"
22 #include "fwRuntime/RuntimeException.hpp"
23 #include "fwRuntime/dl/Library.hpp"
24 
25 namespace fwRuntime
26 {
27 
28 struct Bundle;
29 struct ConfigurationElement;
30 struct Extension;
31 struct ExtensionPoint;
32 
33 namespace io
34 {
35 
40 {
41  typedef std::vector< std::shared_ptr<Bundle> > BundleContainer;
43  typedef std::pair< SPTR(ExtensionPoint), std::vector< SPTR(Extension) > > PointExtensionsPairType;
44 
53  FWRUNTIME_API static std::shared_ptr<Bundle> createBundle(const boost::filesystem::path& location);
54 
62  FWRUNTIME_API static const BundleContainer createBundles(const boost::filesystem::path& location);
63 
72  FWRUNTIME_API static std::shared_ptr<ConfigurationElement> processConfigurationElement(xmlNodePtr node,
73  const std::shared_ptr<Bundle> bundle)
74  ;
75 
76  private:
77 
78  static std::string CLASS;
79  static std::string EXTENSION;
80  static std::string EXTENSION_POINT;
81  static std::string ID;
82  static std::string IMPLEMENTS;
83  static std::string NAME;
84  static std::string LIBRARY;
85  static std::string PLUGIN;
86  static std::string REQUIREMENT;
87  static std::string SCHEMA;
88  static std::string VERSION;
89  static std::string POINT;
90 
99  static std::shared_ptr<Extension> processExtension(xmlNodePtr node,
100  const std::shared_ptr<Bundle> bundle);
101 
109  static PointExtensionsPairType processPoint(xmlNodePtr node,
110  const std::shared_ptr<Bundle> bundle);
111 
120  static std::shared_ptr<ExtensionPoint> processExtensionPoint(xmlNodePtr node,
121  const std::shared_ptr<Bundle> bundle);
122 
130  static std::shared_ptr<dl::Library> processLibrary(xmlNodePtr node);
131 
140  static std::shared_ptr<Bundle> processPlugin(xmlNodePtr node,
141  const boost::filesystem::path& location);
142 
150  static const std::string processRequirement(xmlNodePtr node);
151 };
152 
153 } // namespace io
154 
155 } // namespace fwRuntime
156 
157 #endif // __FWRUNTIME_IO_BUNDLEDESCRIPTORREADER_HPP__
static FWRUNTIME_API const BundleContainer createBundles(const boost::filesystem::path &location)
Creates all bundles that are found at the given location.
static FWRUNTIME_API std::shared_ptr< ConfigurationElement > processConfigurationElement(xmlNodePtr node, const std::shared_ptr< Bundle > bundle)
Processes a configuration element XML node.
static FWRUNTIME_API std::shared_ptr< Bundle > createBundle(const boost::filesystem::path &location)
Look for a descriptor at the specified location, reads it and creates a bundle with it...
The namespace fwRuntime contains classes to manage bundle, configuration element, extension point in ...
std::pair< std::shared_ptr< ExtensionPoint >, std::vector< std::shared_ptr< Extension > > > PointExtensionsPairType
Pair of created extension point associated with extensions.
Defines the bundle descriptor reader class.