Salome HOME
Moved some functionality to VTKViewer_Utilities.h
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_ChildIterator_i.cxx
index 7feabbddd4d8e8943b4ef6b710aac53e14c1c84c..d256bb669257b046510e90b42459d42978ed5f83 100644 (file)
@@ -1,30 +1,51 @@
-using namespace std;
-//  File      : SALOMEDS_ChildIterator_i.cxx
-//  Created   : Wed Nov 28 16:15:25 2001
-//  Author    : Yves FRICAUD
-
-//  Project   : SALOME
-//  Module    : SALOMEDS
-//  Copyright : Open CASCADE 2001
+//  SALOME SALOMEDS : data structure of SALOME and sources of Salome data server 
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SALOMEDS_ChildIterator_i.cxx
+//  Author : Yves FRICAUD
+//  Module : SALOME
 //  $Header$
 
+#include <TDF_Tool.hxx>
+
 #include "SALOMEDS_ChildIterator_i.hxx"
 #include "SALOMEDS_SObject_i.hxx"
 #include "utilities.h"
 
-
+using namespace std;
 
 //============================================================================
 /*! Function : constructor
  *  Purpose  :
  */
 //============================================================================
-SALOMEDS_ChildIterator_i::SALOMEDS_ChildIterator_i(TDF_Label lab,
-                                                  CORBA::ORB_ptr orb) 
-  : _lab(lab)
+SALOMEDS_ChildIterator_i::SALOMEDS_ChildIterator_i(SALOMEDS_Study_i* theStudy,
+                                                  const TDF_Label& theLabel,
+                                                  bool theIsAllLevels): 
+  _it(theLabel,theIsAllLevels),
+  _lab(theLabel),
+  _study(theStudy)
 {
-  _orb = CORBA::ORB::_duplicate(orb);
-  _it.Initialize (lab);
 }
 
 //============================================================================
@@ -43,7 +64,7 @@ SALOMEDS_ChildIterator_i::~SALOMEDS_ChildIterator_i()
 //============================================================================
 void SALOMEDS_ChildIterator_i::Init()
 { 
-  _it.Initialize (_lab);
+  _it.Initialize(_lab);
 }
 
 //============================================================================
@@ -51,9 +72,9 @@ void SALOMEDS_ChildIterator_i::Init()
  * 
  */
 //============================================================================
-void SALOMEDS_ChildIterator_i::InitEx(CORBA::Boolean allLevels)
+void SALOMEDS_ChildIterator_i::InitEx(CORBA::Boolean theIsAllLevels)
 { 
-  _it.Initialize (_lab, allLevels);
+  _it.Initialize(_lab,theIsAllLevels);
 }
 
 //============================================================================
@@ -85,9 +106,10 @@ void SALOMEDS_ChildIterator_i::Next()
 
 SALOMEDS::SObject_ptr SALOMEDS_ChildIterator_i::Value()
 {
-  TDF_Label L = _it.Value();
-  SALOMEDS_SObject_i *  so_servant = new SALOMEDS_SObject_i (L,_orb);
-  SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this());
-  return so;
+  return SALOMEDS_SObject_i::NewRef(_study,_it.Value())._retn();
 }
 
+SALOMEDS_SObject_i* SALOMEDS_ChildIterator_i::GetValue()
+{
+  return SALOMEDS_SObject_i::NewPtr(_study,_it.Value());
+}