1 // Copyright (C) 2007-2010 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
23 // File : SALOMEDSImpl_StudyManager.hxx
24 // Author : Sergey RUIN
27 #ifndef __SALOMEDSImpl_STUDYMANAGER_I_H__
28 #define __SALOMEDSImpl_STUDYMANAGER_I_H__
30 #include "SALOMEDSImpl_Defines.hxx"
37 #include "DF_Application.hxx"
38 #include "SALOMEDSImpl_Study.hxx"
39 #include "SALOMEDSImpl_SObject.hxx"
40 #include "SALOMEDSImpl_Driver.hxx"
41 #include "DF_Attribute.hxx"
42 #include "DF_Label.hxx"
43 #include "DF_Document.hxx"
47 class SALOMEDSIMPL_EXPORT SALOMEDSImpl_StudyManager
52 DF_Application* _appli;
54 DF_Document* _clipboard;
55 std::string _errorCode;
59 //! standard constructor
60 SALOMEDSImpl_StudyManager();
62 //! standard destructor
63 virtual ~SALOMEDSImpl_StudyManager();
65 //! method to Create a New Study of name study_name
66 virtual SALOMEDSImpl_Study* NewStudy(const std::string& study_name);
68 //! method to Open a Study from it's persistent reference
69 virtual SALOMEDSImpl_Study* Open(const std::string& aStudyUrl);
71 //! method to close a Study
72 virtual void Close(SALOMEDSImpl_Study* aStudy);
74 //! method to save a Study
75 virtual bool Save(SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile);
77 virtual bool SaveASCII(SALOMEDSImpl_Study* aStudy,
78 SALOMEDSImpl_DriverFactory* aFactory,
81 //! method to save a Study to the persistent reference aUrl
82 virtual bool SaveAs(const std::string& aUrl,
83 SALOMEDSImpl_Study* aStudy,
84 SALOMEDSImpl_DriverFactory* aFactory,
87 virtual bool SaveAsASCII(const std::string& aUrl,
88 SALOMEDSImpl_Study* aStudy,
89 SALOMEDSImpl_DriverFactory* aFactory,
92 //! method to Get name list of open studies in the session
93 virtual std::vector<SALOMEDSImpl_Study*> GetOpenStudies();
95 //! method to get a Study from it's name
96 virtual SALOMEDSImpl_Study* GetStudyByName(const std::string& aStudyName) ;
98 //! method to get a Study from it's ID
99 virtual SALOMEDSImpl_Study* GetStudyByID(int aStudyID) ;
102 DF_Document* GetDocumentOfStudy(SALOMEDSImpl_Study* theStudy);
104 DF_Document* GetClipboard() { return _clipboard; }
106 bool CopyLabel(SALOMEDSImpl_Study* theSourceStudy,
107 SALOMEDSImpl_Driver* theEngine,
108 const int theSourceStartDepth,
109 const DF_Label& theSource,
110 const DF_Label& theDestinationMain);
112 DF_Label PasteLabel(SALOMEDSImpl_Study* theDestinationStudy,
113 SALOMEDSImpl_Driver* theEngine,
114 const DF_Label& theSource,
115 const DF_Label& theDestinationStart,
116 const int theCopiedStudyID,
117 const bool isFirstElement);
119 virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
120 virtual bool Copy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
121 virtual bool CanPaste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
122 virtual SALOMEDSImpl_SObject Paste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
124 // _SaveAs private function called by Save and SaveAs
125 virtual bool Impl_SaveAs(const std::string& aUrl,
126 SALOMEDSImpl_Study* aStudy,
127 SALOMEDSImpl_DriverFactory* aFactory,
131 // _SaveObject private function called by _SaveAs
132 virtual bool Impl_SaveObject(const SALOMEDSImpl_SObject& SC, HDFgroup *hdf_group_datatype);
134 // _SubstituteSlash function called by Open and GetStudyByName
135 virtual std::string Impl_SubstituteSlash(const std::string& aUrl);
137 virtual bool Impl_SaveProperties(SALOMEDSImpl_Study* aStudy, HDFgroup *hdf_group);
139 std::string GetErrorCode() { return _errorCode; }
140 virtual bool IsError() { return _errorCode != ""; }