Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / ModelAPI / ModelAPI_PluginManager.h
1 // File:        ModelAPI_PluginManager.hxx
2 // Created:     20 Mar 2014
3 // Author:      Mikhail PONIKAROV
4
5 #ifndef ModelAPI_PluginManager_HeaderFile
6 #define ModelAPI_PluginManager_HeaderFile
7
8 #include "ModelAPI.h"
9 #include <string>
10 #include <boost/shared_ptr.hpp>
11
12 class ModelAPI_Feature;
13 class ModelAPI_Plugin;
14
15 /**\class ModelAPI_PluginManager
16  * \ingroup DataModel
17  * \brief Object that knows (from the initial XML file) which
18  * plugin contains which feature, loads and stores reference to loaded plugins by
19  * the feature functionality request.
20  */
21
22 class MODELAPI_EXPORT ModelAPI_PluginManager
23 {
24 public:
25   /// Creates the feature object using plugins functionality
26   virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
27
28   /// Returns the real implementation (the alone instance per application) of the plugin manager
29   static boost::shared_ptr<ModelAPI_PluginManager> get();
30
31   /// Registers the plugin that creates features.
32   /// It is obligatory for each plugin to call this function on loading to be found by 
33   /// the plugin manager on call of the feature)
34   virtual void registerPlugin(ModelAPI_Plugin* thePlugin) = 0;
35
36   /// loads the library with specific name, appends "lib*.dll" or "*.so" depending on the platform
37   static void ModelAPI_PluginManager::loadLibrary(const std::string theLibName);
38
39   /// Is needed for python wrapping by swig, call Get to get an instance
40   ModelAPI_PluginManager();
41
42 protected:
43   static void SetPluginManager(boost::shared_ptr<ModelAPI_PluginManager> theManager);
44 };
45
46 #endif