Salome HOME
Make generated by SWIG python script installed: refs #17
[modules/shaper.git] / src / Model / Model_Application.cxx
index dab193d13b3cf3a2734c3e8dafea19a93b5f3640..40704967e8de9cef5e8a568dac24330bd0fc5f37 100644 (file)
@@ -2,39 +2,44 @@
 // Created:    Fri Sep 2 2011
 // Author:     Mikhail PONIKAROV
 
-#include <Model_Application.hxx>
-#include <Model_Document.hxx>
+#include <Model_Application.h>
+#include <Model_Document.h>
 
 IMPLEMENT_STANDARD_HANDLE(Model_Application, TDocStd_Application)
 IMPLEMENT_STANDARD_RTTIEXT(Model_Application, TDocStd_Application)
 
+using namespace std;
+
 static Handle_Model_Application TheApplication = new Model_Application;
 
 //=======================================================================
-//function : getApplication
-//purpose  : 
-//=======================================================================
-Handle_Model_Application Model_Application::GetApplication()
+Handle(Model_Application) Model_Application::getApplication()
 {
   return TheApplication;
 }
 
 //=======================================================================
-//function : getDocument
-//purpose  : 
-//=======================================================================
-ModelAPI_Document* Model_Application::GetMainDocument()
+const std::shared_ptr<Model_Document>& Model_Application::getDocument(string theDocID)
 {
+  if (myDocs.find(theDocID) != myDocs.end())
+    return myDocs[theDocID];
 
-  if (myMainDoc.IsNull()) {
-    myMainDoc = new Model_Document("BinOcaf");
-  }
-  return *myMainDoc;
+  std::shared_ptr<Model_Document> aNew(new Model_Document(theDocID));
+  myDocs[theDocID] = aNew;
+  return myDocs[theDocID];
+}
+
+void Model_Application::deleteDocument(string theDocID)
+{
+  myDocs.erase(theDocID);
 }
 
 //=======================================================================
-//function : OCAFApp_Application
-//purpose  : 
+bool Model_Application::hasDocument(std::string theDocID)
+{
+  return myDocs.find(theDocID) != myDocs.end();
+}
+
 //=======================================================================
 Model_Application::Model_Application()
 {
@@ -43,18 +48,12 @@ Model_Application::Model_Application()
   TheKeepHandle = this;
 }
 
-//=======================================================================
-//function : Formats
-//purpose  : 
 //=======================================================================
 void Model_Application::Formats(TColStd_SequenceOfExtendedString& theFormats)
 {
   theFormats.Append(TCollection_ExtendedString("BinOcaf")); // standard binary schema
 }
 
-//=======================================================================
-//function : ResourcesName
-//purpose  : 
 //=======================================================================
 Standard_CString Model_Application::ResourcesName()
 {