0029915: Porting to VC 2017 : Regressions in Modeling Algorithms on VC 2017
[occt.git] / src / Interface / Interface_EntityIterator.hxx
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
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _Interface_EntityIterator_HeaderFile
18 #define _Interface_EntityIterator_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
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;
32
33
34 //! Defines an Iterator on Entities.
35 //! Allows considering of various criteria
36 class Interface_EntityIterator 
37 {
38 public:
39
40   DEFINE_STANDARD_ALLOC
41
42   
43   //! Defines an empty iterator (see AddList & AddItem)
44   Standard_EXPORT Interface_EntityIterator();
45   
46   //! Defines an iterator on a list, directly i.e. without copying it
47   Standard_EXPORT Interface_EntityIterator(const Handle(TColStd_HSequenceOfTransient)& list);
48   
49   //! Gets a list of entities and adds its to the iteration list
50   Standard_EXPORT void AddList (const Handle(TColStd_HSequenceOfTransient)& list);
51   
52   //! Adds to the iteration list a defined entity
53   Standard_EXPORT void AddItem (const Handle(Standard_Transient)& anentity);
54   
55   //! same as AddItem (kept for compatibility)
56   Standard_EXPORT void GetOneItem (const Handle(Standard_Transient)& anentity);
57   
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);
61   
62   //! Returns count of entities which will be iterated on
63   //! Calls Start if not yet done
64   Standard_EXPORT Standard_Integer NbEntities() const;
65   
66   //! Returns count of entities of a given type (kind of)
67   Standard_EXPORT Standard_Integer NbTyped (const Handle(Standard_Type)& type) const;
68   
69   //! Returns the list of entities of a given type (kind of)
70   Standard_EXPORT Interface_EntityIterator Typed (const Handle(Standard_Type)& type) const;
71   
72   //! Allows re-iteration (useless for the first iteration)
73   Standard_EXPORT virtual void Start() const;
74   
75   //! Says if there are other entities (vertices) to iterate
76   //! the first time, calls Start
77   Standard_EXPORT Standard_Boolean More() const;
78   
79   //! Sets iteration to the next entity (vertex) to give
80   Standard_EXPORT void Next() const;
81   
82   //! Returns the current Entity iterated, to be used by Interface
83   //! tools
84   Standard_EXPORT const Handle(Standard_Transient)& Value() const;
85   
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;
91   
92   //! Clears data of iteration
93   Standard_EXPORT void Destroy();
94
95   //! Destructor
96   Standard_EXPORT virtual ~Interface_EntityIterator();
97
98 protected:
99
100   
101   //! Allows subclasses of EntityIterator to reevaluate an iteration
102   Standard_EXPORT void Reset();
103
104
105
106
107 private:
108
109
110
111   Handle(Interface_IntVal) thecurr;
112   Handle(TColStd_HSequenceOfTransient) thelist;
113
114
115 };
116
117
118
119
120
121
122
123 #endif // _Interface_EntityIterator_HeaderFile