X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_NoteBook.cxx;h=2b282b8d4549110011627dbdd993aa010b16e176;hp=943a1b76738ae4c9d42e335936b3a649a0f27322;hb=8d297d6698f361d4f2dde723050bcfbaea050920;hpb=7a65c9fad427b1ccba6b9ccae612296e5092a324 diff --git a/src/SMESH_I/SMESH_NoteBook.cxx b/src/SMESH_I/SMESH_NoteBook.cxx index 943a1b767..2b282b8d4 100644 --- a/src/SMESH_I/SMESH_NoteBook.cxx +++ b/src/SMESH_I/SMESH_NoteBook.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -53,7 +53,7 @@ namespace */ void SetVariable(Handle(_pyCommand) theCommand, const SMESH_ObjectStates* theStates, - int position, int theArgNb) + size_t position, int theArgNb) { if(theStates->GetCurrectState().size() > position) if(!theStates->GetCurrectState().at(position).IsEmpty()) @@ -100,7 +100,7 @@ void SMESH_ObjectStates::AddState(const TState &theState) //================================================================================ TState SMESH_ObjectStates::GetCurrectState() const { - if(_states.size() > _dumpstate) + if ( (int) _states.size() > _dumpstate) return _states[_dumpstate]; TState empty; return empty; @@ -231,12 +231,12 @@ SMESH_NoteBook::~SMESH_NoteBook() /*! * \brief Replace parameters of the functions on the Salome NoteBook Variables * \param theString - Input string - * \retval TCollection_AsciiString - Convertion result + * \retval TCollection_AsciiString - Conversion result */ //================================================================================ void SMESH_NoteBook::ReplaceVariables() { - for(int i=0;i<_commands.size();i++) + for ( size_t i = 0 ; i < _commands.size(); i++ ) { Handle(_pyCommand) aCmd = _commands[i]; TCollection_AsciiString aMethod = aCmd->GetMethod(); @@ -707,14 +707,13 @@ void SMESH_NoteBook::ReplaceVariables() // dumped calls due to the fix of // issue 0021364:: Dump of netgen parameters has duplicate lines SMESH_Gen_i * aGen = SMESH_Gen_i::GetSMESHGen(); - SALOMEDS::Study_var aStudy = aGen->GetCurrentStudy(); - SALOMEDS::SObject_wrap sobj = aStudy->FindObjectID( (*it).first.ToCString() ); + SALOMEDS::SObject_wrap sobj = SMESH_Gen_i::getStudyServant()->FindObjectID( (*it).first.ToCString() ); CORBA::Object_var obj = aGen->SObjectToObject( sobj ); if ( SMESH_Hypothesis_i* h = SMESH::DownCast< SMESH_Hypothesis_i*>( obj )) { TState aCurrentState = aStates->GetCurrectState(); int argIndex = h->getParamIndex( aMethod, aCurrentState.size() ); - if ( 0 <= argIndex && argIndex < aCurrentState.size() && + if ( 0 <= argIndex && argIndex < (int)aCurrentState.size() && !aCurrentState[argIndex].IsEmpty() ) aCmd->SetArg( 1, aCurrentState[argIndex] ); @@ -745,7 +744,7 @@ void SMESH_NoteBook::InitObjectMap() if(!aGen) return; - SALOMEDS::Study_var aStudy = aGen->GetCurrentStudy(); + SALOMEDS::Study_var aStudy = SMESH_Gen_i::getStudyServant(); if(aStudy->_is_nil()) return; @@ -790,10 +789,10 @@ void SMESH_NoteBook::InitObjectMap() else aState = new SMESH_ObjectStates(anObjType); - for(int i = 0; i < aSections->length(); i++) { + for ( size_t i = 0; i < aSections->length(); i++ ) { TState aVars; SALOMEDS::ListOfStrings aListOfVars = aSections[i]; - for ( int j = 0; jIsVariable(aVar.ToCString())) { @@ -859,8 +858,8 @@ void SMESH_NoteBook::ProcessLayerDistribution() return; // 2) Initialize all type of 1D Distribution hypothesis - for(int i=0;i<_commands.size();i++){ - for(int j =0;j < aLDS.size();j++){ + for ( size_t i = 0; i < _commands.size(); i++ ) { + for ( size_t j = 0; j < aLDS.size(); j++ ) { TCollection_AsciiString aResultValue = _commands[i]->GetResultValue(); if(_commands[i]->GetMethod() == "CreateHypothesis" && aLDS[j]->HasDistribution(aResultValue)){ @@ -872,8 +871,8 @@ void SMESH_NoteBook::ProcessLayerDistribution() } // 3) ... and replase variables ... - for(int i=0;i<_commands.size();i++){ - for(int j =0;j < aLDS.size();j++){ + for ( size_t i = 0; i < _commands.size(); i++ ) { + for ( size_t j = 0; j < aLDS.size(); j++ ) { TCollection_AsciiString anObject = _commands[i]->GetObject(); if(aLDS[j]->HasDistribution(anObject)) { @@ -929,8 +928,8 @@ void SMESH_NoteBook::ProcessLayerDistribution() TCollection_AsciiString SMESH_NoteBook::GetResultScript() const { TCollection_AsciiString aResult; - for(int i=0;i<_commands.size();i++) - aResult+=_commands[i]->GetString()+"\n"; + for ( size_t i = 0; i < _commands.size(); i++ ) + aResult += _commands[i]->GetString() + "\n"; return aResult; } @@ -941,7 +940,7 @@ TCollection_AsciiString SMESH_NoteBook::GetResultScript() const //================================================================================ void SMESH_NoteBook::GetResultLines(std::list< TCollection_AsciiString >& lines) const { - for(int i=0;i<_commands.size();i++) + for ( size_t i = 0; i < _commands.size(); i++ ) lines.push_back( _commands[i]->GetString() ); } @@ -954,11 +953,7 @@ bool SMESH_NoteBook::GetReal(const TCollection_AsciiString& theVarName, double& { bool ok = false; - SMESH_Gen_i *aGen = SMESH_Gen_i::GetSMESHGen(); - if(!aGen) - return ok; - - SALOMEDS::Study_ptr aStudy = aGen->GetCurrentStudy(); + SALOMEDS::Study_ptr aStudy = SMESH_Gen_i::getStudyServant(); if(aStudy->_is_nil()) return ok;