Back to index

salome-kernel  6.5.0
SALOMEDSImpl_ChildIterator.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  File   : SALOMEDSImpl_ChildIterator.cxx
00024 //  Author : Sergey RUIN
00025 //  Module : SALOME
00026 //
00027 #include "SALOMEDSImpl_ChildIterator.hxx"
00028 #include "SALOMEDSImpl_Study.hxx"
00029 
00030 SALOMEDSImpl_ChildIterator::SALOMEDSImpl_ChildIterator(const SALOMEDSImpl_SObject& theSO)
00031 {
00032   _so  = theSO;
00033   _it = DF_ChildIterator(_so.GetLabel());
00034 }
00035 
00036 SALOMEDSImpl_ChildIterator::SALOMEDSImpl_ChildIterator(const DF_Label& theLabel)
00037 {
00038   _so  = SALOMEDSImpl_Study::SObject(theLabel);
00039   _it = DF_ChildIterator(theLabel);
00040 }
00041 
00042 void SALOMEDSImpl_ChildIterator::Init()
00043 {
00044   if(_so) _it.Init(_so.GetLabel(), false);
00045 }
00046 
00047 void SALOMEDSImpl_ChildIterator::Init(const DF_Label& theLabel)
00048 {
00049   _it.Init(theLabel, false);
00050 }
00051 
00052 void SALOMEDSImpl_ChildIterator::InitEx(bool theAllLevels)
00053 {
00054   if(_so) _it.Init(_so.GetLabel(), theAllLevels);
00055 }
00056 
00057 void SALOMEDSImpl_ChildIterator::InitEx(const DF_Label& theLabel, bool theAllLevels)
00058 {
00059   _it.Init(theLabel, theAllLevels);
00060 }
00061 
00062 bool SALOMEDSImpl_ChildIterator::More()
00063 {
00064   return _it.More();
00065 }
00066 
00067 void SALOMEDSImpl_ChildIterator::Next() 
00068 {
00069   _it.Next();
00070 }
00071 
00072 SALOMEDSImpl_SObject SALOMEDSImpl_ChildIterator::Value()
00073 {
00074   if(!_so) return SALOMEDSImpl_SObject();
00075   return SALOMEDSImpl_Study::SObject(_it.Value());
00076 }
00077 
00078 DF_Label SALOMEDSImpl_ChildIterator::Label()
00079 {
00080   return _it.Value();
00081 }
00082 
00083 SALOMEDSImpl_ChildIterator* SALOMEDSImpl_ChildIterator::GetPersistentCopy() const
00084 {
00085   SALOMEDSImpl_ChildIterator* itr = new SALOMEDSImpl_ChildIterator();
00086   itr->_it = _it;
00087   itr->_so = _so;
00088   return itr;
00089 }
00090