Salome HOME
Added the hasRootDocument method for GUI NewDocument checking
[modules/shaper.git] / src / Model / Model_Application.cxx
index 560f5805c980b9d0143baaa0fdaa974e6f5c86be..40704967e8de9cef5e8a568dac24330bd0fc5f37 100644 (file)
@@ -8,11 +8,10 @@
 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()
 {
@@ -20,22 +19,27 @@ Handle(Model_Application) Model_Application::getApplication()
 }
 
 //=======================================================================
-//function : getDocument
-//purpose  : 
-//=======================================================================
-boost::shared_ptr<Model_Document> Model_Application::getDocument(std::string theDocID)
+const std::shared_ptr<Model_Document>& Model_Application::getDocument(string theDocID)
 {
   if (myDocs.find(theDocID) != myDocs.end())
     return myDocs[theDocID];
 
-  boost::shared_ptr<Model_Document> aNew(new Model_Document("BinOcaf"));
+  std::shared_ptr<Model_Document> aNew(new Model_Document(theDocID));
   myDocs[theDocID] = aNew;
-  return 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()
 {
@@ -44,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()
 {