Salome HOME
SALOMEDS changes:
authormpa <mpa@opencascade.com>
Wed, 18 Jan 2017 09:42:43 +0000 (12:42 +0300)
committermpa <mpa@opencascade.com>
Wed, 18 Jan 2017 09:42:43 +0000 (12:42 +0300)
- combine Save, SaveASCII; SaveAs, SaveAsASCII methods
- delete deprecated code from Study and StudyBuilder interfaces

22 files changed:
doc/salome/examples/example23
doc/salome/kernel_salome.dox
idl/SALOMEDS.idl
src/SALOMEDS/SALOMEDS_Client.cxx
src/SALOMEDS/SALOMEDS_Study.cxx
src/SALOMEDS/SALOMEDS_Study.hxx
src/SALOMEDS/SALOMEDS_StudyBuilder.cxx
src/SALOMEDS/SALOMEDS_StudyBuilder.hxx
src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx
src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx
src/SALOMEDS/SALOMEDS_Study_i.cxx
src/SALOMEDS/SALOMEDS_Study_i.hxx
src/SALOMEDS/Test/SALOMEDSTest_Study.cxx
src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx
src/SALOMEDSClient/SALOMEDSClient_Study.hxx
src/SALOMEDSClient/SALOMEDSClient_StudyBuilder.hxx
src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx
src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx
src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx
src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.hxx
src/TOOLSDS/SALOMEDS_Tool.cxx
src/TOOLSDS/SALOMEDS_Tool.hxx

index da60ce0e9bfee0a44d5ee08d08ad63ceb2f6d720..b613c47c7d40e280fe44179bafce154c024ac554 100644 (file)
@@ -12,19 +12,3 @@ anAttrName = anAttr._narrow(SALOMEDS.AttributeName)
 anAttrName.SetValue("User data")
 
 
-#Add a new case 'Case1' to the component 'User data'
-aBuilder.AddDirectory("/User data/Case1")
-
-#Set a study context to '/User data/Case1'
-aStudy.SetContext("/User data/Case1")
-
-#Print the current study context
-print aStudy.GetContext()
-
-#Add a sub directory 'aSubCase' to 'Case1' (under the current context)
-aBuilder.AddDirectory("aSubCase")
-
-
-#Add a new case 'Case2' to component 'User data'
-aBuilder.AddDirectory("/User data/Case2")
-
index da0acb4faefd8c3c0b1d2ff4426713d28933acc9..72ac05c4644b96a6eb488a7c83b508f8081267fc 100644 (file)
@@ -97,19 +97,19 @@ documentation.
 studyName = salome.myStudy._get_Name()
 
 # open study from file /home/user/MyStudy.hdf
-study = salome.myStudy.OpenStudy("/home/user/MyStudy.hdf")
+salome.myStudy.Open("/home/user/MyStudy.hdf")
 
 # save study
-salome.myStudy.Save(study, False) # not using multifile save mode
+salome.myStudy.Save(False, False) # not using multifile save mode
 
 # save study in ASCII format
-salome.myStudy.SaveASCII(study, True) # using multifile save mode
+salome.myStudy.Save(True, True) # using multifile save mode
 
 # save study with the new file path
-salome.myStudy.SaveAs("/home/user/MyStudy.hdf", study, False)
+salome.myStudy.SaveAs("/home/user/MyStudy.hdf", False, False)
 
 # save study with the new file path in ASCII format
-salome.myStudy.SaveAsASCII("/home/user/MyStudy.hdf", study, False)
+salome.myStudy.SaveAs("/home/user/MyStudy.hdf", False, True)
 
 # clear study
 salome.myStudy.Clear()
index d43d58e835897ed3017d7cf0cde8cda65b17faad..c193837dbb0a80dca6bdd9afa2fbda62b11883d6 100644 (file)
@@ -238,15 +238,6 @@ module SALOMEDS
 
     void RemoveReference(in SObject anObject) ;
 
-/*!
-   Adds a directory in the %Study.
-   \param theName String parameter defining the name of the directory.
-
-<em>See \ref example23 for an example of this method usage in batchmode of %SALOME application.</em>
-
-*/
-    void AddDirectory(in string theName) raises(LockProtection);
-
 /*! \brief Identification of the %SObject's substructure.
 
       Identification of the %SObject's substructure by GUID.
@@ -379,8 +370,6 @@ Searches for a definite %SObject with a definite GUID and returns True if it fin
 
 //! Invalid study reference
     exception StudyInvalidReference {};
-//! Invalid study context
-    exception StudyInvalidContext {};
 //! Invalid study component
     exception StudyInvalidComponent {};
 //! Invalid directory of the %study exception
@@ -482,38 +471,6 @@ Searches for a definite %SObject with a definite GUID and returns True if it fin
 */
     string GetObjectPath(in Object theObject) raises(StudyInvalidReference);
 
-/*! \brief  Set the context of the %Study.
-
-    \param thePath String parameter defining the context of the study.
-
-<em>See \ref example23 for an example of this method usage in batchmode of %SALOME application.</em>
-*/
-    void SetContext(in string thePath) raises (StudyInvalidReference, StudyInvalidContext);
-/*!  \brief Get the context of the %Study.
-
-<em>See \ref example23 for an example of this method usage in batchmode of %SALOME application.</em>
-*/
-    string GetContext() raises (StudyInvalidReference, StudyInvalidContext);
-/*!  \brief Get a list of names of objects corresponding to the context.
-
-   \note  If the parameter <VAR>theContext</VAR> is empty, then the current context will be used.
-*/
-    ListOfStrings GetObjectNames(in string theContext) raises (StudyInvalidReference, StudyInvalidContext);
-/*! \brief Get a list of names of directories and subdirectories corresponding to the context.
-
-   \note  If the parameter <VAR>theContext</VAR> is empty, then the current context will be used.
-*/
-    ListOfStrings GetDirectoryNames(in string theContext) raises (StudyInvalidReference, StudyInvalidContext);
-/*! \brief  Get a list of names of Files corresponding to the context.
-
-    \note  If the parameter <VAR>theContext</VAR> is empty, then the current context will be used.
-*/
-    ListOfStrings GetFileNames(in string theContext) raises (StudyInvalidReference, StudyInvalidContext);
-/*! \brief Get a list of names of Components corresponding to the context.
-
-   \note  If the parameter <VAR>theContext</VAR> is empty, then the current context will be used.
-*/
-    ListOfStrings GetComponentNames(in string theContext) raises(StudyInvalidReference);
 /*!  \brief Create a new iterator of child levels of the given %SObject.
 
     \param aSO The given %SObject
@@ -614,42 +571,27 @@ Searches for a definite %SObject with a definite GUID and returns True if it fin
 */
     boolean Open (in URLPath aStudyUrl) raises (SALOME::SALOME_Exception);
     
-/*! \brief Saving the study in a HDF file (or files).
+/*! \brief Saving the study in a file (or files).
 
     Saves a study.
     \param theMultiFile If this parameter is True the study will be saved in several files.
+    \param theASCII If this parameter is True the study will be saved in ASCII format, otherwise in HDF format.
 */
-    boolean Save(in boolean theMultiFile) raises(StudyInvalidReference);
+    boolean Save(in boolean theMultiFile, in boolean theASCII) raises(StudyInvalidReference);
     
