Salome HOME
Initial version
[modules/hydro.git] / src / HYDROData / HYDROData_Application.cxx
1 #include <HYDROData_Application.h>
2
3 #include <TColStd_SequenceOfExtendedString.hxx>
4
5 IMPLEMENT_STANDARD_HANDLE(HYDROData_Application,TDocStd_Application)
6 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Application,TDocStd_Application)
7
8 static HYDROData_Application* TheApplication = new HYDROData_Application;
9
10 //=======================================================================
11 //function : getApplication
12 //purpose  : 
13 //=======================================================================
14 HYDROData_Application* HYDROData_Application::GetApplication() 
15 {
16   return TheApplication;
17 }
18
19 //=======================================================================
20 //function : getDocument
21 //purpose  : 
22 //=======================================================================
23 Handle(HYDROData_Document) HYDROData_Application::GetDocument(int theStudyID)
24 {
25   if (myDocuments.IsBound(theStudyID)) {
26     return myDocuments.Find(theStudyID);
27   }
28   // document not found => create the new one
29   return Handle(HYDROData_Document)();
30 }
31
32 //=======================================================================
33 //function : OCAFApp_Application
34 //purpose  : 
35 //=======================================================================
36 HYDROData_Application::HYDROData_Application ()
37 {
38   // store handle to the application to avoid nullification
39   static Handle(HYDROData_Application) TheKeepHandle;
40   TheKeepHandle = this;
41 }
42
43 //=======================================================================
44 //function : addDocument
45 //purpose  : 
46 //=======================================================================
47 void HYDROData_Application::AddDocument(int theStudyID, Handle(HYDROData_Document) theDocument)
48 {
49   myDocuments.Bind(theStudyID, theDocument);
50 }
51
52 //=======================================================================
53 //function : removeDocument
54 //purpose  : 
55 //=======================================================================
56 void HYDROData_Application::RemoveDocument(Handle(HYDROData_Document) theDocument)
57 {
58   DataMapOfStudyIDDocument::Iterator anIter(myDocuments);
59   for(; anIter.More(); anIter.Next())
60     if (anIter.Value() == theDocument) {
61       myDocuments.UnBind(anIter.Key());
62       break;
63     }
64 }
65
66 //=======================================================================
67 //function : Formats
68 //purpose  : 
69 //=======================================================================
70 void HYDROData_Application::Formats(TColStd_SequenceOfExtendedString& theFormats) 
71 {
72   theFormats.Append(TCollection_ExtendedString ("BinOcaf")); // standard binary schema
73 }
74
75 //=======================================================================
76 //function : ResourcesName
77 //purpose  : 
78 //=======================================================================
79 Standard_CString HYDROData_Application::ResourcesName()
80 {
81   return Standard_CString("Standard");
82 }