1 // Copyright (C) 2007-2008 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.
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
22 // File : SALOMEDSImpl_StudyManager.hxx
23 // Author : Sergey RUIN
26 #ifndef __SALOMEDSImpl_STUDYMANAGER_I_H__
27 #define __SALOMEDSImpl_STUDYMANAGER_I_H__
29 #include "SALOMEDSImpl_Defines.hxx"
36 #include "DF_Application.hxx"
37 #include "SALOMEDSImpl_Study.hxx"
38 #include "SALOMEDSImpl_SObject.hxx"
39 #include "SALOMEDSImpl_Driver.hxx"
40 #include "DF_Attribute.hxx"
41 #include "DF_Label.hxx"
42 #include "DF_Document.hxx"
46 class SALOMEDSIMPL_EXPORT SALOMEDSImpl_StudyManager
51 DF_Application* _appli;
53 DF_Document* _clipboard;
54 std::string _errorCode;
58 //! standard constructor
59 SALOMEDSImpl_StudyManager();
61 //! standard destructor
62 virtual ~SALOMEDSImpl_StudyManager();
64 //! method to Create a New Study of name study_name
65 virtual SALOMEDSImpl_Study* NewStudy(const std::string& study_name);
67 //! method to Open a Study from it's persistent reference
68 virtual SALOMEDSImpl_Study* Open(const std::string& aStudyUrl);
70 //! method to close a Study
71 virtual void Close(SALOMEDSImpl_Study* aStudy);
73 //! method to save a Study
74 virtual bool Save(SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile);
76 virtual bool SaveASCII(SALOMEDSImpl_Study* aStudy,
77 SALOMEDSImpl_DriverFactory* aFactory,
80 //! method to save a Study to the persistent reference aUrl
81 virtual bool SaveAs(const std::string& aUrl,
82 SALOMEDSImpl_Study* aStudy,
83 SALOMEDSImpl_DriverFactory* aFactory,
86 virtual bool SaveAsASCII(const std::string& aUrl,
87 SALOMEDSImpl_Study* aStudy,
88 SALOMEDSImpl_DriverFactory* aFactory,
91 //! method to Get name list of open studies in the session
92 virtual std::vector<SALOMEDSImpl_Study*> GetOpenStudies();
94 //! method to get a Study from it's name
95 virtual SALOMEDSImpl_Study* GetStudyByName(const std::string& aStudyName) ;
97 //! method to get a Study from it's ID
98 virtual SALOMEDSImpl_Study* GetStudyByID(int aStudyID) ;
101 DF_Document* GetDocumentOfStudy(SALOMEDSImpl_Study* theStudy);
103 DF_Document* GetClipboard() { return _clipboard; }
105 bool CopyLabel(SALOMEDSImpl_Study* theSourceStudy,
106 SALOMEDSImpl_Driver* theEngine,
107 const int theSourceStartDepth,
108 const DF_Label& theSource,
109 const DF_Label& theDestinationMain);
111 DF_Label PasteLabel(SALOMEDSImpl_Study* theDestinationStudy,
112 SALOMEDSImpl_Driver* theEngine,
113 const DF_Label& theSource,
114 const DF_Label& theDestinationStart,
115 const int theCopiedStudyID,
116 const bool isFirstElement);
118 virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
119 virtual bool Copy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
120 virtual bool CanPaste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
121 virtual SALOMEDSImpl_SObject Paste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
123 // _SaveAs private function called by Save and SaveAs
124 virtual bool Impl_SaveAs(const std::string& aUrl,
125 SALOMEDSImpl_Study* aStudy,
126 SALOMEDSImpl_DriverFactory* aFactory,
130 // _SaveObject private function called by _SaveAs
131 virtual bool Impl_SaveObject(const SALOMEDSImpl_SObject& SC, HDFgroup *hdf_group_datatype);
133 // _SubstituteSlash function called by Open and GetStudyByName
134 virtual std::string Impl_SubstituteSlash(const std::string& aUrl);
136 virtual bool Impl_SaveProperties(SALOMEDSImpl_Study* aStudy, HDFgroup *hdf_group);
138 std::string GetErrorCode() { return _errorCode; }
139 virtual bool IsError() { return _errorCode != ""; }