Salome HOME
Useless method has been removed.
[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 bool HYDROData_Application::GetDocumentId(const Handle(HYDROData_Document)& theDocument,
24                                           int&                              theDocId) const
25 {
26   DataMapOfStudyIDDocument::Iterator aMapit( myDocuments );
27   for ( ; aMapit.More(); aMapit.Next() )
28   {
29     if ( aMapit.Value() != theDocument )
30       continue;
31
32     theDocId = aMapit.Key();
33     return true;
34   }
35
36   return false;
37 }
38
39 //=======================================================================
40 //function : GetDocument
41 //purpose  : 
42 //=======================================================================
43 Handle(HYDROData_Document) HYDROData_Application::GetDocument(int theStudyID) const
44 {
45   if (myDocuments.IsBound(theStudyID)) {
46     return myDocuments.Find(theStudyID);
47   }
48   // document not found => create the new one
49   return Handle(HYDROData_Document)();
50 }
51
52 //=======================================================================
53 //function : OCAFApp_Application
54 //purpose  : 
55 //=======================================================================
56 HYDROData_Application::HYDROData_Application ()
57 {
58   // store handle to the application to avoid nullification
59   static Handle(HYDROData_Application) TheKeepHandle;
60   TheKeepHandle = this;
61 }
62
63 //=======================================================================
64 //function : addDocument
65 //purpose  : 
66 //=======================================================================
67 void HYDROData_Application::AddDocument(int theStudyID, const Handle(HYDROData_Document)& theDocument)
68 {
69   myDocuments.Bind(theStudyID, theDocument);
70 }
71
72 //=======================================================================
73 //function : removeDocument
74 //purpose  : 
75 //=======================================================================
76 void HYDROData_Application::RemoveDocument(const Handle(HYDROData_Document)& theDocument)
77 {
78   DataMapOfStudyIDDocument::Iterator anIter(myDocuments);
79   for(; anIter.More(); anIter.Next())
80     if (anIter.Value() == theDocument) {
81       myDocuments.UnBind(anIter.Key());
82       break;
83     }
84 }
85
86 //=======================================================================
87 //function : Formats
88 //purpose  : 
89 //=======================================================================
90 void HYDROData_Application::Formats(TColStd_SequenceOfExtendedString& theFormats) 
91 {
92   theFormats.Append(TCollection_ExtendedString ("BinOcaf")); // standard binary schema
93 }
94
95 //=======================================================================
96 //function : ResourcesName
97 //purpose  : 
98 //=======================================================================
99 Standard_CString HYDROData_Application::ResourcesName()
100 {
101   return Standard_CString("Standard");
102 }