1 // File: Model_PluginManager.hxx
2 // Created: 20 Mar 2014
3 // Author: Mikhail PONIKAROV
5 #ifndef Model_PluginManager_HeaderFile
6 #define Model_PluginManager_HeaderFile
9 #include <ModelAPI_PluginManager.h>
10 #include <Event_Listener.h>
13 /**\class Model_PluginManager
15 * \brief Object that knows (from the initial XML file) which
16 * plugin contains which feature, loads and stores reference to loaded plugins by
17 * the feature functionality request.
20 class Model_PluginManager : public ModelAPI_PluginManager, public Event_Listener
22 bool myPluginsInfoLoaded; ///< it true if plugins information is loaded
23 /// map of feature IDs to plugin name and object
24 std::map<std::string, std::string> myPlugins;
25 std::map<std::string, ModelAPI_Plugin*> myPluginObjs; ///< instances of the already plugins
26 std::string myCurrentPluginName; ///< name of the plugin that must be loaded currently
28 /// Creates the feature object using plugins functionality
29 MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
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);
36 /// Processes the configuration file reading
37 MODEL_EXPORT virtual void processEvent(const Event_Message* theMessage);
39 /// Is called only once, on startup of the application
40 Model_PluginManager();
43 /// Loads (if not done yet) the information about the features and plugins
44 void LoadPluginsInfo();