]> SALOME platform Git repositories - modules/kernel.git/blob - src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.hxx
Salome HOME
PR: merge from branch BR_UnitTests tag mergeto_trunk_17oct05
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_StudyManager.hxx
1 //  File   : SALOMEDSImpl_StudyManager.hxx
2 //  Author : Sergey RUIN
3 //  Module : SALOME
4
5 #ifndef __SALOMEDSImpl_STUDYMANAGER_I_H__
6 #define __SALOMEDSImpl_STUDYMANAGER_I_H__
7
8 //Handle definition
9 #include <Handle_MMgt_TShared.hxx>
10 #include <Standard_DefineHandle.hxx>
11 DEFINE_STANDARD_HANDLE( SALOMEDSImpl_StudyManager, MMgt_TShared )
12
13 // std C++ headers
14 #include <strstream>
15
16 // Cascade headers
17 #include "SALOMEDSImpl_OCAFApplication.hxx"
18 #include "SALOMEDSImpl_Study.hxx"
19 #include "SALOMEDSImpl_SObject.hxx"
20 #include "SALOMEDSImpl_Driver.hxx"
21 #include <TCollection_AsciiString.hxx>
22 #include <TDF_Attribute.hxx>
23 #include <TDF_Label.hxx>
24 #include <TDocStd_Document.hxx>
25 #include <TColStd_HSequenceOfTransient.hxx>
26
27 class HDFgroup;
28
29 class SALOMEDSImpl_StudyManager : public MMgt_TShared 
30 {
31
32 private:
33
34   Handle (SALOMEDSImpl_OCAFApplication) _OCAFApp;  
35   int _IDcounter;
36   Handle(TDocStd_Document) _clipboard;
37   TCollection_AsciiString  _errorCode;
38
39 public:
40
41   //! standard constructor
42   Standard_EXPORT SALOMEDSImpl_StudyManager();
43
44   //! standard destructor
45   Standard_EXPORT virtual  ~SALOMEDSImpl_StudyManager(); 
46
47   //! method to Create a New Study of name study_name
48   Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) NewStudy(const TCollection_AsciiString& study_name);
49
50   //! method to Open a Study from it's persistent reference
51   Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) Open(const TCollection_AsciiString& aStudyUrl);
52
53   //! method to close a Study 
54   Standard_EXPORT virtual void Close(const Handle(SALOMEDSImpl_Study)& aStudy);
55
56   //! method to save a Study 
57   Standard_EXPORT virtual bool Save(const Handle(SALOMEDSImpl_Study)& aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile);
58
59   Standard_EXPORT virtual bool SaveASCII(const Handle(SALOMEDSImpl_Study)& aStudy, 
60                          SALOMEDSImpl_DriverFactory* aFactory, 
61                          bool theMultiFile);
62
63   //! method to save a Study to the persistent reference aUrl
64   Standard_EXPORT virtual bool SaveAs(const TCollection_AsciiString& aUrl,  
65                       const Handle(SALOMEDSImpl_Study)& aStudy, 
66                       SALOMEDSImpl_DriverFactory* aFactory,
67                       bool theMultiFile);
68
69   Standard_EXPORT virtual bool SaveAsASCII(const TCollection_AsciiString& aUrl, 
70                            const Handle(SALOMEDSImpl_Study)& aStudy, 
71                            SALOMEDSImpl_DriverFactory* aFactory,
72                            bool theMultiFile);
73
74   //! method to Get name list of open studies in the session
75   Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) GetOpenStudies();
76
77   //! method to get a Study from it's name
78   Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) GetStudyByName(const TCollection_AsciiString& aStudyName) ;
79
80   //! method to get a Study from it's ID
81   Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) GetStudyByID(int aStudyID) ;
82
83
84   Standard_EXPORT Handle(TDocStd_Document) GetDocumentOfStudy(const Handle(SALOMEDSImpl_Study)& theStudy);
85
86   Standard_EXPORT Handle(TDocStd_Document) GetClipboard() { return _clipboard; }
87   
88   Standard_EXPORT bool CopyLabel(const Handle(SALOMEDSImpl_Study)& theSourceStudy, 
89                  SALOMEDSImpl_Driver* theEngine,
90                  const int theSourceStartDepth,
91                  const TDF_Label& theSource,
92                  const TDF_Label& theDestinationMain);
93
94   Standard_EXPORT TDF_Label PasteLabel(const Handle(SALOMEDSImpl_Study)& theDestinationStudy,
95                        SALOMEDSImpl_Driver* theEngine,
96                        const TDF_Label& theSource,
97                        const TDF_Label& theDestinationStart,
98                        const int theCopiedStudyID,
99                        const bool isFirstElement);
100   
101   Standard_EXPORT virtual bool CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
102   Standard_EXPORT virtual bool Copy(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
103   Standard_EXPORT virtual bool CanPaste(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
104   Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) Paste(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
105
106   // _SaveAs private function called by Save and SaveAs
107   Standard_EXPORT virtual bool Impl_SaveAs(const TCollection_AsciiString& aUrl,
108                            const Handle(SALOMEDSImpl_Study)& aStudy,
109                            SALOMEDSImpl_DriverFactory* aFactory,
110                            bool theMultiFile,
111                            bool theASCII);
112
113   // _SaveObject private function called by _SaveAs
114   Standard_EXPORT virtual bool Impl_SaveObject(const Handle(SALOMEDSImpl_SObject)& SC, HDFgroup *hdf_group_datatype);
115
116   // _SubstituteSlash function called by Open and GetStudyByName
117   Standard_EXPORT virtual TCollection_AsciiString Impl_SubstituteSlash(const TCollection_AsciiString& aUrl);
118
119   Standard_EXPORT virtual bool Impl_SaveProperties(const Handle(SALOMEDSImpl_Study)& aStudy, HDFgroup *hdf_group);
120
121   Standard_EXPORT TCollection_AsciiString GetErrorCode() { return _errorCode; }
122   Standard_EXPORT virtual bool IsError() { return _errorCode != ""; }
123
124 public:
125   DEFINE_STANDARD_RTTI( SALOMEDSImpl_StudyManager )
126   
127 };
128
129 #endif