Salome HOME
Remove trailing space.
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_Study.hxx
index 1aa9ee1a1671621f1605406d23ad22e314d0ce6c..2a297f440af570e7587125fffe862edd090f1b41 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -51,7 +51,7 @@
 #include "SALOMEDSImpl_ChildIterator.hxx" 
 #include "SALOMEDSImpl_GenericVariable.hxx"
 
-class SALOMEDSImpl_StudyManager;
+class HDFgroup;
 class SALOMEDSImpl_GenericAttribute;
 
 
@@ -59,11 +59,11 @@ class SALOMEDSIMPL_EXPORT SALOMEDSImpl_Study
 {
 private:
   std::string              _name;  
+  DF_Application*          _appli;
   DF_Document*             _doc;  // Document
+  DF_Document*             _clipboard;
   bool                     _Saved; // True if the Study is saved
   std::string              _URL; //URL of the persistent reference of the study
-  int                      _StudyId; 
-  DF_Label                 _current;
   bool                     _autoFill; 
   std::string              _errorCode;
   std::vector<std::string> _lockers;
@@ -72,6 +72,7 @@ private:
   SALOMEDSImpl_UseCaseBuilder* _useCaseBuilder;
   SALOMEDSImpl_AbstractCallback* _notifier;
   SALOMEDSImpl_AbstractCallback* _genObjRegister;
+  std::string              _dumpPath; // path (folder) to the python file which is currently dumped
 
   std::map<std::string, SALOMEDSImpl_SObject> _mapOfSO;
   std::map<std::string, SALOMEDSImpl_SComponent> _mapOfSCO;
@@ -88,28 +89,67 @@ private:
 
   std::string _GetStudyVariablesScript();
   std::string _GetNoteBookAccessor();
-  std::string _GetNoteBookAccess(const std::string& theStudyVar);
+  std::string _GetNoteBookAccess();
 
 public:
 
-  static SALOMEDSImpl_Study* GetStudy(const DF_Label& theLabel);
+  static SALOMEDSImpl_Study* GetStudyImpl(const DF_Label& theLabel);
   static SALOMEDSImpl_SObject SObject(const DF_Label& theLabel);
   static SALOMEDSImpl_SComponent SComponent(const DF_Label& theLabel);
   static void IORUpdated(const SALOMEDSImpl_AttributeIOR* theAttribute);
 
    //! standard constructor
-   SALOMEDSImpl_Study(const DF_Document*, const std::string& study_name);
+   SALOMEDSImpl_Study();
   
   //! standard destructor
   virtual ~SALOMEDSImpl_Study(); 
   
-  //! method to Get persistent reference of study (idem URL())
-  virtual std::string GetPersistentReference();
+  virtual void Init();
+  virtual void Clear();
+
+  //! method to Open a Study from it's persistent reference
+  virtual bool Open(const std::string& aStudyUrl);
+
+  //! method to save a Study
+  virtual bool Save(SALOMEDSImpl_DriverFactory* aFactory,
+                    bool theMultiFile,
+                    bool theASCII);
+
+  //! method to save a Study to the persistent reference aUrl
+  virtual bool SaveAs(const std::string& aUrl,
+                      SALOMEDSImpl_DriverFactory* aFactory,
+                      bool theMultiFile,
+                      bool theASCII);
+
+  bool CopyLabel(SALOMEDSImpl_Driver* theEngine,
+                 const int theSourceStartDepth,
+                 const DF_Label& theSource,
+                 const DF_Label& theDestinationMain);
 
-  //! method to Get transient reference of study
-  virtual std::string GetTransientReference();
+  DF_Label PasteLabel(SALOMEDSImpl_Driver* theEngine,
+                      const DF_Label& theSource,
+                      const DF_Label& theDestinationStart,
+                      const bool isFirstElement);
 
-  virtual void SetTransientReference(const std::string& theIOR);
+  virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
+  virtual bool Copy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
+  virtual bool CanPaste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
+  virtual SALOMEDSImpl_SObject Paste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
+
+  // _SaveAs private function called by Save and SaveAs
+  virtual bool Impl_SaveAs(const std::string& aUrl,
+                           SALOMEDSImpl_DriverFactory* aFactory,
+                           bool theMultiFile,
+                           bool theASCII);
+
+  // _SaveObject private function called by _SaveAs
+  virtual bool Impl_SaveObject(const SALOMEDSImpl_SObject& SC, HDFgroup *hdf_group_datatype);
+
+  virtual bool Impl_SaveProperties(HDFgroup *hdf_group);
+
+
+  //! method to Get persistent reference of study (idem URL())
+  virtual std::string GetPersistentReference();
 
   //! method to detect if a study is empty
   virtual bool IsEmpty();
@@ -145,24 +185,6 @@ public:
 
   std::string GetObjectPathByIOR(const std::string& theIOR);
 
-  //! method to set a context: root ('/') is UserData component
-  virtual bool SetContext(const std::string& thePath);
-
-  //! method to get a context
-  virtual std::string GetContext();  
-
-  //! method to get all object names in the given context (or in the current context, if 'theContext' is empty)
-  virtual std::vector<std::string> GetObjectNames(const std::string& theContext);
-
-  //! method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
-  virtual std::vector<std::string> GetDirectoryNames(const std::string& theContext);
-
-  //! method to get all file names in the given context (or in the current context, if 'theContext' is empty)
-  virtual std::vector<std::string> GetFileNames(const std::string& theContext);
-
-  //! method to get all components names
-  virtual std::vector<std::string> GetComponentNames(const std::string& theContext);
-
   //! method to Create a ChildIterator from an SObject 
   virtual SALOMEDSImpl_ChildIterator NewChildIterator(const SALOMEDSImpl_SObject& aSO);
 
@@ -195,10 +217,6 @@ public:
 
   virtual bool IsLocked();
   
-  virtual int StudyId();
-
-  virtual void  StudyId(int id);
-  
   virtual void DeleteIORLabelMapItem(const std::string& anIOR);
   virtual void UpdateIORLabelMap(const std::string& anIOR, const std::string& aLabel);
   
@@ -212,8 +230,6 @@ public:
   
   virtual SALOMEDSImpl_UseCaseBuilder* GetUseCaseBuilder();
   
-  virtual void Close();
-  
   void EnableUseCaseAutoFilling(bool isEnabled);
   
   virtual std::string GetErrorCode() { return _errorCode; }
@@ -226,8 +242,6 @@ public:
   virtual DF_Attribute* GetAttribute(const std::string& theEntry, 
                                                      const std::string& theType);
 
-  virtual bool HasCurrentContext() { return !_current.IsNull(); }
-
   virtual bool DumpStudy(const std::string& thePath, 
                          const std::string& theBaseName, 
                          bool isPublished,
@@ -235,6 +249,9 @@ public:
                          SALOMEDSImpl_DriverFactory* theFactory);
 
   static std::string GetDumpStudyComment(const char* theComponentName = 0);
+
+  // Returns the folder of the python script which is currently dumped
+  std::string GetDumpPath();
   
   virtual DF_Document* GetDocument() { return _doc; } 
 
@@ -326,7 +343,6 @@ public:
   static void UnRegisterGenObj(const std::string& theIOR, DF_Label label);
   void setGenObjRegister(SALOMEDSImpl_AbstractCallback* theRegister);
 
-  friend class SALOMEDSImpl_StudyManager;    
   friend class SALOMEDSImpl_GenericAttribute;
   friend class SALOMEDSImpl_GenericVariable;
 };