-/*! \brief Saving a study in a ASCII file (or files).
-
-    Saves a study in an ASCII format file (or files).
-    \param theMultiFile If this parameter is True the study will be saved in several files.
-*/
-    boolean  SaveASCII(in boolean theMultiFile) raises(StudyInvalidReference);
-/*! \brief Saving the study in a specified HDF file (or files).
+/*! \brief Saving the study in a specified file (or files).
 
     Saves the study in a specified file (or files).
     \param aUrl The path to the definite file in whcih the study will be saved
-    \param aStudy The study which will be saved
     \param theMultiFile If this parameter is True the study will be saved in several files.
+    \param theASCII If this parameter is True the study will be saved in ASCII format, otherwise in HDF format.
 
 <em>See \ref example1 for an example of this method usage in batchmode of %SALOME application.</em>
 */
     boolean  SaveAs(in URLPath aUrl, // if the file already exists
-                    in boolean theMultiFile) // overwrite (as option)
+                    in boolean theMultiFile, // overwrite (as option)
+                    in boolean theASCII) 
                     raises(StudyInvalidReference); 
-/*! \brief Saving the study in a specified ASCII file (or files).
-
-    Saves the study in a specified ASCII file (or files).
-
-    \param aUrl The path to the definite file in whcih the study will be saved
-    \param aStudy The study which will be saved
-    \param theMultiFile If this parameter is True the study will be saved in several files.
-*/
-    boolean  SaveAsASCII(in URLPath aUrl, // if the file already exists
-                         in boolean theMultiFile) // overwrite (as option)
-                         raises(StudyInvalidReference); 
 /*!
     Returns True, if the given %SObject can be copied to the clipboard.
 */
index db409bbf53681e4aabd41fa7baccadf0fe6e9467..1f5ef1d3a341bdd6c398f46e2e131064f4399821 100644 (file)
@@ -194,7 +194,7 @@ static void Test(SALOMEDS::Study_ptr myStudy)
   DumpStudy(myStudy);
   
   // Save as
-  myStudy->SaveAs("/home/edeville/Study1.hdf", false);
+  myStudy->SaveAs("/home/edeville/Study1.hdf", false, false);
 
   // Get Persistent Reference of the study test
   name = myStudy->GetPersistentReference();
index a23708898d5ee2ab0c32512bab6638e77d28d17d..3fb21699decfa7abac0288a51515edad4c7eabfe 100644 (file)
@@ -132,28 +132,16 @@ bool SALOMEDS_Study::Open(const std::string& theStudyUrl)
   return true;
 }
 
-bool SALOMEDS_Study::Save(bool theMultiFile)
+bool SALOMEDS_Study::Save(bool theMultiFile, bool theASCII)
 {
   //SRN: Pure CORBA save as the save operation require CORBA in any case
-  return _corba_impl->Save(theMultiFile);
+  return _corba_impl->Save(theMultiFile, theASCII);
 }
 
-bool SALOMEDS_Study::SaveASCII(bool theMultiFile)
+bool SALOMEDS_Study::SaveAs(const std::string& theUrl, bool theMultiFile, bool theASCII)
 {
   //SRN: Pure CORBA save as the save operation require CORBA in any case
-  return _corba_impl->SaveASCII(theMultiFile);
-}
-
-bool SALOMEDS_Study::SaveAs(const std::string& theUrl, bool theMultiFile)
-{
-  //SRN: Pure CORBA save as the save operation require CORBA in any case
-  return _corba_impl->SaveAs((char*)theUrl.c_str(), theMultiFile);
-}
-
-bool SALOMEDS_Study::SaveAsASCII(const std::string& theUrl, bool theMultiFile)
-{
-  //SRN: Pure CORBA save as the save operation require CORBA in any case
-  return _corba_impl->SaveAsASCII((char*)theUrl.c_str(), theMultiFile);
+  return _corba_impl->SaveAs((char*)theUrl.c_str(), theMultiFile, theASCII);
 }
 
 SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_ptr orb)
@@ -458,91 +446,6 @@ std::string SALOMEDS_Study::GetObjectPath(const _PTR(SObject)& theSO)
   return aPath;
 }
 
