Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-02 08:23:44

0001 // Created by: DAUTRY Philippe
0002 // Copyright (c) 1997-1999 Matra Datavision
0003 // Copyright (c) 1999-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 #ifndef _TDF_ChildIterator_HeaderFile
0017 #define _TDF_ChildIterator_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 #include <Standard_Handle.hxx>
0022 
0023 #include <Standard_Boolean.hxx>
0024 #include <TDF_Label.hxx>
0025 class TDF_Label;
0026 
0027 //! Iterates on the children of a label, at the first
0028 //! level only. It is possible to ask the iterator to
0029 //! explore all the sub label levels of the given one,
0030 //! with the option "allLevels".
0031 class TDF_ChildIterator
0032 {
0033 public:
0034   DEFINE_STANDARD_ALLOC
0035 
0036   //! Creates an empty iterator  object to
0037   //! explore the children of a label.
0038   Standard_EXPORT TDF_ChildIterator();
0039 
0040   //! Constructs the iterator object defined by
0041   //! the label aLabel.  Iterates on the children of the given label. If
0042   //! <allLevels> option is set to true, it explores not
0043   //! only the first, but all the sub label levels.
0044   Standard_EXPORT TDF_ChildIterator(const TDF_Label&       aLabel,
0045                                     const Standard_Boolean allLevels = Standard_False);
0046 
0047   //! Initializes the iteration on the children of the
0048   //! given label.
0049   //! If <allLevels> option is set to true,
0050   //! it explores not only the first, but all the sub
0051   //! label levels.
0052   //! If allLevels is false, only the first level of
0053   //! child labels is explored.
0054   //! In the example below, the label is iterated
0055   //! using Initialize, More and Next and its
0056   //! child labels dumped using TDF_Tool::Entry.
0057   //! Example
0058   //! void DumpChildren(const
0059   //! TDF_Label& aLabel)
0060   //! {
0061   //! TDF_ChildIterator it;
0062   //! TCollection_AsciiString es;
0063   //! for
0064   //! (it.Initialize(aLabel,Standard_True);
0065   //! it.More(); it.Next()){
0066   //! TDF_Tool::Entry(it.Value(),es);
0067   //! std::cout << as.ToCString() << std::endl;
0068   //! }
0069   //! }
0070   Standard_EXPORT void Initialize(const TDF_Label&       aLabel,
0071                                   const Standard_Boolean allLevels = Standard_False);
0072 
0073   //! Returns true if a current label is found in the
0074   //! iteration process.
0075   Standard_Boolean More() const;
0076 
0077   //! Move the  current  iteration  to the next Item.
0078   Standard_EXPORT void Next();
0079 
0080   //! Moves this iteration to the next brother
0081   //! label. A brother label is one with the same
0082   //! father as an initial label.
0083   //! Use this function when the non-empty
0084   //! constructor or Initialize has allLevels set to
0085   //! true. The result is that the iteration does not
0086   //! explore the children of the current label.
0087   //! This method is interesting only with
0088   //! "allLevels" behavior, because it avoids to explore
0089   //! the current label children.
0090   Standard_EXPORT void NextBrother();
0091 
0092   //! Returns the current label; or, if there is
0093   //! none, a null label.
0094   const TDF_Label Value() const;
0095 
0096 protected:
0097 private:
0098   TDF_LabelNodePtr myNode;
0099   Standard_Integer myFirstLevel;
0100 };
0101 
0102 #include <TDF_ChildIterator.lxx>
0103 
0104 #endif // _TDF_ChildIterator_HeaderFile