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)
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();
48 void SALOMEDS_SComponentIterator::Init()
51 SALOMEDS::Locker lock;
54 else _corba_impl->Init();
57 bool SALOMEDS_SComponentIterator::More()
61 SALOMEDS::Locker lock;
62 ret = _local_impl.More();
64 else ret = _corba_impl->More();
68 void SALOMEDS_SComponentIterator::Next()
71 SALOMEDS::Locker lock;
74 else _corba_impl->Next();
77 _PTR(SComponent) SALOMEDS_SComponentIterator::Value()
79 SALOMEDSClient_SComponent* aSCO = NULL;
81 SALOMEDS::Locker lock;
82 aSCO = new SALOMEDS_SComponent(_local_impl.Value());
84 else aSCO = new SALOMEDS_SComponent(_corba_impl->Value());
85 return _PTR(SComponent)(aSCO);