Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-03 09:18:00

0001 // Created on: 2004-11-23
0002 // Created by: Pavel TELKOV
0003 // Copyright (c) 2004-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 // The original implementation Copyright: (C) RINA S.p.A
0017 
0018 #ifndef TObj_LabelIterator_HeaderFile
0019 #define TObj_LabelIterator_HeaderFile
0020 
0021 #include <TObj_Object.hxx>
0022 
0023 #include <TDF_Label.hxx>
0024 #include <TDF_ChildIterator.hxx>
0025 #include <TObj_ObjectIterator.hxx>
0026 
0027 /**
0028  * This class is a basis for OCAF based iterators.
0029  */
0030 
0031 class TObj_LabelIterator : public TObj_ObjectIterator
0032 {
0033 
0034 protected:
0035   /**
0036    * Constructor
0037    */
0038 
0039   //! Creates an Empty Iterator
0040   Standard_EXPORT TObj_LabelIterator();
0041 
0042 public:
0043   /**
0044    * Constructor
0045    */
0046 
0047   //! Creates an iterator an initialize it by theLabel and recursive flag.
0048   //! If isRecursive is true make recursive iterations
0049   Standard_EXPORT TObj_LabelIterator(const TDF_Label& theLabel, const bool isRecursive = false);
0050 
0051 public:
0052   /**
0053    * Redefined methods
0054    */
0055 
0056   //! Returns True if there is a current Item in the iteration.
0057   bool More() const override { return !myNode.IsNull(); }
0058 
0059   //! Move to the next Item
0060   Standard_EXPORT void Next() override;
0061 
0062   //! Returns the current item
0063   occ::handle<TObj_Object> Value() const override { return myObject; }
0064 
0065   //! Returns the label of the current item
0066   inline const TDF_Label& LabelValue() const { return myNode; }
0067 
0068 protected:
0069   /**
0070    * Iterating methods
0071    */
0072 
0073   //! Shifts iterator to the next object
0074   virtual void MakeStep() = 0;
0075 
0076 protected:
0077   /**
0078    * Internal methods
0079    */
0080 
0081   //! Initialize Iterator by the theLabel
0082   void Init(const TDF_Label& theLabel, const bool isRecursive = false)
0083   {
0084     myIterator.Initialize(theLabel, isRecursive);
0085   }
0086 
0087 protected:
0088   /**
0089    * Fields
0090    */
0091   TDF_Label                myNode;     //!< Current node
0092   TDF_ChildIterator        myIterator; //!< OCAF Child iterator
0093   occ::handle<TObj_Object> myObject;   //!< Current Object
0094 
0095 public:
0096   //! CASCADE RTTI
0097   DEFINE_STANDARD_RTTIEXT(TObj_LabelIterator, TObj_ObjectIterator)
0098 };
0099 
0100 //! Define handle class for TObj_LabelIterator
0101 #endif
0102 
0103 #ifdef _MSC_VER
0104 #pragma once
0105 #endif