1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : SALOMEDS_SComponentIterator.cxx
21 // Author : Sergey RUIN
24 #include "SALOMEDS_SComponentIterator.hxx"
26 #include "SALOMEDS.hxx"
27 #include "SALOMEDS_SComponent.hxx"
28 #include "SALOMEDSImpl_SComponent.hxx"
30 SALOMEDS_SComponentIterator::SALOMEDS_SComponentIterator(const SALOMEDSImpl_SComponentIterator& theIterator)
31 :_local_impl(theIterator.GetPersistentCopy())
34 _corba_impl = SALOMEDS::SComponentIterator::_nil();
37 SALOMEDS_SComponentIterator::SALOMEDS_SComponentIterator(SALOMEDS::SComponentIterator_ptr theIterator)
40 _corba_impl = SALOMEDS::SComponentIterator::_duplicate(theIterator);
43 SALOMEDS_SComponentIterator::~SALOMEDS_SComponentIterator()
45 if(!_isLocal) _corba_impl->Destroy();
46 else if(_local_impl) delete _local_impl;
49 void SALOMEDS_SComponentIterator::Init()
52 SALOMEDS::Locker lock;
55 else _corba_impl->Init();
58 bool SALOMEDS_SComponentIterator::More()
62 SALOMEDS::Locker lock;
63 ret = _local_impl->More();
65 else ret = _corba_impl->More();
69 void SALOMEDS_SComponentIterator::Next()
72 SALOMEDS::Locker lock;
75 else _corba_impl->Next();
78 _PTR(SComponent) SALOMEDS_SComponentIterator::Value()
80 SALOMEDSClient_SComponent* aSCO = NULL;
82 SALOMEDS::Locker lock;
83 aSCO = new SALOMEDS_SComponent(_local_impl->Value());
85 else aSCO = new SALOMEDS_SComponent(_corba_impl->Value());
86 return _PTR(SComponent)(aSCO);