Salome HOME
ENV: Windows porting.
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_ChildIterator.cxx
1 //  File   : SALOMEDS_ChildIterator.cxx
2 //  Author : Sergey RUIN
3 //  Module : SALOME
4
5
6
7 #include "SALOMEDS_ChildIterator.hxx"
8 #include "SALOMEDS_SObject.hxx"
9
10 using namespace std; 
11
12 SALOMEDS_ChildIterator::SALOMEDS_ChildIterator(const Handle(SALOMEDSImpl_ChildIterator)& theIterator)
13 {
14   _isLocal = true;
15   _local_impl = theIterator;
16   _corba_impl = SALOMEDS::ChildIterator::_nil();
17 }
18
19 SALOMEDS_ChildIterator::SALOMEDS_ChildIterator(SALOMEDS::ChildIterator_ptr theIterator)
20 {
21   _isLocal = false;
22   _local_impl = NULL;
23   _corba_impl = SALOMEDS::ChildIterator::_duplicate(theIterator);
24 }
25
26 SALOMEDS_ChildIterator::~SALOMEDS_ChildIterator()
27 {
28   if(!_isLocal) _corba_impl->Destroy(); 
29 }
30
31 void SALOMEDS_ChildIterator::Init()
32 {
33   if(_isLocal) _local_impl->Init();
34   else _corba_impl->Init();
35 }
36
37 void SALOMEDS_ChildIterator::InitEx(bool theAllLevels)
38 {
39   if(_isLocal) _local_impl->InitEx(theAllLevels);
40   else _corba_impl->InitEx(theAllLevels);
41 }
42
43 bool SALOMEDS_ChildIterator::More()
44 {
45   bool ret;
46   if(_isLocal) ret = _local_impl->More();
47   else ret = _corba_impl->More();
48   return ret;
49 }
50
51 void SALOMEDS_ChildIterator::Next() 
52 {
53   if(_isLocal) _local_impl->Next();
54   else _corba_impl->Next();
55 }
56
57 _PTR(SObject) SALOMEDS_ChildIterator::Value()
58 {
59   SALOMEDSClient_SObject* aSO;
60   if(_isLocal) aSO = new SALOMEDS_SObject(_local_impl->Value());
61   else aSO = new SALOMEDS_SObject(_corba_impl->Value());
62   return _PTR(SObject)(aSO);
63 }