1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef HYDROData_Application_HeaderFile
20 #define HYDROData_Application_HeaderFile
22 #include <HYDROData_Document.h>
23 #include <TDocStd_Application.hxx>
24 #include <NCollection_DataMap.hxx>
26 typedef NCollection_DataMap<int, Handle(HYDROData_Document)> DataMapOfStudyIDDocument;
28 /**\class HYDROData_Application
30 * \brief Realization of Open CASCADE application abstraction. Class for
31 * internal use inside of a package only.
33 * Application supports the formats and document management. It is uses OCAF-lke
34 * architecture and just implements specific features of the module.
36 class HYDROData_Application : public TDocStd_Application
38 public: // useful methods inside of the package
40 //! Retuns the application: one per process
41 HYDRODATA_EXPORT static HYDROData_Application* GetApplication();
43 public: // Redefined OCAF methods
44 //! Return name of resource (i.e. "Standard")
45 HYDRODATA_EXPORT Standard_CString ResourcesName();
46 //! Return format (i.e "MDTV-Standard")
47 //! \param theFormats sequence of allowed formats for input/output
48 HYDRODATA_EXPORT virtual void Formats(TColStd_SequenceOfExtendedString& theFormats);
50 //! Use method GetInstance() method to obtain
51 //! the static instance of the object (or derive your own application)
52 HYDRODATA_EXPORT HYDROData_Application();
55 DEFINE_STANDARD_RTTIEXT(HYDROData_Application, TDocStd_Application)
58 //! Returns document by its study ID, if document doesn't exists return null
59 Handle(HYDROData_Document) GetDocument(int theStudyID) const;
61 //! Get study id by document instance, if document doesn't exists return false
62 bool GetDocumentId(const Handle(HYDROData_Document)& theDocument,
65 //! Appends document to the application
66 void AddDocument(int theStudyID, const Handle(HYDROData_Document)& theDocument);
68 //! Removes document from the application
69 void RemoveDocument( const Handle(HYDROData_Document)& theDocument );
71 //! map from SALOME study ID to the document
72 DataMapOfStudyIDDocument myDocuments;
74 friend class HYDROData_Document; // to manipulate documents of application