1 // File: ModelAPI_PluginManager.hxx
2 // Created: 20 Mar 2014
3 // Author: Mikhail PONIKAROV
5 #ifndef ModelAPI_PluginManager_H_
6 #define ModelAPI_PluginManager_H_
10 #include <boost/shared_ptr.hpp>
12 class ModelAPI_Feature;
13 class ModelAPI_Plugin;
14 class ModelAPI_Document;
15 class ModelAPI_ValidatorsFactory;
17 /**\class ModelAPI_PluginManager
19 * \brief Object that knows (from the initial XML file) which
20 * plugin contains which feature, loads and stores reference to loaded plugins by
21 * the feature functionality request.
24 class MODELAPI_EXPORT ModelAPI_PluginManager
27 /// Returns the real implementation (the alone instance per application) of the plugin manager
28 static boost::shared_ptr<ModelAPI_PluginManager> get();
30 /// Registers the plugin that creates features.
31 /// It is obligatory for each plugin to call this function on loading to be found by
32 /// the plugin manager on call of the feature)
33 virtual void registerPlugin(ModelAPI_Plugin* thePlugin) = 0;
35 /// Returns the root document of the application (that may contains sub-documents)
36 virtual boost::shared_ptr<ModelAPI_Document> rootDocument() = 0;
38 /// Return true if root document has been already created
39 virtual bool hasRootDocument() = 0;
41 /// Returns the current document that used for current work in the application
42 virtual boost::shared_ptr<ModelAPI_Document> currentDocument() = 0;
44 /// Defines the current document that used for current work in the application
45 virtual void setCurrentDocument(boost::shared_ptr<ModelAPI_Document> theDoc) = 0;
47 /// Copies the document to the new one wit hthe given id
48 virtual boost::shared_ptr<ModelAPI_Document> copy(boost::shared_ptr<ModelAPI_Document> theSource,
49 std::string theID) = 0;
51 /// Returns the validators factory: the only one instance per application
52 virtual ModelAPI_ValidatorsFactory* validators() = 0;
54 /// Is needed for python wrapping by swig, call Get to get an instance
55 ModelAPI_PluginManager();
57 /// To virtually destroy the fields of successors
58 virtual ~ModelAPI_PluginManager()
63 /// Creates the feature object using plugins functionality
64 virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
66 static void setPluginManager(boost::shared_ptr<ModelAPI_PluginManager> theManager);
68 friend class Model_Document;
71 typedef boost::shared_ptr<ModelAPI_PluginManager> PluginManagerPtr;