-void SALOMEDS_Study::SetContext(const std::string& thePath)
-{
-  if (_isLocal) {
-    SALOMEDS::Locker lock;
-    _local_impl->SetContext(thePath);
-  }
-  else _corba_impl->SetContext((char*)thePath.c_str());
-}
-
-std::string SALOMEDS_Study::GetContext()  
-{
-  std::string aPath;
-  if (_isLocal) {
-    SALOMEDS::Locker lock;
-    aPath = _local_impl->GetContext();
-  }
-  else aPath = _corba_impl->GetContext();
-  return aPath;
-}
-
-std::vector<std::string> SALOMEDS_Study::GetObjectNames(const std::string& theContext)
-{
-  std::vector<std::string> aVector;
-  int aLength, i;
-  if (_isLocal) {
-    SALOMEDS::Locker lock;
-    aVector = _local_impl->GetObjectNames(theContext);
-  }
-  else {
-    SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetObjectNames((char*)theContext.c_str());
-    aLength = aSeq->length();
-    for (i = 0; i < aLength; i++) aVector.push_back(std::string((std::string)aSeq[i].in()));
-  }
-  return aVector;
-}
-std::vector<std::string> SALOMEDS_Study::GetDirectoryNames(const std::string& theContext)
-{
-  std::vector<std::string> aVector;
-  int aLength, i;
-  if (_isLocal) {
-    SALOMEDS::Locker lock;
-    aVector = _local_impl->GetDirectoryNames(theContext);
-  }
-  else {
-    SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetDirectoryNames((char*)theContext.c_str());
-    aLength = aSeq->length();
-    for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in());
-  }
-  return aVector;
-}
-std::vector<std::string> SALOMEDS_Study::GetFileNames(const std::string& theContext)
-{
-  std::vector<std::string> aVector;
-  int aLength, i;
-  if (_isLocal) {
-    SALOMEDS::Locker lock;
-    aVector = _local_impl->GetFileNames(theContext);
-  }
-  else {
-    SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetFileNames((char*)theContext.c_str());
-    aLength = aSeq->length();
-
-    for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in());
-  }
-  return aVector;
-}
-std::vector<std::string> SALOMEDS_Study::GetComponentNames(const std::string& theContext)
-{
-  std::vector<std::string> aVector;
-  int aLength, i;
-  if (_isLocal) {
-    SALOMEDS::Locker lock;
-    aVector = _local_impl->GetComponentNames(theContext);
-  }
-  else {
-    SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetComponentNames((char*)theContext.c_str());
-    aLength = aSeq->length();
-    for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in());
-  }
-  return aVector;
-}
-
 _PTR(ChildIterator) SALOMEDS_Study::NewChildIterator(const _PTR(SObject)& theSO)
 {
   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
index 8d84ab6c299b3d30d1d9b438e962d0caaefc590e..d7231e139ebe4fdb0bc4d6e72bfc61c85448d5ea 100644 (file)
@@ -57,10 +57,8 @@ public:
 
   virtual bool Open(const std::string& theStudyUrl);
 
-  virtual bool Save(bool theMultiFile);
-  virtual bool SaveASCII(bool theMultiFile);
-  virtual bool SaveAs(const std::string& theUrl, bool theMultiFile);
-  virtual bool SaveAsASCII(const std::string& theUrl, bool theMultiFile);
+  virtual bool Save(bool theMultiFile, bool theASCII);
+  virtual bool SaveAs(const std::string& theUrl, bool theMultiFile, bool theASCII);
 
   virtual bool CanCopy(const _PTR(SObject)& theSO);
   virtual bool Copy(const _PTR(SObject)& theSO);
@@ -79,12 +77,6 @@ public:
   virtual _PTR(SObject) FindObjectIOR(const std::string& anObjectIOR);
   virtual _PTR(SObject) FindObjectByPath(const std::string& thePath);
   virtual std::string GetObjectPath(const _PTR(SObject)& theSO);
-  virtual void SetContext(const std::string& thePath);
-  virtual std::string GetContext();  
-  virtual std::vector<std::string> GetObjectNames(const std::string& theContext);
-  virtual std::vector<std::string> GetDirectoryNames(const std::string& theContext);
-  virtual std::vector<std::string> GetFileNames(const std::string& theContext);
-  virtual std::vector<std::string> GetComponentNames(const std::string& theContext);
   virtual _PTR(ChildIterator) NewChildIterator(const _PTR(SObject)& theSO);
   virtual _PTR(SComponentIterator) NewComponentIterator();
   virtual _PTR(StudyBuilder) NewBuilder();
index c43220b29d648df023f2095504d952ef743dc09c..d76bc47fb5e3229d72556959060b7baac40b933f 100644 (file)
@@ -170,23 +170,6 @@ _PTR(SObject) SALOMEDS_StudyBuilder::NewObjectToTag(const _PTR(SObject)& theFath
   return _PTR(SObject)(aSO);
 }
 
-void SALOMEDS_StudyBuilder::AddDirectory(const std::string& thePath)
-{
-  if (_isLocal) {
-    CheckLocked();
-    SALOMEDS::Locker lock;
-
-    _local_impl->AddDirectory((char*)thePath.c_str());
-    if (_local_impl->IsError()) {
-      std::string anErrorCode = _local_impl->GetErrorCode();
-      if (anErrorCode == "StudyNameAlreadyUsed")  throw SALOMEDS::Study::StudyNameAlreadyUsed(); 
-      if (anErrorCode == "StudyInvalidDirectory") throw SALOMEDS::Study::StudyInvalidDirectory(); 
-      if (anErrorCode == "StudyInvalidComponent") throw SALOMEDS::Study::StudyInvalidComponent();  
-    }
-  }
-  else _corba_impl->AddDirectory((char*)thePath.c_str());
-}
-
 void SALOMEDS_StudyBuilder::LoadWith(const _PTR(SComponent)& theSCO, const std::string& theIOR)
 {
   if(!theSCO) return;
index b7e3a616078aa80fe7f3c4ef84a0170720a737a7..a57ab0a516cffeb46f60e8c5b6b9a4964279f7fb 100644 (file)
@@ -55,7 +55,6 @@ public:
   virtual void RemoveComponent(const _PTR(SComponent)& theSCO);
   virtual _PTR(SObject) NewObject(const _PTR(SObject)& theFatherObject);
   virtual _PTR(SObject) NewObjectToTag(const _PTR(SObject)& theFatherObject, int theTag);
-  virtual void AddDirectory(const std::string& thePath);
   virtual void LoadWith(const _PTR(SComponent)& theSCO, const std::string& theIOR);
   virtual void Load(const _PTR(SObject)& theSCO);
   virtual void RemoveObject(const _PTR(SObject)& theSO);
index a31fda64c6d16eebd6a2ce09bac1eec4228a136b..9ba49a3264f4d9b015a836287f7dbbc6e50758ac 100644 (file)
@@ -320,26 +320,6 @@ void SALOMEDS_StudyBuilder_i::RemoveReference(SALOMEDS::SObject_ptr me)
   _impl->RemoveReference(aSO);
 }
 
-
-//============================================================================
-/*! Function : AddDirectory
- *  Purpose  : adds a new directory with a path = thePath
- */
-//============================================================================
-void SALOMEDS_StudyBuilder_i::AddDirectory(const char* thePath) 
-{
-  SALOMEDS::Locker lock;
-  CheckLocked();
-  if(thePath == NULL || strlen(thePath) == 0) throw SALOMEDS::Study::StudyInvalidDirectory();
-  if(!_impl->AddDirectory(std::string(thePath))) {
-    std::string anErrorCode = _impl->GetErrorCode();
-    if(anErrorCode == "StudyNameAlreadyUsed") throw SALOMEDS::Study::StudyNameAlreadyUsed(); 
-    if(anErrorCode == "StudyInvalidDirectory") throw SALOMEDS::Study::StudyInvalidDirectory(); 
-    if(anErrorCode == "StudyInvalidComponent") throw SALOMEDS::Study::StudyInvalidComponent();  
-  }
-}
-
-
 //============================================================================
 /*! Function : SetGUID
  *  Purpose  : 
index d4c30fb74bf155ada22b44a6f972487692e503e8..07778737b498e230e72c9719d97405aeec542992 100644 (file)
@@ -88,11 +88,6 @@ public:
   */
   virtual SALOMEDS::SObject_ptr NewObjectToTag(SALOMEDS::SObject_ptr theFatherObject, CORBA::Long atag);
 
-  /*!
-    The methods adds a new subdirectory, the path can be absolute or relative (then the current context is used)
-  */
-  virtual void AddDirectory(const char* thePath);
-
   virtual void LoadWith(SALOMEDS::SComponent_ptr sco, SALOMEDS::Driver_ptr Engine)
     throw(SALOME::SALOME_Exception);
   virtual void Load(SALOMEDS::SObject_ptr sco);
index ad532e303dd0fbf3460fa2985df2a5e3ebdf4acf..cdd6dd3b90292e85557c34f129ce9bdc37b4871f 100644 (file)
@@ -404,20 +404,12 @@ bool SALOMEDS_Study_i::Open(const char* aUrl)
  *  Purpose  : Save a Study to it's persistent reference
  */
 //============================================================================
-CORBA::Boolean SALOMEDS_Study_i::Save(CORBA::Boolean theMultiFile)
+CORBA::Boolean SALOMEDS_Study_i::Save(CORBA::Boolean theMultiFile, CORBA::Boolean theASCII)
 {
   SALOMEDS::Locker lock;
   if (_closed)
     throw SALOMEDS::Study::StudyInvalidReference();
-  return _impl->Save(_factory, theMultiFile);
-}
-
-CORBA::Boolean SALOMEDS_Study_i::SaveASCII(CORBA::Boolean theMultiFile)
-{
-  SALOMEDS::Locker lock;
-  if (_closed)
-    throw SALOMEDS::Study::StudyInvalidReference();
-  return _impl->SaveASCII(_factory, theMultiFile);
+  return _impl->Save(_factory, theMultiFile, theASCII);
 }
 
 //=============================================================================
@@ -425,20 +417,12 @@ CORBA::Boolean SALOMEDS_Study_i::SaveASCII(CORBA::Boolean theMultiFile)
  *  Purpose  : Save a study to the persistent reference aUrl
  */
 //============================================================================
-CORBA::Boolean SALOMEDS_Study_i::SaveAs(const char* aUrl, CORBA::Boolean theMultiFile)
-{
-  SALOMEDS::Locker lock;
-  if (_closed)
-    throw SALOMEDS::Study::StudyInvalidReference();
-  return _impl->SaveAs(std::string(aUrl), _factory, theMultiFile);
-}
-
-CORBA::Boolean SALOMEDS_Study_i::SaveAsASCII(const char* aUrl, CORBA::Boolean theMultiFile)
+CORBA::Boolean SALOMEDS_Study_i::SaveAs(const char* aUrl, CORBA::Boolean theMultiFile, CORBA::Boolean theASCII)
 {
   SALOMEDS::Locker lock;
   if (_closed)
     throw SALOMEDS::Study::StudyInvalidReference();
-  return _impl->SaveAsASCII(std::string(aUrl), _factory, theMultiFile);
+  return _impl->SaveAs(std::string(aUrl), _factory, theMultiFile, theASCII);
 }
 
 //============================================================================
@@ -802,157 +786,6 @@ char* SALOMEDS_Study_i::GetObjectPath(CORBA::Object_ptr theObject)
   return CORBA::string_dup(aPath.c_str());
 }
 
