Salome HOME
Copyrights update
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_UseCaseIterator.cxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
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.
8 // 
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.
13 //
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
17 //
18 // See http://www.salome-platform.org/
19 //
20 //  File   : SALOMEDS_UseCaseIterator.cxx
21 //  Author : Sergey RUIN
22 //  Module : SALOME
23
24
25
26 #include "SALOMEDS_UseCaseIterator.hxx"
27 #include "SALOMEDS_SObject.hxx"
28
29 using namespace std; 
30
31 SALOMEDS_UseCaseIterator::SALOMEDS_UseCaseIterator(const Handle(SALOMEDSImpl_UseCaseIterator)& theIterator)
32 {
33   _isLocal = true;
34   _local_impl = theIterator;
35   _corba_impl = SALOMEDS::UseCaseIterator::_nil();
36 }
37
38 SALOMEDS_UseCaseIterator::SALOMEDS_UseCaseIterator(SALOMEDS::UseCaseIterator_ptr theIterator)
39 {
40   _isLocal = false;
41   _local_impl = NULL;
42   _corba_impl = SALOMEDS::UseCaseIterator::_duplicate(theIterator);
43 }
44
45 SALOMEDS_UseCaseIterator::~SALOMEDS_UseCaseIterator()
46 {
47   if(!_isLocal) _corba_impl->Destroy();    
48 }
49
50 void SALOMEDS_UseCaseIterator::Init(bool theAllLevels)
51 {
52   if(_isLocal) _local_impl->Init(theAllLevels);
53   else _corba_impl->Init(theAllLevels);
54 }
55
56 bool SALOMEDS_UseCaseIterator::More()
57 {
58   bool ret;
59   if(_isLocal) ret = _local_impl->More();
60   else ret = _corba_impl->More();
61   return ret;
62 }
63
64 void SALOMEDS_UseCaseIterator::Next()
65 {
66   if(_isLocal) _local_impl->Next();
67   else _corba_impl->Next();
68 }
69
70 _PTR(SObject) SALOMEDS_UseCaseIterator::Value()
71 {
72   SALOMEDS_SObject* aSO;
73   if(_isLocal) aSO = new SALOMEDS_SObject(_local_impl->Value());
74   else aSO = new SALOMEDS_SObject(_corba_impl->Value());
75   return _PTR(SObject)(aSO);
76 }