1 // Created on: 1992-02-03
2 // Created by: Christian CAILLET
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Interface_EntityIterator_HeaderFile
18 #define _Interface_EntityIterator_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <TColStd_HSequenceOfTransient.hxx>
25 #include <Standard_Type.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <Standard_Integer.hxx>
28 class Interface_IntVal;
29 class Standard_NoMoreObject;
30 class Standard_NoSuchObject;
31 class Standard_Transient;
34 //! Defines an Iterator on Entities.
35 //! Allows considering of various criteria
36 class Interface_EntityIterator
43 //! Defines an empty iterator (see AddList & AddItem)
44 Standard_EXPORT Interface_EntityIterator();
46 //! Defines an iterator on a list, directly i.e. without copying it
47 Standard_EXPORT Interface_EntityIterator(const Handle(TColStd_HSequenceOfTransient)& list);
49 //! Gets a list of entities and adds its to the iteration list
50 Standard_EXPORT void AddList (const Handle(TColStd_HSequenceOfTransient)& list);
52 //! Adds to the iteration list a defined entity
53 Standard_EXPORT void AddItem (const Handle(Standard_Transient)& anentity);
55 //! same as AddItem (kept for compatibility)
56 Standard_EXPORT void GetOneItem (const Handle(Standard_Transient)& anentity);
58 //! Selects entities with are Kind of a given type, keep only
59 //! them (is keep is True) or reject only them (if keep is False)
60 Standard_EXPORT void SelectType (const Handle(Standard_Type)& atype, const Standard_Boolean keep);
62 //! Returns count of entities which will be iterated on
63 //! Calls Start if not yet done
64 Standard_EXPORT Standard_Integer NbEntities() const;
66 //! Returns count of entities of a given type (kind of)
67 Standard_EXPORT Standard_Integer NbTyped (const Handle(Standard_Type)& type) const;
69 //! Returns the list of entities of a given type (kind of)
70 Standard_EXPORT Interface_EntityIterator Typed (const Handle(Standard_Type)& type) const;
72 //! Allows re-iteration (useless for the first iteration)
73 Standard_EXPORT virtual void Start() const;
75 //! Says if there are other entities (vertices) to iterate
76 //! the first time, calls Start
77 Standard_EXPORT Standard_Boolean More() const;
79 //! Sets iteration to the next entity (vertex) to give
80 Standard_EXPORT void Next() const;
82 //! Returns the current Entity iterated, to be used by Interface
84 Standard_EXPORT const Handle(Standard_Transient)& Value() const;
86 //! Returns the content of the Iterator, accessed through a Handle
87 //! to be used by a frontal-engine logic
88 //! Returns an empty Sequence if the Iterator is empty
89 //! Calls Start if not yet done
90 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Content() const;
92 //! Clears data of iteration
93 Standard_EXPORT void Destroy();
96 Standard_EXPORT virtual ~Interface_EntityIterator();
101 //! Allows subclasses of EntityIterator to reevaluate an iteration
102 Standard_EXPORT void Reset();
111 Handle(Interface_IntVal) thecurr;
112 Handle(TColStd_HSequenceOfTransient) thelist;
123 #endif // _Interface_EntityIterator_HeaderFile