-
-//============================================================================
-/*! Function : SetContext
- *  Purpose  : Sets the current context
- */
-//============================================================================
-void SALOMEDS_Study_i::SetContext(const char* thePath) 
-{
-  SALOMEDS::Locker lock; 
-
-  if (_closed)
-    throw SALOMEDS::Study::StudyInvalidReference();  
-
-  _impl->SetContext(std::string((char*)thePath));
-  if (_impl->IsError() && _impl->GetErrorCode() == "InvalidContext") 
-    throw SALOMEDS::Study::StudyInvalidContext();  
-}
-
-//============================================================================
-/*! Function : GetContext
- *  Purpose  : Gets the current context
- */
-//============================================================================
-char* SALOMEDS_Study_i::GetContext() 
-{
-  SALOMEDS::Locker lock; 
-  
-  if (_closed)
-    throw SALOMEDS::Study::StudyInvalidReference();  
-
-  if (!_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext();
-
-  return CORBA::string_dup(_impl->GetContext().c_str());
-}
-
-//============================================================================
-/*! Function : GetObjectNames
- *  Purpose  : method to get all object names in the given context (or in the current context, if 'theContext' is empty)
- */
-//============================================================================
-SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetObjectNames(const char* theContext) 
-{
-  SALOMEDS::Locker lock; 
-
-  if (_closed)
-    throw SALOMEDS::Study::StudyInvalidReference();  
-
-  SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
-
-  if (strlen(theContext) == 0 && !_impl->HasCurrentContext())
-    throw SALOMEDS::Study::StudyInvalidContext();
-  
-  std::vector<std::string> aSeq = _impl->GetObjectNames(std::string((char*)theContext));
-  if (_impl->GetErrorCode() == "InvalidContext")
-    throw SALOMEDS::Study::StudyInvalidContext();
-
-  int aLength = aSeq.size();
-  aResult->length(aLength);
-  for (int anIndex = 0; anIndex < aLength; anIndex++) {
-    aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str());
-  }
-
-  return aResult._retn();
-}
-
-//============================================================================
-/*! Function : GetDirectoryNames
- *  Purpose  : method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
- */
-//============================================================================
-SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetDirectoryNames(const char* theContext) 
-{
-  SALOMEDS::Locker lock; 
-
-  if (_closed)
-    throw SALOMEDS::Study::StudyInvalidReference();  
-
-  SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
-
-  if (strlen(theContext) == 0 && !_impl->HasCurrentContext())
-    throw SALOMEDS::Study::StudyInvalidContext();
-  
-  std::vector<std::string> aSeq = _impl->GetDirectoryNames(std::string((char*)theContext));
-  if (_impl->GetErrorCode() == "InvalidContext")
-    throw SALOMEDS::Study::StudyInvalidContext();
-
-  int aLength = aSeq.size();
-  aResult->length(aLength);
-  for (int anIndex = 0; anIndex < aLength; anIndex++) {
-    aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str());
-  }
-  
-  return aResult._retn();
-}
-
-//============================================================================
-/*! Function : GetFileNames
- *  Purpose  : method to get all file names in the given context (or in the current context, if 'theContext' is empty)
- */
-//============================================================================
-SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetFileNames(const char* theContext) 
-{
-  SALOMEDS::Locker lock; 
-
-  if (_closed)
-    throw SALOMEDS::Study::StudyInvalidReference();  
-
-  SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
-
-  if (strlen(theContext) == 0 && !_impl->HasCurrentContext())
-    throw SALOMEDS::Study::StudyInvalidContext();
-  
-  std::vector<std::string> aSeq = _impl->GetFileNames(std::string((char*)theContext));
-  if (_impl->GetErrorCode() == "InvalidContext")
-    throw SALOMEDS::Study::StudyInvalidContext();
-
-  int aLength = aSeq.size();
-  aResult->length(aLength);
-  for (int anIndex = 0; anIndex < aLength; anIndex++) {
-    aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str());
-  }
-
-  return aResult._retn();
-}
-
-//============================================================================
-/*! Function : GetComponentNames
- *  Purpose  : method to get all components names
- *  SRN:       Note, theContext can be any, it doesn't matter
- */
-//============================================================================
-SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetComponentNames(const char* theContext) 
-{
-  SALOMEDS::Locker lock; 
-
-  if (_closed)
-    throw SALOMEDS::Study::StudyInvalidReference();  
-
-  SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
-
-  std::vector<std::string> aSeq = _impl->GetComponentNames(std::string((char*)theContext));
-
-  int aLength = aSeq.size();
-  aResult->length(aLength);
-  for(int anIndex = 0; anIndex < aLength; anIndex++) {
-    aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str());
-  }
-
-  return aResult._retn();
-}
-
 //============================================================================
 /*! Function : NewChildIterator
  *  Purpose  : Create a ChildIterator from an SObject
index cfe22e2653e61cde30ccd61d892a748bea5b99a0..18a8f0d666e0db5ca07de55b7f04946fa4bad125 100644 (file)
@@ -79,15 +79,13 @@ public:
   virtual bool Open(const char* aStudyUrl) throw (SALOME::SALOME_Exception);
 
   //! method to save a Study
-  virtual CORBA::Boolean Save(CORBA::Boolean theMultiFile);
-  virtual CORBA::Boolean SaveASCII(CORBA::Boolean theMultiFile);
+  virtual CORBA::Boolean Save(CORBA::Boolean theMultiFile, CORBA::Boolean theASCII);
 
   //! method to save a Study to the persistent reference aUrl
   /*!
     \param char* arguments, the new URL of the study
   */
-  virtual CORBA::Boolean SaveAs(const char* aUrl, CORBA::Boolean theMultiFile);
-  virtual CORBA::Boolean SaveAsASCII(const char* aUrl, CORBA::Boolean theMultiFile);
+  virtual CORBA::Boolean SaveAs(const char* aUrl, CORBA::Boolean theMultiFile, CORBA::Boolean theASCII);
 
   //! method to copy the object
   /*!
@@ -188,36 +186,6 @@ public:
   */
   virtual char* GetObjectPath(CORBA::Object_ptr theObject);
 
