Salome HOME
Porting to CentOS
[modules/shaper.git] / src / Model / Model_Application.cpp
index bdd9eda3a5ff2862d808fa76f141e3ff38b00aba..128f6ee4dffa76228158d713d4a5967ffabb6d8b 100644 (file)
@@ -67,6 +67,12 @@ void Model_Application::setLoadPath(std::string thePath)
   myPath = thePath;
 }
 
+//=======================================================================
+const std::string& Model_Application::loadPath() const
+{
+  return myPath;
+}
+
 //=======================================================================
 void Model_Application::setLoadByDemand(std::string theID)
 {
@@ -79,6 +85,27 @@ bool Model_Application::isLoadByDemand(std::string theID)
   return myLoadedByDemand.find(theID) != myLoadedByDemand.end();
 }
 
+//=======================================================================
+void Model_Application::removeUselessDocuments(
+  std::list<std::shared_ptr<ModelAPI_Document> > theUsedDocs)
+{
+  std::map<std::string, std::shared_ptr<Model_Document> >::iterator aDoc = myDocs.begin();
+  while(aDoc != myDocs.end()) {
+    bool aFound = false;
+    std::list<std::shared_ptr<ModelAPI_Document> >::iterator aUsed = theUsedDocs.begin();
+    for(; !aFound && aUsed != theUsedDocs.end(); aUsed++) {
+      aFound = aDoc->second == *aUsed;
+    }
+    if (!aFound) { // remove the useless
+      aDoc->second->close();
+      myDocs.erase(aDoc);
+      aDoc = myDocs.begin();
+    } else {
+      aDoc++;
+    }
+  }
+}
+
 //=======================================================================
 Model_Application::Model_Application()
 {