-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// File : SALOMEDSImpl_Study.hxx
// Author : Sergey RUIN
// Module : SALOME
#include "SALOMEDSImpl_ChildIterator.hxx"
#include "SALOMEDSImpl_GenericVariable.hxx"
-class SALOMEDSImpl_StudyManager;
+class HDFgroup;
class SALOMEDSImpl_GenericAttribute;
{
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;
SALOMEDSImpl_Callback* _cb;
SALOMEDSImpl_StudyBuilder* _builder;
SALOMEDSImpl_UseCaseBuilder* _useCaseBuilder;
+ SALOMEDSImpl_AbstractCallback* _notifier;
+ SALOMEDSImpl_AbstractCallback* _genObjRegister;
std::map<std::string, SALOMEDSImpl_SObject> _mapOfSO;
std::map<std::string, SALOMEDSImpl_SComponent> _mapOfSCO;
std::string _GetStudyVariablesScript();
std::string _GetNoteBookAccessor();
- std::string _GetNoteBookAccess();
+ std::string _GetNoteBookAccess(const std::string& theStudyVar);
public:
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();
+ 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);
+
+ virtual bool SaveASCII(SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile);
+
+ //! method to save a Study to the persistent reference aUrl
+ virtual bool SaveAs(const std::string& aUrl,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile);
+
+ virtual bool SaveAsASCII(const std::string& aUrl,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile);
+
+ bool CopyLabel(SALOMEDSImpl_Driver* theEngine,
+ const int theSourceStartDepth,
+ const DF_Label& theSource,
+ const DF_Label& theDestinationMain);
+
+ DF_Label PasteLabel(SALOMEDSImpl_Driver* theEngine,
+ const DF_Label& theSource,
+ const DF_Label& theDestinationStart,
+ const bool isFirstElement);
+
+ 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 get study name
virtual std::string Name();
-
- //! method to set study name
- virtual void Name(const std::string& name);
//! method to get if study has been saved
virtual bool IsSaved();
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);
virtual std::vector<SALOMEDSImpl_SObject> FindDependances(const SALOMEDSImpl_SObject& anObject);
virtual SALOMEDSImpl_UseCaseBuilder* GetUseCaseBuilder();
- virtual void Close();
-
void EnableUseCaseAutoFilling(bool isEnabled);
virtual std::string GetErrorCode() { return _errorCode; }
virtual SALOMEDSImpl_SObject GetSObject(const std::string& theEntry);
virtual SALOMEDSImpl_SObject GetSObject(const DF_Label& theEntryLabel);
virtual DF_Attribute* GetAttribute(const std::string& theEntry,
- const std::string& theType);
+ const std::string& theType);
virtual bool HasCurrentContext() { return !_current.IsNull(); }
virtual bool DumpStudy(const std::string& thePath,
- const std::string& theBaseName,
- bool isPublished,
- SALOMEDSImpl_DriverFactory* theFactory);
+ const std::string& theBaseName,
+ bool isPublished,
+ bool isMultiFile,
+ SALOMEDSImpl_DriverFactory* theFactory);
static std::string GetDumpStudyComment(const char* theComponentName = 0);
SALOMEDSImpl_AttributeParameter* GetCommonParameters(const char* theID, int theSavePoint);
SALOMEDSImpl_AttributeParameter* GetModuleParameters(const char* theID,
- const char* theModuleName,
- int theSavePoint);
+ const char* theModuleName,
+ int theSavePoint);
//Locks the study, theLockerID is identificator of the of the one who locked the study for ex. IOR
void SetStudyLock(const char* theLockerID);
const double theValue,
const SALOMEDSImpl_GenericVariable::VariableTypes);
+ void SetStringVariable(const std::string& theVarName,
+ const std::string& theValue,
+ const SALOMEDSImpl_GenericVariable::VariableTypes);
+
+ void SetStringVariableAsDouble(const std::string& theVarName,
+ const double theValue,
+ const SALOMEDSImpl_GenericVariable::VariableTypes);
+
double GetVariableValue(const std::string& theVarName);
+ std::string GetStringVariableValue(const std::string& theVarName);
+
bool IsTypeOf(const std::string& theVarName,
SALOMEDSImpl_GenericVariable::VariableTypes theType) const;
bool IsVariableUsed(const std::string& theVarName);
bool FindVariableAttribute(SALOMEDSImpl_StudyBuilder* theStudyBuilder,
- SALOMEDSImpl_SObject theSObject,
- const std::string& theName);
+ SALOMEDSImpl_SObject theSObject,
+ const std::string& theName);
bool FindVariableAttribute(const std::string& theName);
void ReplaceVariableAttribute(SALOMEDSImpl_StudyBuilder* theStudyBuilder,
- SALOMEDSImpl_SObject theSObject,
- const std::string& theSource,
- const std::string& theDest);
+ SALOMEDSImpl_SObject theSObject,
+ const std::string& theSource,
+ const std::string& theDest);
void ReplaceVariableAttribute(const std::string& theSource, const std::string& theDest);
std::vector< std::vector<std::string> > ParseVariables(const std::string& theVariables) const;
//Returns a list of IOR's stored in the study
std::vector<std::string> GetIORs();
- friend class SALOMEDSImpl_StudyManager;
+ // Notification mechanism
+ virtual bool addSO_Notification(const SALOMEDSImpl_SObject& theSObject);
+ virtual bool removeSO_Notification(const SALOMEDSImpl_SObject& theSObject);
+ virtual bool modifySO_Notification(const SALOMEDSImpl_SObject& theSObject, int reason);
+ virtual void setNotifier(SALOMEDSImpl_AbstractCallback* notifier);
+
+ static void RegisterGenObj (const std::string& theIOR, DF_Label label);
+ static void UnRegisterGenObj(const std::string& theIOR, DF_Label label);
+ void setGenObjRegister(SALOMEDSImpl_AbstractCallback* theRegister);
+
friend class SALOMEDSImpl_GenericAttribute;
friend class SALOMEDSImpl_GenericVariable;
};