Back to home page

EIC code displayed by LXR

 
 

    


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

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