Salome HOME
Updates for stability of application
[modules/shaper.git] / src / Model / Model_PluginManager.h
index 64811f82f48bb751d6a7a534de40046fcde4f6cf..4efef6a4cd5034c79e8ff69a405cc49b852ceb33 100644 (file)
@@ -7,7 +7,7 @@
 
 #include "Model.h"
 #include <ModelAPI_PluginManager.h>
-#include <Event_Listener.h>
+#include <Events_Listener.h>
 #include <map>
 
 class Model_Document;
@@ -18,27 +18,27 @@ class Model_Document;
  * plugin contains which feature, loads and stores reference to loaded plugins by
  * the feature functionality request.
  */
-class Model_PluginManager : public ModelAPI_PluginManager, public Event_Listener
+class Model_PluginManager : public ModelAPI_PluginManager, public Events_Listener
 {
   bool myPluginsInfoLoaded; ///< it true if plugins information is loaded
   /// map of feature IDs to plugin name
   std::map<std::string, std::string> myPlugins;
   std::map<std::string, ModelAPI_Plugin*> myPluginObjs; ///< instances of the already plugins
   std::string myCurrentPluginName; ///< name of the plugin that must be loaded currently
-  std::shared_ptr<ModelAPI_Document> myCurrentDoc; ///< current working document
+  boost::shared_ptr<ModelAPI_Document> myCurrentDoc; ///< current working document
+  bool myCheckTransactions; ///< if true, generates error if document is updated outside of transaction
 public:
-  /// Creates the feature object using plugins functionality
-  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> createFeature(
-    std::string theFeatureID, const bool theAddToDoc = true);
-
   /// Returns the root document of the application (that may contains sub-documents)
-  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> rootDocument();
+  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> rootDocument();
+
+  /// Return true if root document has been already created
+  MODEL_EXPORT virtual bool hasRootDocument();
 
   /// Returns the current document that used for current work in the application
-  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> currentDocument();
+  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> currentDocument();
 
   /// Defines the current document that used for current work in the application
-  MODEL_EXPORT virtual void setCurrentDocument(std::shared_ptr<ModelAPI_Document> theDoc);
+  MODEL_EXPORT virtual void setCurrentDocument(boost::shared_ptr<ModelAPI_Document> theDoc);
 
   /// Registers the plugin that creates features.
   /// It is obligatory for each plugin to call this function on loading to be found by 
@@ -46,14 +46,23 @@ public:
   MODEL_EXPORT virtual void registerPlugin(ModelAPI_Plugin* thePlugin);
 
   /// Processes the configuration file reading
-  MODEL_EXPORT virtual void processEvent(const Event_Message* theMessage);
+  MODEL_EXPORT virtual void processEvent(const Events_Message* theMessage);
+
+  /// Copies the document to the new one wit hthe given id
+  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> copy(
+    boost::shared_ptr<ModelAPI_Document> theSource, std::string theID);
+
+  void setCheckTransactions(const bool theCheck) {myCheckTransactions = theCheck;}
 
   /// Is called only once, on startup of the application
   Model_PluginManager();
 
-private:
+protected:
   /// Loads (if not done yet) the information about the features and plugins
   void LoadPluginsInfo();
+
+  /// Creates the feature object using plugins functionality
+  virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
 };
 
 #endif