]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelAPI/ModelAPI_PluginManager.h
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 <memory>
11
12 class ModelAPI_Feature;
13 class ModelAPI_Plugin;
14 class ModelAPI_Document;
15
16 /**\class ModelAPI_PluginManager
17  * \ingroup DataModel
18  * \brief Object that knows (from the initial XML file) which
19  * plugin contains which feature, loads and stores reference to loaded plugins by
20  * the feature functionality request.
21  */
22
23 class MODELAPI_EXPORT ModelAPI_PluginManager
24 {
25 public:
26   /// Creates the feature object using plugins functionality
27   virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID,
28     const bool theAddToDoc = true) = 0;
29
30   /// Returns the real implementation (the alone instance per application) of the plugin manager
31   static std::shared_ptr<ModelAPI_PluginManager> get();
32
33   /// Registers the plugin that creates features.
34   /// It is obligatory for each plugin to call this function on loading to be found by 
35   /// the plugin manager on call of the feature)
36   virtual void registerPlugin(ModelAPI_Plugin* thePlugin) = 0;
37
38   /// Returns the root document of the application (that may contains sub-documents)
39   virtual std::shared_ptr<ModelAPI_Document> rootDocument() = 0;
40
41   /// Returns the current document that used for current work in the application
42   virtual std::shared_ptr<ModelAPI_Document> currentDocument() = 0;
43
44   /// Defines the current document that used for current work in the application
45   virtual void setCurrentDocument(std::shared_ptr<ModelAPI_Document> theDoc) = 0;
46
47   /// loads the library with specific name, appends "lib*.dll" or "*.so" depending on the platform
48   static void ModelAPI_PluginManager::loadLibrary(const std::string theLibName);
49
50   /// Is needed for python wrapping by swig, call Get to get an instance
51   ModelAPI_PluginManager();
52
53 protected:
54   static void SetPluginManager(std::shared_ptr<ModelAPI_PluginManager> theManager);
55 };
56
57 #endif