1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include <HYDROData_Application.h>
25 #include <TColStd_SequenceOfExtendedString.hxx>
27 IMPLEMENT_STANDARD_HANDLE(HYDROData_Application,TDocStd_Application)
28 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Application,TDocStd_Application)
30 static HYDROData_Application* TheApplication = new HYDROData_Application;
32 //=======================================================================
33 //function : getApplication
35 //=======================================================================
36 HYDROData_Application* HYDROData_Application::GetApplication()
38 return TheApplication;
41 //=======================================================================
42 //function : GetDocument
44 //=======================================================================
45 bool HYDROData_Application::GetDocumentId(const Handle(HYDROData_Document)& theDocument,
48 DataMapOfStudyIDDocument::Iterator aMapit( myDocuments );
49 for ( ; aMapit.More(); aMapit.Next() )
51 if ( aMapit.Value() != theDocument )
54 theDocId = aMapit.Key();
61 //=======================================================================
62 //function : GetDocument
64 //=======================================================================
65 Handle(HYDROData_Document) HYDROData_Application::GetDocument(int theStudyID) const
67 if (myDocuments.IsBound(theStudyID)) {
68 return myDocuments.Find(theStudyID);
70 // document not found => create the new one
71 return Handle(HYDROData_Document)();
74 //=======================================================================
75 //function : OCAFApp_Application
77 //=======================================================================
78 HYDROData_Application::HYDROData_Application ()
80 // store handle to the application to avoid nullification
81 static Handle(HYDROData_Application) TheKeepHandle;
85 //=======================================================================
86 //function : addDocument
88 //=======================================================================
89 void HYDROData_Application::AddDocument(int theStudyID, const Handle(HYDROData_Document)& theDocument)
91 myDocuments.Bind(theStudyID, theDocument);
94 //=======================================================================
95 //function : removeDocument
97 //=======================================================================
98 void HYDROData_Application::RemoveDocument(const Handle(HYDROData_Document)& theDocument)
100 DataMapOfStudyIDDocument::Iterator anIter(myDocuments);
101 for(; anIter.More(); anIter.Next())
102 if (anIter.Value() == theDocument) {
103 myDocuments.UnBind(anIter.Key());
108 //=======================================================================
111 //=======================================================================
112 void HYDROData_Application::Formats(TColStd_SequenceOfExtendedString& theFormats)
114 theFormats.Append(TCollection_ExtendedString ("BinOcaf")); // standard binary schema
117 //=======================================================================
118 //function : ResourcesName
120 //=======================================================================
121 Standard_CString HYDROData_Application::ResourcesName()
123 return Standard_CString("Standard");