Back to index

salome-kernel  6.5.0
SALOMEDSImpl_StudyManager.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  File   : SALOMEDSImpl_StudyManager.hxx
00024 //  Author : Sergey RUIN
00025 //  Module : SALOME
00026 //
00027 #ifndef __SALOMEDSImpl_STUDYMANAGER_I_H__
00028 #define __SALOMEDSImpl_STUDYMANAGER_I_H__
00029 
00030 #include "SALOMEDSImpl_Defines.hxx"
00031 
00032 // std C++ headers
00033 #include <sstream>
00034 #include <string>
00035 #include <vector>
00036 
00037 #include "DF_Application.hxx"
00038 #include "SALOMEDSImpl_Study.hxx"
00039 #include "SALOMEDSImpl_SObject.hxx"
00040 #include "SALOMEDSImpl_Driver.hxx"
00041 #include "DF_Attribute.hxx"
00042 #include "DF_Label.hxx"
00043 #include "DF_Document.hxx"
00044 
00045 class HDFgroup;
00046 
00047 class SALOMEDSIMPL_EXPORT SALOMEDSImpl_StudyManager
00048 {
00049 
00050 private:
00051 
00052   DF_Application*   _appli;  
00053   int               _IDcounter;
00054   DF_Document*      _clipboard;
00055   std::string       _errorCode;
00056 
00057 public:
00058 
00060   SALOMEDSImpl_StudyManager();
00061 
00063   virtual  ~SALOMEDSImpl_StudyManager(); 
00064 
00066   virtual SALOMEDSImpl_Study* NewStudy(const std::string& study_name);
00067 
00069   virtual SALOMEDSImpl_Study* Open(const std::string& aStudyUrl);
00070 
00072   virtual void Close(SALOMEDSImpl_Study* aStudy);
00073 
00075   virtual bool Save(SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile);
00076 
00077   virtual bool SaveASCII(SALOMEDSImpl_Study* aStudy, 
00078     SALOMEDSImpl_DriverFactory* aFactory, 
00079     bool theMultiFile);
00080 
00082   virtual bool SaveAs(const std::string& aUrl,  
00083     SALOMEDSImpl_Study* aStudy, 
00084     SALOMEDSImpl_DriverFactory* aFactory,
00085     bool theMultiFile);
00086 
00087   virtual bool SaveAsASCII(const std::string& aUrl, 
00088     SALOMEDSImpl_Study* aStudy, 
00089     SALOMEDSImpl_DriverFactory* aFactory,
00090     bool theMultiFile);
00091 
00093   virtual std::vector<SALOMEDSImpl_Study*> GetOpenStudies();
00094 
00096   virtual SALOMEDSImpl_Study* GetStudyByName(const std::string& aStudyName) ;
00097 
00099   virtual SALOMEDSImpl_Study* GetStudyByID(int aStudyID) ;
00100 
00101 
00102   DF_Document* GetDocumentOfStudy(SALOMEDSImpl_Study* theStudy);
00103 
00104   DF_Document* GetClipboard() { return _clipboard; }
00105 
00106   bool CopyLabel(SALOMEDSImpl_Study* theSourceStudy, 
00107     SALOMEDSImpl_Driver* theEngine,
00108     const int theSourceStartDepth,
00109     const DF_Label& theSource,
00110     const DF_Label& theDestinationMain);
00111 
00112   DF_Label PasteLabel(SALOMEDSImpl_Study* theDestinationStudy,
00113     SALOMEDSImpl_Driver* theEngine,
00114     const DF_Label& theSource,
00115     const DF_Label& theDestinationStart,
00116     const int theCopiedStudyID,
00117     const bool isFirstElement);
00118 
00119   virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
00120   virtual bool Copy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
00121   virtual bool CanPaste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
00122   virtual SALOMEDSImpl_SObject Paste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
00123 
00124   // _SaveAs private function called by Save and SaveAs
00125   virtual bool Impl_SaveAs(const std::string& aUrl,
00126     SALOMEDSImpl_Study* aStudy,
00127     SALOMEDSImpl_DriverFactory* aFactory,
00128     bool theMultiFile,
00129     bool theASCII);
00130 
00131   // _SaveObject private function called by _SaveAs
00132   virtual bool Impl_SaveObject(const SALOMEDSImpl_SObject& SC, HDFgroup *hdf_group_datatype);
00133 
00134   // _SubstituteSlash function called by Open and GetStudyByName
00135   virtual std::string Impl_SubstituteSlash(const std::string& aUrl);
00136 
00137   virtual bool Impl_SaveProperties(SALOMEDSImpl_Study* aStudy, HDFgroup *hdf_group);
00138 
00139   std::string GetErrorCode() { return _errorCode; }
00140   virtual bool IsError() { return _errorCode != ""; }
00141 
00142 };
00143 
00144 #endif