]> SALOME platform Git repositories - modules/shaper.git/blob - src/Model/Model_PluginManager.h
Salome HOME
Remove Boost shared_ptr, use std instead
[modules/shaper.git] / src / Model / Model_PluginManager.h
1 // File:        Model_PluginManager.hxx
2 // Created:     20 Mar 2014
3 // Author:      Mikhail PONIKAROV
4
5 #ifndef Model_PluginManager_HeaderFile
6 #define Model_PluginManager_HeaderFile
7
8 #include "Model.h"
9 #include <ModelAPI_PluginManager.h>
10 #include <Event_Listener.h>
11 #include <map>
12
13 class Model_Document;
14
15 /**\class Model_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 Model_PluginManager : public ModelAPI_PluginManager, public Event_Listener
23 {
24   bool myPluginsInfoLoaded; ///< it true if plugins information is loaded
25   /// map of feature IDs to plugin name and object
26   std::map<std::string, std::string> myPlugins;
27   std::map<std::string, ModelAPI_Plugin*> myPluginObjs; ///< instances of the already plugins
28   std::string myCurrentPluginName; ///< name of the plugin that must be loaded currently
29 public:
30   /// Creates the feature object using plugins functionality
31   MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
32
33   /// Returns the root document of the application (that may contains sub-documents)
34   virtual std::shared_ptr<ModelAPI_Document> rootDocument();
35
36   /// Registers the plugin that creates features.
37   /// It is obligatory for each plugin to call this function on loading to be found by 
38   /// the plugin manager on call of the feature)
39   virtual void registerPlugin(ModelAPI_Plugin* thePlugin);
40
41   /// Processes the configuration file reading
42   MODEL_EXPORT virtual void processEvent(const Event_Message* theMessage);
43
44   /// Is called only once, on startup of the application
45   Model_PluginManager();
46
47 private:
48   /// Loads (if not done yet) the information about the features and plugins
49   void LoadPluginsInfo();
50 };
51
52 #endif