// 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;
}
//=======================================================================
-//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()
{