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 #ifndef HYDROData_Application_HeaderFile
24 #define HYDROData_Application_HeaderFile
26 #include <HYDROData_Document.h>
27 #include <TDocStd_Application.hxx>
28 #include <NCollection_DataMap.hxx>
30 typedef NCollection_DataMap<int, Handle(HYDROData_Document)> DataMapOfStudyIDDocument;
32 /**\class HYDROData_Application
34 * \brief Realization of Open CASCADE application abstraction. Class for
35 * internal use inside of a package only.
37 * Application supports the formats and document management. It is uses OCAF-lke
38 * architecture and just implements specific features of the module.
40 class HYDROData_Application : public TDocStd_Application
42 public: // useful methods inside of the package
44 //! Retuns the application: one per process
45 HYDRODATA_EXPORT static HYDROData_Application* GetApplication();
47 public: // Redefined OCAF methods
48 //! Return name of resource (i.e. "Standard")
49 HYDRODATA_EXPORT Standard_CString ResourcesName();
50 //! Return format (i.e "MDTV-Standard")
51 //! \param theFormats sequence of allowed formats for input/output
52 HYDRODATA_EXPORT virtual void Formats(TColStd_SequenceOfExtendedString& theFormats);
54 //! Use method GetInstance() method to obtain
55 //! the static instance of the object (or derive your own application)
56 HYDRODATA_EXPORT HYDROData_Application();
59 DEFINE_STANDARD_RTTI(HYDROData_Application)
62 //! Returns document by its study ID, if document doesn't exists return null
63 Handle(HYDROData_Document) GetDocument(int theStudyID) const;
65 //! Get study id by document instance, if document doesn't exists return false
66 bool GetDocumentId(const Handle(HYDROData_Document)& theDocument,
69 //! Appends document to the application
70 void AddDocument(int theStudyID, const Handle(HYDROData_Document)& theDocument);
72 //! Removes document from the application
73 void RemoveDocument( const Handle(HYDROData_Document)& theDocument );
75 //! map from SALOME study ID to the document
76 DataMapOfStudyIDDocument myDocuments;
78 friend class HYDROData_Document; // to manipulate documents of application
81 // Define handle class
82 DEFINE_STANDARD_HANDLE(HYDROData_Application,TDocStd_Application)