Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:22

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 Standard_True make recursive iterations
0049   Standard_EXPORT TObj_LabelIterator
0050                         (const TDF_Label& theLabel,
0051                          const Standard_Boolean isRecursive = Standard_False);
0052 
0053  public:
0054   /**
0055   * Redefined methods
0056   */
0057   
0058   //! Returns True if there is a current Item in the iteration.
0059   virtual Standard_Boolean More () const Standard_OVERRIDE
0060     { return !myNode.IsNull(); }
0061   
0062   //! Move to the next Item
0063   virtual Standard_EXPORT void Next () Standard_OVERRIDE;
0064    
0065   //! Returns the current item
0066   virtual Handle(TObj_Object) Value () const Standard_OVERRIDE
0067     { return myObject; }
0068   
0069   //! Returns the label of the current item
0070   inline const TDF_Label& LabelValue() const
0071     { return myNode; }
0072   
0073  protected:
0074   /**
0075   * Iterating methods
0076   */
0077   
0078   //! Shifts iterator to the next object
0079   virtual void MakeStep() = 0;
0080   
0081  protected:
0082   /**
0083   * Internal methods
0084   */
0085   
0086   //! Initialize Iterator by the theLabel
0087   void Init(const TDF_Label& theLabel,
0088                             const Standard_Boolean isRecursive = Standard_False)
0089     { myIterator.Initialize(theLabel,isRecursive); }
0090   
0091   
0092  protected:
0093   /**
0094   * Fields
0095   */
0096   TDF_Label               myNode;     //!< Current node
0097   TDF_ChildIterator       myIterator; //!< OCAF Child iterator
0098   Handle(TObj_Object)     myObject;   //!< Current Object
0099   
0100  public:
0101   //! CASCADE RTTI
0102   DEFINE_STANDARD_RTTIEXT(TObj_LabelIterator,TObj_ObjectIterator)
0103 };
0104 
0105 //! Define handle class for TObj_LabelIterator
0106 DEFINE_STANDARD_HANDLE(TObj_LabelIterator,TObj_ObjectIterator)
0107 
0108 #endif
0109 
0110 #ifdef _MSC_VER
0111 #pragma once
0112 #endif