Salome HOME
0051789: TC7.2.0: NoteBook cannot update study
authoreap <eap@opencascade.com>
Fri, 29 Mar 2013 13:34:37 +0000 (13:34 +0000)
committereap <eap@opencascade.com>
Fri, 29 Mar 2013 13:34:37 +0000 (13:34 +0000)
Fix for "LayerDistribution" hypothesis

+  const std::string & GetLastObjEntry() const { return myLastObj; }

+  std::string  myLastObj;

src/SMESH_I/SMESH_Gen_i.hxx
src/SMESH_I/SMESH_Gen_i_1.cxx

index 42157d4079b49e73a46eb4350ee18dc4db17c16c..798670f6bf54a72a9c060b7ebcba846f0b117980 100644 (file)
@@ -576,6 +576,7 @@ public:
   //char* ParseParameters(const char* theParameters);
   const std::vector< int >&         GetLastParamIndices() const { return myLastParamIndex; }
   const std::vector< std::string >& GetLastParameters() const { return myLastParameters; }
+  const std::string &               GetLastObjEntry() const { return myLastObj; }
   std::vector< std::string >        GetAllParameters(const std::string& theObjectEntry) const;
 
 private:
@@ -624,6 +625,7 @@ private:
   bool                                                     myIsHistoricalPythonDump;
   std::vector< int >                                       myLastParamIndex;
   std::vector< std::string >                               myLastParameters;
+  std::string                                              myLastObj;
 };
 
 
index 13f283fc0e4add4a325f18c4954c80bd1d405126..4ac7ad8d3e6fe9d878dd5b06091924abf34d47a0 100644 (file)
@@ -952,6 +952,7 @@ void SMESH_Gen_i::UpdateParameters(CORBA::Object_ptr theObject, const char* theP
 
   // find variable names within theParameters
 
+  myLastObj.clear();
   myLastParameters.clear();
   myLastParamIndex.clear(); /* vector holding indices of virables within the string
                                of all varibles used for theObject */ 
@@ -986,9 +987,12 @@ void SMESH_Gen_i::UpdateParameters(CORBA::Object_ptr theObject, const char* theP
   // (1) variable names in the string of all varibles used for theObject and
   // (2) indices of found variables in myLastParamIndex.
 
+  // remember theObject
   SALOMEDS::SObject_wrap aSObj =  ObjectToSObject(aStudy,theObject);
   if ( aSObj->_is_nil() )
     return;
+  CORBA::String_var anObjEntry = aSObj->GetID();
+  myLastObj = anObjEntry.in();
 
   // get a string of variable names
   SALOMEDS::StudyBuilder_var   aStudyBuilder = aStudy->NewBuilder();
@@ -1082,9 +1086,10 @@ std::vector< std::string > SMESH_Gen_i::GetAllParameters(const std::string& theO
   while ( pos < varStr.size() )
   {
     // skip separators
-    while ( separators.find( varStr[ pos ]) != std::string::npos )
-      if ( ++pos >= varStr.size() )
-        break;
+    pos = varStr.find_first_not_of( separators, pos );
+    // while ( separators.find( varStr[ pos ]) != std::string::npos )
+    //   if ( ++pos >= varStr.size() )
+    //     break;
     // skip repetition number following '='
     if ( varStr[ pos-1 ] == '=' )
     {
@@ -1096,7 +1101,7 @@ std::vector< std::string > SMESH_Gen_i::GetAllParameters(const std::string& theO
     if ( pos < varStr.size() )
     {
       size_t pos2 = varStr.find_first_of( separators, pos );
-      varNames.push_back( varStr.substr( pos, pos2-1 ));
+      varNames.push_back( varStr.substr( pos, pos2 - pos));
       pos = pos2;
     }
   }