X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSALOMEDS%2FSALOMEDS_UseCaseIterator_i.cxx;h=cb3babe7672d7a2567f8d13d58f880bdc6b8d180;hb=4b14a3f48efda72f90b88c78c6ae02153631dfd6;hp=69e7d39ecc165e46b3f0b402906f8bd4c90df405;hpb=1f742af859d50d34c63f9dc02f9a705089bf060e;p=modules%2Fkernel.git diff --git a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx index 69e7d39ec..cb3babe76 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx @@ -1,36 +1,46 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // -// Copyright (C) 2003 CEA/DEN, EDF R&D +// 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, 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. // +// 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 +// + // File : SALOMEDS_UseCaseIterator_i.cxx -// Author : Yves FRICAUD +// Author : Sergey RUIN // Module : SALOME - -using namespace std; +// #include "SALOMEDS_UseCaseIterator_i.hxx" #include "SALOMEDS_SObject_i.hxx" -#include "utilities.h" - +#include "SALOMEDS.hxx" +#include "SALOMEDSImpl_SObject.hxx" +#include "utilities.h" //============================================================================ /*! Function : constructor * Purpose : */ //============================================================================ -SALOMEDS_UseCaseIterator_i::SALOMEDS_UseCaseIterator_i(const TDF_Label& theLabel, - const Standard_GUID& theGUID, - const Standard_Boolean allLevels, - CORBA::ORB_ptr orb) -:_guid(theGUID), _levels(allLevels) +SALOMEDS_UseCaseIterator_i::SALOMEDS_UseCaseIterator_i(const SALOMEDSImpl_UseCaseIterator& theImpl, + CORBA::ORB_ptr orb) { _orb = CORBA::ORB::_duplicate(orb); - - if(theLabel.FindAttribute(_guid, _node)) { - _it.Initialize (_node, _levels); - } + _impl = theImpl.GetPersistentCopy(); } //============================================================================ @@ -40,6 +50,7 @@ SALOMEDS_UseCaseIterator_i::SALOMEDS_UseCaseIterator_i(const TDF_Label& theLabel //============================================================================ SALOMEDS_UseCaseIterator_i::~SALOMEDS_UseCaseIterator_i() { + if(_impl) delete _impl; } //============================================================================ @@ -49,7 +60,8 @@ SALOMEDS_UseCaseIterator_i::~SALOMEDS_UseCaseIterator_i() //============================================================================ void SALOMEDS_UseCaseIterator_i::Init(CORBA::Boolean allLevels) { - _it.Initialize (_node, allLevels); + SALOMEDS::Locker lock; + if(_impl) _impl->Init(allLevels); } //============================================================================ @@ -59,17 +71,20 @@ void SALOMEDS_UseCaseIterator_i::Init(CORBA::Boolean allLevels) //============================================================================ CORBA::Boolean SALOMEDS_UseCaseIterator_i::More() { - return _it.More(); + SALOMEDS::Locker lock; + if(!_impl) return false; + return _impl->More(); } - //============================================================================ +//============================================================================ /*! Function : Next * */ //============================================================================ void SALOMEDS_UseCaseIterator_i::Next() { - _it.Next(); + SALOMEDS::Locker lock; + if(_impl) _impl->Next(); } @@ -78,12 +93,12 @@ void SALOMEDS_UseCaseIterator_i::Next() * Purpose : */ //============================================================================ - SALOMEDS::SObject_ptr SALOMEDS_UseCaseIterator_i::Value() { - TDF_Label L = _it.Value()->Label(); - SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (L,_orb); - SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + SALOMEDS::Locker lock; + if(!_impl) return SALOMEDS::SObject::_nil(); + SALOMEDSImpl_SObject aSO = _impl->Value(); + SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); return so._retn(); }