-  //! method to set a context: root ('/') is UserData component
-  /*!
-  */
-  virtual void SetContext(const char* thePath);
-
-  //! method to get a context
-  /*!
-  */
-  virtual char* GetContext();  
-
-  //! method to get all object names in the given context (or in the current context, if 'theContext' is empty)
-  /*!
-  */
-  virtual SALOMEDS::ListOfStrings* GetObjectNames(const char* theContext);
-
-  //! method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
-  /*!
-  */
-  virtual SALOMEDS::ListOfStrings* GetDirectoryNames(const char* theContext);
-
-  //! method to get all file names in the given context (or in the current context, if 'theContext' is empty)
-  /*!
-  */
-  virtual SALOMEDS::ListOfStrings* GetFileNames(const char* theContext);
-
-  //! method to get all components names
-  /*!
-  */
-  virtual SALOMEDS::ListOfStrings* GetComponentNames(const char* theContext);
-
   //! method to Create a ChildIterator from an SObject 
   /*!
     \param aSO  SObject_ptr arguments
index 4089fcc4737f38657c20623841f2865cac80a089..dbf65e2e601696e1fa1ce27e4a0df2622041ab03 100755 (executable)
@@ -87,10 +87,6 @@ void SALOMEDSTest::testStudy()
   //Try to find component with empty type
   CPPUNIT_ASSERT(!study->FindComponent(""));
 
-  //Check method GetComponentNames
-  std::vector<std::string> components = study->GetComponentNames(""); //The context doesn't matter
-  CPPUNIT_ASSERT(components.size() == 1 && components[0] == "sco1");
-
   //Check method FindComponentID
   _PTR(SComponent) sco3 = study->FindComponentID(sco1->GetID());
   CPPUNIT_ASSERT(sco3 && sco3->GetID() == sco1->GetID());
@@ -157,10 +153,6 @@ void SALOMEDSTest::testStudy()
   path = study->GetObjectPath(emptySO);
   CPPUNIT_ASSERT(path.empty());
 
-  //Check method SetContext
-  study->SetContext("/sco1"); 
-  CPPUNIT_ASSERT(study->GetContext() == "/sco1");
-
   //Check method FindObjectByPath
   _PTR(SObject) so6 = study->FindObjectByPath("so1");
   CPPUNIT_ASSERT(so6 && so6->GetID() == so1->GetID());
@@ -170,34 +162,6 @@ void SALOMEDSTest::testStudy()
   _PTR(SObject) tmp = study->FindObjectByPath(""); //Must return the Context SObject
   CPPUNIT_ASSERT(tmp && tmp->GetID() == sco1->GetID());
 
-  study->SetContext("/"); //Root
-
-  //Check method GetObjectNames
-  std::vector<std::string> vs = study->GetObjectNames("/sco1");  
-  CPPUNIT_ASSERT(vs.size() == 2);
-    
-  //Check method GetDirectoryNames
-  _PTR(AttributeLocalID) locid_attr_sco1 = studyBuilder->FindOrCreateAttribute(sco1, "AttributeLocalID");
-  CPPUNIT_ASSERT(locid_attr_sco1);
-  locid_attr_sco1->SetValue(16661); //DIRECTORYID
-  _PTR(AttributeLocalID) locid_attr_so1 = studyBuilder->FindOrCreateAttribute(so1, "AttributeLocalID");
-  CPPUNIT_ASSERT(locid_attr_so1);
-  locid_attr_so1->SetValue(16661); //DIRECTORYID
-  vs = study->GetDirectoryNames(""); //Empty context (the current is taken)
-  CPPUNIT_ASSERT(vs.size() == 2);
-
-  //Check method GetFileNames
-  locid_attr_sco1->SetValue(26662); //FILELOCALID
-  _PTR(AttributePersistentRef) persref_attr_sco1 = studyBuilder->FindOrCreateAttribute(sco1, "AttributePersistentRef");
-  CPPUNIT_ASSERT(persref_attr_sco1);
-  persref_attr_sco1->SetValue("FILE: filename1");
-  locid_attr_so1->SetValue(26662); //FILELOCALID
-  _PTR(AttributePersistentRef) persref_attr_so1 = studyBuilder->FindOrCreateAttribute(so1, "AttributePersistentRef");
-  CPPUNIT_ASSERT(persref_attr_so1);
-  persref_attr_so1->SetValue("FILE: filename2");
-  vs = study->GetFileNames("");
-  CPPUNIT_ASSERT(vs.size() == 2 && vs[0] == "filename1" && vs[1] == "filename2");
-
   //Check method FindDependances
   studyBuilder->Addreference(so2, so1);
   studyBuilder->Addreference(sco1, so1);
@@ -237,7 +201,7 @@ void SALOMEDSTest::testStudy()
   CPPUNIT_ASSERT(date == "08/09/0010 07:06");
 
   //Check method GetModificationsDate
-  vs = study->GetModificationsDate();
+  std::vector<std::string> vs = study->GetModificationsDate();
   CPPUNIT_ASSERT(vs.size() == 2 && vs[0] == "03/04/0005 02:01" && vs[1] == "08/09/0010 07:06");
 
   //Check method GetCommonParameters
index d1c6e903699d6c089645ee7c1cb7b1719190ed16..84df3faf9f9e6b5fe65581a942c5e95c95a75d60 100755 (executable)
@@ -180,7 +180,7 @@ void SALOMEDSTest::testStudyBuilder()
   ior = _orb->object_to_string(drv);
   sb2->DefineComponentInstance(sco, ior);
 
-  study2->SaveAs("srn_SALOMEDS_UnitTests.hdf", false);
+  study2->SaveAs("srn_SALOMEDS_UnitTests.hdf", false, false);
   study2->Clear();
 
   _PTR(Study) study3(new SALOMEDS_Study(new SALOMEDSImpl_Study()));
@@ -211,37 +211,5 @@ void SALOMEDSTest::testStudyBuilder()
 
   system("rm -f srn_SALOMEDS_UnitTests.hdf");
 
-  //Check method AddDirectory
-  _PTR(AttributeName) na1 = sb3->FindOrCreateAttribute(aComp, "AttributeName");
-  na1->SetValue("Component");
-
-  isRaised = false;
-  try {
-    sb3->AddDirectory("/Component/Dir1");
-  } catch(...) {
-    isRaised = true;
-  }
-
-
-  CPPUNIT_ASSERT(!isRaised);
-  _PTR(SObject) so5 = study3->FindObjectByPath("/Component/Dir1");
-  CPPUNIT_ASSERT(so5);
-
-  isRaised = false;
-  try {
-    sb3->AddDirectory("/Component/Dir1"); //Attempt to create the same directory
-  } catch(...) {
-    isRaised = true;
-  }
-  CPPUNIT_ASSERT(isRaised);
-
-  isRaised = false;
-  try {
-    sb3->AddDirectory("/MyComponent/Dir1"); //Attempt to create the invalid directory
-  } catch(...) {
-    isRaised = true;
-  }
-  CPPUNIT_ASSERT(isRaised);
-
   study3->Clear();
 }
index 46b5988659af6653536c2182f41de8bfcbeb250e..d4ae8e61059075107c8e7e052465257b02c28fdf 100644 (file)
@@ -66,12 +66,6 @@ public:
   virtual _PTR(SObject) FindObjectIOR(const std::string& anObjectIOR) = 0;
   virtual _PTR(SObject) FindObjectByPath(const std::string& thePath) = 0;
   virtual std::string GetObjectPath(const _PTR(SObject)& theSO) = 0;
-  virtual void SetContext(const std::string& thePath) = 0;
-  virtual std::string GetContext() = 0;  
-  virtual std::vector<std::string> GetObjectNames(const std::string& theContext) = 0;
-  virtual std::vector<std::string> GetDirectoryNames(const std::string& theContext) = 0;
-  virtual std::vector<std::string> GetFileNames(const std::string& theContext) = 0;
-  virtual std::vector<std::string> GetComponentNames(const std::string& theContext) = 0;
   virtual _PTR(ChildIterator) NewChildIterator(const _PTR(SObject)& theSO) = 0;
   virtual _PTR(SComponentIterator) NewComponentIterator() = 0;
   virtual _PTR(StudyBuilder) NewBuilder() = 0;
@@ -88,10 +82,8 @@ public:
   virtual std::vector<std::string> GetModificationsDate() = 0;
   virtual _PTR(UseCaseBuilder) GetUseCaseBuilder() = 0;
 
-  virtual bool Save(bool theMultiFile) = 0;
-  virtual bool SaveASCII(bool theMultiFile) = 0;
-  virtual bool SaveAs(const std::string& theUrl, bool theMultiFile) = 0;
-  virtual bool SaveAsASCII(const std::string& theUrl, bool theMultiFile) = 0;
+  virtual bool Save(bool theMultiFile, bool theASCII) = 0;
+  virtual bool SaveAs(const std::string& theUrl, bool theMultiFile, bool theASCII) = 0;
 
   virtual bool CanCopy(const _PTR(SObject)& theSO) = 0;
   virtual bool Copy(const _PTR(SObject)& theSO) = 0;
index 968a8e397de30f605b9ab172b6c182dba4354426..9889d2d0ea9f651275c4ed17ae8ba5b8cabc71f9 100644 (file)
@@ -43,7 +43,6 @@ public:
   virtual void RemoveComponent(const _PTR(SComponent)& theSCO) = 0;
   virtual _PTR(SObject) NewObject(const _PTR(SObject)& theFatherObject) = 0;
   virtual _PTR(SObject) NewObjectToTag(const _PTR(SObject)& theFatherObject, int theTag) = 0;
-  virtual void AddDirectory(const std::string& thePath) = 0;
   virtual void LoadWith(const _PTR(SComponent)& theSCO, const std::string& theIOR) = 0;
   virtual void Load(const _PTR(SObject)& theSCO) = 0;
   virtual void RemoveObject(const _PTR(SObject)& theSO) = 0;
index d10e3383e61677bf4024e62e606af14e8be60a16..1f3fefc89b4fda04bc34278f762d48df66fd671f 100644 (file)
@@ -296,7 +296,8 @@ bool SALOMEDSImpl_Study::Open(const std::string& aUrl)
  */
 //============================================================================
 bool SALOMEDSImpl_Study::Save(SALOMEDSImpl_DriverFactory* aFactory,
-                              bool theMultiFile)
+                              bool theMultiFile,
+                              bool theASCII)
 {
   _errorCode = "";
 
@@ -306,24 +307,7 @@ bool SALOMEDSImpl_Study::Save(SALOMEDSImpl_DriverFactory* aFactory,
     return false;
   }
   else {
-    return Impl_SaveAs(url, aFactory, theMultiFile, false);
-  }
-
-  return false;
-}
-
-bool SALOMEDSImpl_Study::SaveASCII(SALOMEDSImpl_DriverFactory* aFactory,
-                                   bool theMultiFile)
-{
-  _errorCode = "";
-
-  std::string url = URL();
-  if (url.empty()) {
-    _errorCode = "No path specified to save the study. Nothing done";
-    return false;
-  }
-  else {
-    return Impl_SaveAs(url, aFactory, theMultiFile, true);
+    return Impl_SaveAs(url, aFactory, theMultiFile, theASCII);
   }
 
   return false;
@@ -336,18 +320,11 @@ bool SALOMEDSImpl_Study::SaveASCII(SALOMEDSImpl_DriverFactory* aFactory,
 //============================================================================
 bool SALOMEDSImpl_Study::SaveAs(const std::string& aUrl,
                                 SALOMEDSImpl_DriverFactory* aFactory,
-                                bool theMultiFile)
+                                bool theMultiFile,
+                                bool theASCII)
 {
   _errorCode = "";
-  return Impl_SaveAs(aUrl, aFactory, theMultiFile, false);
-}
-
-bool SALOMEDSImpl_Study::SaveAsASCII(const std::string& aUrl,
-                                     SALOMEDSImpl_DriverFactory* aFactory,
-                                     bool theMultiFile)
-{
-  _errorCode = "";
-  return Impl_SaveAs(aUrl, aFactory, theMultiFile, true);
+  return Impl_SaveAs(aUrl, aFactory, theMultiFile, theASCII);
 }
 
 //=============================================================================
@@ -1493,7 +1470,7 @@ SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObjectByPath(const std::string& the
   bool isRelative = false;
 
   if(aLength == 0) {  //Empty path - return the current context
-    return GetSObject(_current);
+    return aSO;
   }
 
   if(aPath[0] != '/')  //Relative path
@@ -1504,8 +1481,7 @@ SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObjectByPath(const std::string& the
   SALOMEDSImpl_AttributeName* anAttr;
 
   if(isRelative) {
-    if(_current.IsNull()) return aSO;
-    anIterator.Init(_current, false);
+    return aSO;
   }
   else {
     if(aPath.size() == 1 && aPath[0] == '/') {    //Root
@@ -1594,212 +1570,6 @@ std::string SALOMEDSImpl_Study::GetObjectPathByIOR(const std::string& theIOR)
   return GetObjectPath(so);
 }
 
-
-//============================================================================
-/*! Function : SetContext
- *  Purpose  : Sets the current context
- */
-//============================================================================
-bool SALOMEDSImpl_Study::SetContext(const std::string& thePath)
-{
-  _errorCode = "";
-  if(thePath.empty()) {
-    _errorCode = "InvalidPath";
-    return false;
-  }
-
-  std::string aPath(thePath), aContext("");
-  bool isInvalid = false;
-  SALOMEDSImpl_SObject aSO;
-
-  if(aPath[0] != '/') { //Relative path
-    aContext = GetContext();
-    aContext += '/';
-    aContext += aPath;
-  }
-  else
-    aContext = aPath;
-
-  try {
-    aSO = FindObjectByPath(aContext);
-  }
-  catch( ... ) {
-    isInvalid = true;
-  }
-
-  if(isInvalid || !aSO) {
-    _errorCode = "InvalidContext";
-    return false;
-  }
-
-  DF_Label aLabel = aSO.GetLabel();
-  if(aLabel.IsNull()) {
-    _errorCode = "InvalidContext";
-    return false;
-  }
-  else
-    _current = aLabel;  //Set the current context
-
-  return true;
-}
-
-//============================================================================
-/*! Function : GetContext
- *  Purpose  : Gets the current context
- */
-//============================================================================
-std::string SALOMEDSImpl_Study::GetContext()
-{
-  _errorCode = "";
-
-  if(_current.IsNull()) {
-    _errorCode = "InvaidContext";
-    return "";
-  }
-  SALOMEDSImpl_SObject so = GetSObject(_current);
-  return GetObjectPath(so);
-}
-
-//============================================================================
-/*! Function : GetObjectNames
- *  Purpose  : method to get all object names in the given context (or in the current context, if 'theContext' is empty)
- */
-//============================================================================
-std::vector<std::string> SALOMEDSImpl_Study::GetObjectNames(const std::string& theContext)
-{
-  _errorCode = "";
-
-  std::vector<std::string> aResultSeq;
-  DF_Label aLabel;
-  if (theContext.empty()) {
-    aLabel = _current;
-  } else {
-    DF_Label aTmp = _current;
-    SetContext(theContext);
-    aLabel = _current;
-    _current = aTmp;
-  }
-  if (aLabel.IsNull()) {
-    _errorCode = "InvalidContext";
-    return aResultSeq;
-  }
-
-  DF_ChildIterator anIter (aLabel, true); // iterate all subchildren at all sublevels
-  for (; anIter.More(); anIter.Next()) {
-    DF_Label aLabel = anIter.Value();
-    SALOMEDSImpl_AttributeName* aName;
-    if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID())))
-      aResultSeq.push_back(aName->Value());
-  }
-
-  return aResultSeq;
-}
-
-//============================================================================
-/*! Function : GetDirectoryNames
- *  Purpose  : method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
- */
-//============================================================================
-std::vector<std::string> SALOMEDSImpl_Study::GetDirectoryNames(const std::string& theContext)
-{
-  _errorCode = "";
-
-  std::vector<std::string> aResultSeq;
-  DF_Label aLabel;
-  if (theContext.empty()) {
-    aLabel = _current;
-  } else {
-    DF_Label aTmp = _current;
-    SetContext(theContext);
-    aLabel = _current;
-    _current = aTmp;
-  }
-  if (aLabel.IsNull()) {
-    _errorCode = "InvalidContext";
-    return aResultSeq;
-  }
-
-  DF_ChildIterator anIter (aLabel, true); // iterate first-level children at all sublevels
-  for (; anIter.More(); anIter.Next()) {
-    DF_Label aLabel = anIter.Value();
-    SALOMEDSImpl_AttributeLocalID* anID;
-    if ((anID=(SALOMEDSImpl_AttributeLocalID*)aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) {
-      if (anID->Value() == DIRECTORYID) {
-        SALOMEDSImpl_AttributeName* aName;
-        if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
-          aResultSeq.push_back(aName->Value());
-        }
-      }
-    }
-  }
-
-  return aResultSeq;
-}
-
-//============================================================================
-/*! Function : GetFileNames
- *  Purpose  : method to get all file names in the given context (or in the current context, if 'theContext' is empty)
- */
-//============================================================================
-std::vector<std::string> SALOMEDSImpl_Study::GetFileNames(const std::string& theContext)
-{
-  _errorCode = "";
-
-  std::vector<std::string> aResultSeq;
-  DF_Label aLabel;
-  if (theContext.empty()) {
-    aLabel = _current;
-  } else {
-    DF_Label aTmp = _current;
-    SetContext(theContext);
-    aLabel = _current;
-    _current = aTmp;
-  }
-  if (aLabel.IsNull()) {
-    _errorCode = "InvalidContext";
-    return aResultSeq;
-  }
-
-  DF_ChildIterator anIter (aLabel, true); // iterate all subchildren at all sublevels
-  for (; anIter.More(); anIter.Next()) {
-    DF_Label aLabel = anIter.Value();
-    SALOMEDSImpl_AttributeLocalID* anID;
-    if ((anID=(SALOMEDSImpl_AttributeLocalID*)aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) {
-      if (anID->Value() == FILELOCALID) {
-        SALOMEDSImpl_AttributePersistentRef* aName;
-        if ((aName=(SALOMEDSImpl_AttributePersistentRef*)aLabel.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) {
-          std::string aFileName = aName->Value();
-          if (aFileName.size() > 0)
-            aResultSeq.push_back(aFileName.substr(strlen(FILEID), aFileName.size()));
-        }
-      }
-    }
-  }
-
-  return aResultSeq;
-}
-
-//============================================================================
-/*! Function : GetComponentNames
- *  Purpose  : method to get all components names
- */
-//============================================================================
-std::vector<std::string> SALOMEDSImpl_Study::GetComponentNames(const std::string& theContext)
-{
-  _errorCode = "";
-
-  std::vector<std::string> aResultSeq;
-  DF_ChildIterator anIter(_doc->Main(), false); // iterate all subchildren at first level
-  for(; anIter.More(); anIter.Next()) {
-    DF_Label aLabel = anIter.Value();
-    SALOMEDSImpl_AttributeName* aName;
-    if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID())))
-      aResultSeq.push_back(aName->Value());
-  }
-
-  return aResultSeq;
-}
-
 //============================================================================
 /*! Function : NewChildIterator
  *  Purpose  : Create a ChildIterator from an SObject
index 297a3c738259799ca246070d58fd56ea54e7c7b6..81504d3019017753863b63e8ca34b40cc1a3112e 100644 (file)
@@ -64,7 +64,6 @@ private:
   DF_Document*             _clipboard;
   bool                     _Saved; // True if the Study is saved
   std::string              _URL; //URL of the persistent reference of the study
-  DF_Label                 _current;
   bool                     _autoFill; 
   std::string              _errorCode;
   std::vector<std::string> _lockers;
@@ -111,18 +110,15 @@ public:
   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);
+  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);
-
-  virtual bool SaveAsASCII(const std::string& aUrl,
-                           SALOMEDSImpl_DriverFactory* aFactory,
-                           bool theMultiFile);
+                      bool theMultiFile,
+                      bool theASCII);
 
   bool CopyLabel(SALOMEDSImpl_Driver* theEngine,
                  const int theSourceStartDepth,
@@ -193,24 +189,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);
 
@@ -265,8 +243,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,
index 3a685369382c01359d753b9e7d8a3e72c84f6278..0da25ddc7c79c136e559b4197c833bda5150d930 100644 (file)
@@ -620,78 +620,6 @@ bool SALOMEDSImpl_StudyBuilder::RemoveReference(const SALOMEDSImpl_SObject& me)
   return true;
 }
 
-
-
-//============================================================================
-/*! Function : AddDirectory
- *  Purpose  : adds a new directory with a path = thePath
- */
-//============================================================================
-bool SALOMEDSImpl_StudyBuilder::AddDirectory(const std::string& thePath) 
-{
-  _errorCode = "";
-  CheckLocked();
-  if(thePath.empty()) {
-    _errorCode = "Invalid path";
-    return false;
-  }
-
-  std::string aPath(thePath), aContext(""), aFatherPath;
-  DF_Label aLabel;
-  SALOMEDSImpl_SObject anObject;
-
-  try { 
-    anObject = _study->FindObjectByPath(thePath); //Check if the directory already exists
-  }
-  catch(...) { }
-
-  if(anObject) {
-    _errorCode = "StudyNameAlreadyUsed";
-    return false; 
-  }
-
-  if(aPath[0] != '/') { //Relative path 
-    aPath.insert(aPath.begin(), '/');
-    aPath = _study->GetContext() + aPath;
-  }
-
-  std::vector<std::string> vs = SALOMEDSImpl_Tool::splitString(aPath, '/');
-  if(vs.size() == 1) 
-    aFatherPath = "/";
-  else {
-    for(int i = 0, len = vs.size()-1; i<len; i++) { 
-      aFatherPath += "/";
-      aFatherPath += vs[i];
-    }
-  }
-
-  try { 
-    anObject = _study->FindObjectByPath(aFatherPath); //Check if the father directory exists
-  }
-  catch(...) { ; }
-  if(!anObject) {
-    _errorCode = "StudyInvalidDirectory";
-    return false; 
-  }
-
-  SALOMEDSImpl_SObject aNewObject = NewObject(anObject);
-  aLabel = aNewObject.GetLabel();
-  if(aLabel.IsNull()) {
-    _errorCode = "StudyInvalidComponent";
-    return false;
-  }
-
-  SALOMEDSImpl_AttributeName::Set(aLabel, vs.back());
-
-  //Set LocalID attribute to identify the directory object
-  SALOMEDSImpl_AttributeLocalID::Set(aLabel, DIRECTORYID);
-  
-  _doc->SetModified(true); 
-  
-  return true;
-}
-
-
 //============================================================================
 /*! Function : SetGUID
  *  Purpose  : 
index 86623d607a5df2f9e4470696360e2b1d62e2f29f..48209bcf7bc6758e551d1c2c9c3af30e39da8760 100644 (file)
@@ -64,9 +64,6 @@ public:
   virtual SALOMEDSImpl_SObject NewObjectToTag(const SALOMEDSImpl_SObject& theFatherObject, 
     const int theTag);
 
-  //! The methods adds a new subdirectory, the path can be absolute or relative (then the current context is used)
-  virtual bool AddDirectory(const std::string& thePath);
-
   virtual bool LoadWith(const SALOMEDSImpl_SComponent& sco, SALOMEDSImpl_Driver* Engine);
   virtual bool Load(const SALOMEDSImpl_SObject& sco);
 
index 9f9ffd6b74a608020b7b9cf4371d92fe228a0e7d..6c09e96b4aa6f41826505460c5867d72b3284cf1 100644 (file)
@@ -44,7 +44,6 @@
 
 #include <iostream> 
 #include <fstream>
-#include <stdlib.h>
 
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
@@ -132,14 +131,15 @@ std::string SALOMEDS_Tool::GetTmpDir()
 // purpose  : Removes files listed in theFileList
 //============================================================================
 void SALOMEDS_Tool::RemoveTemporaryFiles(const std::string& theDirectory, 
-                                         const std::list<std::string>& theFiles,
+                                         const ListOfFiles& theFiles,
                                          const bool IsDirDeleted)
 {
   std::string aDirName = theDirectory;
 
-  for(std::list<std::string>::const_iterator it = theFiles.begin(); it != theFiles.end(); it++) {
+  int i, aLength = theFiles.size();
+  for(i=1; i<=aLength; i++) {
     std::string aFile(aDirName);
-    aFile += *it;
+    aFile += theFiles[i-1];
     if(!Exists(aFile)) continue;
 
 #ifdef WIN32
@@ -169,11 +169,11 @@ namespace
 {
   SALOMEDS::TMPFile* 
   PutFilesToStream(const std::string& theFromDirectory,
-                   const std::list<std::string>& theFiles,
-                   const std::list<std::string>& theFileNames,
+                   const std::vector<std::string>& theFiles,
+                   const std::vector<std::string>& theFileNames,
                    const int theNamesOnly)
   {
-    int i = 0, aLength = theFiles.size();
+    int i, aLength = theFiles.size();
     if(aLength == 0)
       return (new SALOMEDS::TMPFile);
     
@@ -189,14 +189,12 @@ namespace
     
     //Determine the required size of the buffer
     
-    std::list<std::string>::const_iterator it_files = theFiles.begin();
-    std::list<std::string>::const_iterator it_names = theFileNames.begin();
-    for(; it_files != theFiles.end(); it_files++, it_names++, i++) {
+    for(i=0; i<aLength; i++) {
       
       //Check if the file exists
       
       if (!theNamesOnly) { // mpv 15.01.2003: if only file names must be stroed, then size of files is zero
-        std::string aFullPath = aTmpDir + *it_files;
+        std::string aFullPath = aTmpDir + theFiles[i];
         if(!Exists(aFullPath)) continue;
 #ifdef WIN32
         std::ifstream aFile(aFullPath.c_str(), std::ios::binary);
@@ -207,7 +205,7 @@ namespace
         aFileSize[i] = aFile.tellg();
         aBufferSize += aFileSize[i];              //Add a space to store the file
       }
-      aFileNameSize[i] = (*it_names).length()+1;
+      aFileNameSize[i] = theFileNames[i].length()+1;
       aBufferSize += aFileNameSize[i];          //Add a space to store the file name
       aBufferSize += (theNamesOnly)?4:12;       //Add 4 bytes: a length of the file name,
       //    8 bytes: length of the file itself
@@ -228,12 +226,10 @@ namespace
     
     aCurrentPos = 4;
     
-    it_files = theFiles.begin();
-    it_names = theFileNames.begin();
-    for(; it_files != theFiles.end(); it_files++, it_names++, i++) {
+    for(i=0; i<aLength; i++) {
       std::ifstream *aFile;
       if (!theNamesOnly) { // mpv 15.01.2003: we don't open any file if theNamesOnly = true
-        std::string aFullPath = aTmpDir + *it_files;
+        std::string aFullPath = aTmpDir + theFiles[i];
         if(!Exists(aFullPath)) continue;
 #ifdef WIN32
         aFile = new std::ifstream(aFullPath.c_str(), std::ios::binary);
@@ -248,7 +244,7 @@ namespace
       aCurrentPos += 4;
       
       //Copy the file name to the buffer
-      memcpy((aBuffer + aCurrentPos), (*it_names).c_str(), aFileNameSize[i]);
+      memcpy((aBuffer + aCurrentPos), theFileNames[i].c_str(), aFileNameSize[i]);
       aCurrentPos += aFileNameSize[i];
       
       if (!theNamesOnly) { // mpv 15.01.2003: we don't copy file content to the buffer if !theNamesOnly
@@ -280,17 +276,17 @@ namespace
 
 SALOMEDS::TMPFile* 
 SALOMEDS_Tool::PutFilesToStream(const std::string& theFromDirectory,
-                                const std::list<std::string>& theFiles,
+                                const ListOfFiles& theFiles,
                                 const int theNamesOnly)
 {
-  std::list<std::string> aFileNames(theFiles);
+  ListOfFiles aFileNames(theFiles);
   return ::PutFilesToStream(theFromDirectory,theFiles,aFileNames,theNamesOnly);
 }
 
 
 SALOMEDS::TMPFile* 
-SALOMEDS_Tool::PutFilesToStream(const std::list<std::string>& theFiles,
-                                const std::list<std::string>& theFileNames)
+SALOMEDS_Tool::PutFilesToStream(const ListOfFiles& theFiles,
+                                const ListOfFiles& theFileNames)
 {
   return ::PutFilesToStream("",theFiles,theFileNames,0);
 }
@@ -299,12 +295,12 @@ SALOMEDS_Tool::PutFilesToStream(const std::list<std::string>& theFiles,
 // function : PutStreamToFile
 // purpose  : converts the stream "theStream" to the files
 //============================================================================
-std::list<std::string>
+SALOMEDS_Tool::ListOfFiles
 SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
                                 const std::string& theToDirectory,
                                 const int theNamesOnly)
 {
-  std::list<std::string> aFiles;
+  ListOfFiles aFiles;
 
   if(theStream.length() == 0)
     return aFiles;
@@ -323,6 +319,8 @@ SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
   //Copy the number of files in the stream
   memcpy(&aNbFiles, aBuffer, sizeof(int)); 
 
+  aFiles.reserve(aNbFiles);
+
   for(i=0; i<aNbFiles; i++) {
 
     //Put a length of the file name to aFileNameSize
@@ -516,4 +514,3 @@ void SALOMEDS_Tool::GetAllChildren( SALOMEDS::Study_var               theStudy,
 }
 
 
-
index 51ee325bf6d80548d73439aab2979950f565ea9d..a8ee8b581a8f952bf572cdf7c0cacffcec9347bc 100644 (file)
@@ -31,6 +31,8 @@
 
 #include <string>
 #include <list> 
+#include <vector>
+#include <stdlib.h>
 
 
 // IDL headers
@@ -50,6 +52,8 @@
 class TOOLSDS_EXPORT SALOMEDS_Tool                                
 {
 public:
+
+  typedef std::vector<std::string> ListOfFiles;
  
   // Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
   // otherwise return /tmp/something/ for Unix or c:\something\ for WIN32
@@ -59,20 +63,20 @@ public:
   // Removes files which are in <theDirectory>, the files for deletion are listed in <theFiles>
   // if <IsDirDeleted> is true <theDirectory> is also deleted if it is empty
   static void RemoveTemporaryFiles(const std::string& theDirectory,
-                                   const std::list<std::string>& theFiles,
+                                   const ListOfFiles& theFiles,
                                    const bool IsDirDeleted);
 
   // Converts files listed in <theFiles> which are in <theFromDirectory> into a byte sequence TMPFile
   static SALOMEDS::TMPFile* PutFilesToStream(const std::string& theFromDirectory, 
-                                             const std::list<std::string>& theFiles,
+                                             const ListOfFiles& theFiles,
                                              const int theNamesOnly = 0);
 
   // Converts files listed in <theFiles> which will be named as pointed in the <theFileNames> into a byte sequence TMPFile
-  static SALOMEDS::TMPFile* PutFilesToStream(const std::list<std::string>& theFiles,
-                                             const std::list<std::string>& theFileNames);
+  static SALOMEDS::TMPFile* PutFilesToStream(const ListOfFiles& theFiles,
+                                             const ListOfFiles& theFileNames);
 
   // Converts a byte sequence <theStream> to files and places them in <theToDirectory>
-  static std::list<std::string> PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
+  static ListOfFiles PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
                                                  const std::string& theToDirectory,
                                                  const int theNamesOnly = 0);