Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / Model / Model_Application.h
index 77d669257079fc13b303f0bd4203334cf570a16b..9281f9ce6e4773565072d1c697508f315e09e63c 100644 (file)
@@ -6,9 +6,9 @@
 #ifndef Model_Application_HeaderFile
 #define Model_Application_HeaderFile
 
-#include <Model_Document.hxx> 
-#include <ModelAPI_Application.hxx> 
+#include <Model_Document.h> 
 #include <TDocStd_Application.hxx>
+#include <map>
 
 // Define handle class 
 DEFINE_STANDARD_HANDLE(Model_Application, TDocStd_Application)
@@ -19,19 +19,27 @@ DEFINE_STANDARD_HANDLE(Model_Application, TDocStd_Application)
  * Application supports the formats and document management. It is uses OCAF-lke
  * architecture and just implements specific features of the module.
  */
-class Model_Application: public TDocStd_Application, public ModelAPI_Application
+class Model_Application: public TDocStd_Application
 {
 public:
   // useful methods inside of the module
 
   // CASCADE RTTI
-  DEFINE_STANDARD_RTTI(Model_Application)
-  ;
+  DEFINE_STANDARD_RTTI(Model_Application);
 
   //! Retuns the application: one per process    
-  MODEL_EXPORT static Handle_Model_Application GetApplication();
-  //! Returns the main document (on first call creates it)
-  MODEL_EXPORT ModelAPI_Document* GetMainDocument();
+  MODEL_EXPORT static Handle_Model_Application getApplication();
+  //! Returns the main document (on first call creates it) by the string identifier
+  MODEL_EXPORT const boost::shared_ptr<Model_Document>& getDocument(std::string theDocID);
+  //! Returns true if document has been created
+  MODEL_EXPORT bool hasDocument(std::string theDocID);
+  //! Deletes the document from the application
+  MODEL_EXPORT void deleteDocument(std::string theDocID);
+
+  //! Set path for the loaded by demand documents
+  void setLoadPath(std::string thePath);
+  //! Defines that specified document must be loaded by demand
+  void setLoadByDemand(std::string theID);
 
 public:
   // Redefined OCAF methods
@@ -46,8 +54,12 @@ public:
   Model_Application();
 
 private:
-
-  Handle_Model_Document myMainDoc; ///< main document of an application
+  /// Map from string identifiers to created documents of an application
+  std::map<std::string, boost::shared_ptr<Model_Document> > myDocs;
+  /// Path for the loaded by demand documents
+  std::string myPath;
+  /// Path for the loaded by demand documents
+  std::set<std::string> myLoadedByDemand;
 };
 
 #endif