1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : SALOMEDSImpl_StudyManager.hxx
21 // Author : Sergey RUIN
24 #ifndef __SALOMEDSImpl_STUDYMANAGER_I_H__
25 #define __SALOMEDSImpl_STUDYMANAGER_I_H__
32 #include "DF_Application.hxx"
33 #include "SALOMEDSImpl_Study.hxx"
34 #include "SALOMEDSImpl_SObject.hxx"
35 #include "SALOMEDSImpl_Driver.hxx"
36 #include "DF_Attribute.hxx"
37 #include "DF_Label.hxx"
38 #include "DF_Document.hxx"
42 class SALOMEDSImpl_StudyManager
47 DF_Application* _appli;
49 DF_Document* _clipboard;
50 std::string _errorCode;
54 //! standard constructor
55 Standard_EXPORT SALOMEDSImpl_StudyManager();
57 //! standard destructor
58 Standard_EXPORT virtual ~SALOMEDSImpl_StudyManager();
60 //! method to Create a New Study of name study_name
61 Standard_EXPORT virtual SALOMEDSImpl_Study* NewStudy(const std::string& study_name);
63 //! method to Open a Study from it's persistent reference
64 Standard_EXPORT virtual SALOMEDSImpl_Study* Open(const std::string& aStudyUrl);
66 //! method to close a Study
67 Standard_EXPORT virtual void Close(SALOMEDSImpl_Study* aStudy);
69 //! method to save a Study
70 Standard_EXPORT virtual bool Save(SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile);
72 Standard_EXPORT virtual bool SaveASCII(SALOMEDSImpl_Study* aStudy,
73 SALOMEDSImpl_DriverFactory* aFactory,
76 //! method to save a Study to the persistent reference aUrl
77 Standard_EXPORT virtual bool SaveAs(const std::string& aUrl,
78 SALOMEDSImpl_Study* aStudy,
79 SALOMEDSImpl_DriverFactory* aFactory,
82 Standard_EXPORT virtual bool SaveAsASCII(const std::string& aUrl,
83 SALOMEDSImpl_Study* aStudy,
84 SALOMEDSImpl_DriverFactory* aFactory,
87 //! method to Get name list of open studies in the session
88 Standard_EXPORT virtual std::vector<SALOMEDSImpl_Study*> GetOpenStudies();
90 //! method to get a Study from it's name
91 Standard_EXPORT virtual SALOMEDSImpl_Study* GetStudyByName(const std::string& aStudyName) ;
93 //! method to get a Study from it's ID
94 Standard_EXPORT virtual SALOMEDSImpl_Study* GetStudyByID(int aStudyID) ;
97 Standard_EXPORT DF_Document* GetDocumentOfStudy(SALOMEDSImpl_Study* theStudy);
99 Standard_EXPORT DF_Document* GetClipboard() { return _clipboard; }
101 Standard_EXPORT bool CopyLabel(SALOMEDSImpl_Study* theSourceStudy,
102 SALOMEDSImpl_Driver* theEngine,
103 const int theSourceStartDepth,
104 const DF_Label& theSource,
105 const DF_Label& theDestinationMain);
107 Standard_EXPORT DF_Label PasteLabel(SALOMEDSImpl_Study* theDestinationStudy,
108 SALOMEDSImpl_Driver* theEngine,
109 const DF_Label& theSource,
110 const DF_Label& theDestinationStart,
111 const int theCopiedStudyID,
112 const bool isFirstElement);
114 Standard_EXPORT virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
115 Standard_EXPORT virtual bool Copy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
116 Standard_EXPORT virtual bool CanPaste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
117 Standard_EXPORT virtual SALOMEDSImpl_SObject Paste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
119 // _SaveAs private function called by Save and SaveAs
120 Standard_EXPORT virtual bool Impl_SaveAs(const std::string& aUrl,
121 SALOMEDSImpl_Study* aStudy,
122 SALOMEDSImpl_DriverFactory* aFactory,
126 // _SaveObject private function called by _SaveAs
127 Standard_EXPORT virtual bool Impl_SaveObject(const SALOMEDSImpl_SObject& SC, HDFgroup *hdf_group_datatype);
129 // _SubstituteSlash function called by Open and GetStudyByName
130 Standard_EXPORT virtual std::string Impl_SubstituteSlash(const std::string& aUrl);
132 Standard_EXPORT virtual bool Impl_SaveProperties(SALOMEDSImpl_Study* aStudy, HDFgroup *hdf_group);
134 Standard_EXPORT std::string GetErrorCode() { return _errorCode; }
135 Standard_EXPORT virtual bool IsError() { return _errorCode != ""; }