Salome HOME
c726bfcf72bcffe58866efd0d5f2d680f4cbaeb2
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_ChildIterator_i.cxx
1 // Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  File   : SALOMEDS_ChildIterator_i.cxx
24 //  Author : Sergey RUIN
25 //  Module : SALOME
26 //
27 #include "SALOMEDS_ChildIterator_i.hxx"
28 #include "SALOMEDS_Study_i.hxx"
29 #include "SALOMEDS_SObject_i.hxx"
30 #include "SALOMEDS.hxx"
31 #include "SALOMEDSImpl_SObject.hxx"
32 #include "SALOMEDSImpl_Study.hxx"
33 #include "utilities.h"
34
35 //============================================================================
36 /*! Function : constructor
37  *  Purpose  :
38  */
39 //============================================================================
40 SALOMEDS_ChildIterator_i::SALOMEDS_ChildIterator_i(const SALOMEDSImpl_ChildIterator& theImpl,
41                                                    CORBA::ORB_ptr orb)  :
42   GenericObj_i(SALOMEDS_Study_i::GetThePOA()),
43   _it(theImpl.GetPersistentCopy())
44 {
45   SALOMEDS::Locker lock;
46   _orb = CORBA::ORB::_duplicate(orb);
47 }
48
49 //============================================================================
50 /*! Function : destructor
51  *  Purpose  :
52  */
53 //============================================================================
54 SALOMEDS_ChildIterator_i::~SALOMEDS_ChildIterator_i()
55 {
56     if(_it) delete _it;
57 }
58
59 //============================================================================
60 /*!
61   \brief Get default POA for the servant object.
62
63   This function is implicitly called from "_this()" function.
64   Default POA can be set via the constructor.
65
66   \return reference to the default POA for the servant
67 */
68 //============================================================================
69 PortableServer::POA_ptr SALOMEDS_ChildIterator_i::_default_POA()
70 {
71   myPOA = PortableServer::POA::_duplicate(SALOMEDS_Study_i::GetThePOA());
72   //MESSAGE("SALOMEDS_ChildIterator_i::_default_POA: " << myPOA);
73   return PortableServer::POA::_duplicate(myPOA);
74 }
75
76 //============================================================================
77 /*! Function :Init
78  * 
79  */
80 //============================================================================
81 void SALOMEDS_ChildIterator_i::Init()
82
83   SALOMEDS::Locker lock;
84   _it->Init();
85 }
86
87 //============================================================================
88 /*! Function :InitEx
89  * 
90  */
91 //============================================================================
92 void SALOMEDS_ChildIterator_i::InitEx(CORBA::Boolean allLevels)
93
94   SALOMEDS::Locker lock;
95   _it->InitEx (allLevels);
96 }
97
98 //============================================================================
99 /*! Function : More
100  * 
101  */
102 //============================================================================
103 CORBA::Boolean SALOMEDS_ChildIterator_i::More()
104 {
105   SALOMEDS::Locker lock;
106   return _it->More();
107 }
108
109  //============================================================================
110 /*! Function : Next
111  * 
112  */
113 //============================================================================
114 void SALOMEDS_ChildIterator_i::Next()
115 {
116   SALOMEDS::Locker lock;
117   _it->Next();
118 }
119
120
121 //============================================================================
122 /*! Function : Value
123  *  Purpose  :
124  */
125 //============================================================================
126
127 SALOMEDS::SObject_ptr SALOMEDS_ChildIterator_i::Value()
128 {
129   SALOMEDS::Locker lock;
130   SALOMEDSImpl_SObject aSO = _it->Value();
131   SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
132   return so._retn();
133 }
134