Salome HOME
Make generated by SWIG python script installed: refs #17
[modules/shaper.git] / src / Model / Model_Application.cxx
index 093b5781690136c3c754c9aeb976bcca081f00cd..40704967e8de9cef5e8a568dac24330bd0fc5f37 100644 (file)
@@ -2,41 +2,46 @@
 // 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)
+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 ()
+Model_Application::Model_Application()
 {
   // store handle to the application to avoid nullification
   static Handle(Model_Application) TheKeepHandle;
@@ -44,17 +49,11 @@ Model_Application::Model_Application ()
 }
 
 //=======================================================================
-//function : Formats
-//purpose  : 
-//=======================================================================
-void Model_Application::Formats(TColStd_SequenceOfExtendedString& theFormats) 
+void Model_Application::Formats(TColStd_SequenceOfExtendedString& theFormats)
 {
-  theFormats.Append(TCollection_ExtendedString ("BinOcaf")); // standard binary schema
+  theFormats.Append(TCollection_ExtendedString("BinOcaf")); // standard binary schema
 }
 
-//=======================================================================
-//function : ResourcesName
-//purpose  : 
 //=======================================================================
 Standard_CString Model_Application::ResourcesName()
 {