Salome HOME
Code alignment.
[modules/hydro.git] / src / HYDROData / HYDROData_Application.h
1 #ifndef HYDROData_Application_HeaderFile
2 #define HYDROData_Application_HeaderFile
3
4 #include <HYDROData_Document.h> 
5 #include <TDocStd_Application.hxx>
6 #include <NCollection_DataMap.hxx>
7
8 typedef NCollection_DataMap<int, Handle(HYDROData_Document)> DataMapOfStudyIDDocument;
9
10 /**\class HYDROData_Application
11  *
12  * \brief Realization of Open CASCADE application abstraction. Class for 
13  *        internal use inside of a package only.
14  * 
15  * Application supports the formats and document management. It is uses OCAF-lke
16  * architecture and just implements specific features of the module.
17  */
18 class HYDROData_Application : public TDocStd_Application
19 {
20 public: // useful methods inside of the package
21
22   //! Retuns the application: one per process    
23   HYDRODATA_EXPORT static HYDROData_Application* GetApplication();   
24
25 public: // Redefined OCAF methods
26   //! Return name of resource (i.e. "Standard")
27   Standard_CString ResourcesName();
28   //! Return format (i.e "MDTV-Standard")
29   //! \param theFormats sequence of allowed formats for input/output
30   virtual void Formats(TColStd_SequenceOfExtendedString& theFormats);    
31   //! Constructor
32   //! Use method GetInstance() method to obtain 
33   //! the static instance of the object (or derive your own application)
34   HYDROData_Application();
35
36   // CASCADE RTTI
37   DEFINE_STANDARD_RTTI(HYDROData_Application)
38
39 private:
40   //! Returns document by its study ID, if document doesn't exists return null
41   Handle(HYDROData_Document) GetDocument(int theStudyID);
42
43   //! Appends document to the application
44   void AddDocument(int theStudyID, Handle(HYDROData_Document) theDocument);
45
46   //! Removes document from the application
47   void RemoveDocument(Handle(HYDROData_Document) theDocument);
48
49   //! map from SALOME study ID to the document
50   DataMapOfStudyIDDocument myDocuments;
51
52   friend class HYDROData_Document; // to manipulate documents of application
53 };
54
55 // Define handle class 
56 DEFINE_STANDARD_HANDLE(HYDROData_Application,TDocStd_Application)
57
58 #endif