0027067: Avoid use of virtual methods for implementation of destructors in legacy...
[occt.git] / src / IFGraph / IFGraph_SubPartsIterator.hxx
CommitLineData
42cf5bc1 1// Created on: 1992-09-23
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 _IFGraph_SubPartsIterator_HeaderFile
18#define _IFGraph_SubPartsIterator_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Interface_Graph.hxx>
25#include <TColStd_HSequenceOfInteger.hxx>
26#include <Standard_Integer.hxx>
27#include <Standard_Boolean.hxx>
28class Standard_OutOfRange;
29class Standard_NoSuchObject;
30class Interface_InterfaceError;
31class Interface_Graph;
32class Interface_InterfaceModel;
33class Standard_Transient;
34class Interface_EntityIterator;
35class Interface_GraphContent;
36
37
38//! defines general form for graph classes of which result is
39//! not a single iteration on Entities, but a nested one :
40//! External iteration works on sub-parts, identified by each
41//! class (according to its algorithm)
42//! Internal Iteration concerns Entities of a sub-part
43//! Sub-Parts are assumed to be disjoined; if they are not,
44//! the first one has priority
45//!
46//! A SubPartsIterator can work in two steps : first, load
47//! entities which have to be processed
48//! then, analyse to set those entities into sub-parts
49class IFGraph_SubPartsIterator
50{
51public:
52
53 DEFINE_STANDARD_ALLOC
54
55
56 //! Creates with a Graph, whole or parts of it
57 //! whole True : works on the entire Model
58 //! whole False : empty, ready to be filled
59 //! SubPartIterator is set to load entities
60 Standard_EXPORT IFGraph_SubPartsIterator(const Interface_Graph& agraph, const Standard_Boolean whole);
61
62 //! Creates a SubPartIterator from another one and gets its Data
63 //! Note that only non-empty sub-parts are taken into account
64 //! PartNum is set to the last one
65 Standard_EXPORT IFGraph_SubPartsIterator(IFGraph_SubPartsIterator& other);
66
67 //! Gets Parts from another SubPartsIterator (in addition to the
68 //! ones already recorded)
69 //! Error if both SubPartsIterators are not based on the same Model
70 Standard_EXPORT void GetParts (IFGraph_SubPartsIterator& other);
71
72 //! Returns the Model with which this Iterator was created
73 Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
74
75 //! Adds an empty part and sets it to receive entities
76 Standard_EXPORT void AddPart();
77
78 //! Returns count of registered parts
79 Standard_EXPORT Standard_Integer NbParts() const;
80
81 //! Returns numero of part which currently receives entities
82 //! (0 at load time)
83 Standard_EXPORT Standard_Integer PartNum() const;
84
85 //! Sets SubPartIterator to get Entities (by GetFromEntity &
86 //! GetFromIter) into load status, to be analysed later
87 Standard_EXPORT void SetLoad();
88
89 //! Sets numero of receiving part to a new value
90 //! Error if not in range (1-NbParts)
91 Standard_EXPORT void SetPartNum (const Standard_Integer num);
92
93 //! Adds an Entity : into load status if in Load mode, to the
94 //! current part if there is one. If shared is True, adds
95 //! also its shared ones (shared at all levels)
96 Standard_EXPORT void GetFromEntity (const Handle(Standard_Transient)& ent, const Standard_Boolean shared);
97
98 //! Adds a list of Entities (into Load mode or to a Part),
99 //! given as an Iterator
100 Standard_EXPORT void GetFromIter (const Interface_EntityIterator& iter);
101
102 //! Erases data (parts, entities) : "me" becomes empty and in
103 //! load status
104 Standard_EXPORT void Reset();
105
106 //! Called by Clear, this method allows evaluation just before
107 //! iteration; its default is doing nothing, it is designed to
108 //! be redefined
109 Standard_EXPORT virtual void Evaluate();
110
111 //! Returns entities which where loaded (not set into a sub-part)
112 Standard_EXPORT Interface_GraphContent Loaded() const;
113
114 //! Same as above, but under the form of a Graph
115 Standard_EXPORT Interface_Graph LoadedGraph() const;
116
117 //! Returns True if an Entity is loaded (either set into a
118 //! sub-part or not)
119 Standard_EXPORT Standard_Boolean IsLoaded (const Handle(Standard_Transient)& ent) const;
120
121 //! Returns True if an Entity is Present in a sub-part
122 Standard_EXPORT Standard_Boolean IsInPart (const Handle(Standard_Transient)& ent) const;
123
124 //! Returns number of the sub-part in which an Entity has been set
125 //! if it is not in a sub-part (or not loaded at all), Returns 0
126 Standard_EXPORT Standard_Integer EntityPartNum (const Handle(Standard_Transient)& ent) const;
127
128 //! Sets iteration to its beginning; calls Evaluate
129 Standard_EXPORT void Start();
130
131 //! Returns True if there are more sub-parts to iterate on
132 //! Note : an empty sub-part is not taken in account by Iteration
133 Standard_EXPORT Standard_Boolean More();
134
135 //! Sets iteration to the next sub-part
136 //! if there is not, IsSingle-Entities will raises an exception
137 Standard_EXPORT void Next();
138
139 //! Returns True if current sub-part is single (has only one Entity)
140 //! Error if there is no sub-part to iterate now
141 Standard_EXPORT Standard_Boolean IsSingle() const;
142
143 //! Returns the first entity of current sub-part, that is for a
144 //! Single one, the only one it contains
145 //! Error : same as above (end of iteration)
146 Standard_EXPORT Handle(Standard_Transient) FirstEntity() const;
147
148 //! Returns current sub-part, not as a "Value", but as an Iterator
149 //! on Entities it contains
150 //! Error : same as above (end of iteration)
151 Standard_EXPORT Interface_EntityIterator Entities() const;
152
e6f550da 153 Standard_EXPORT virtual ~IFGraph_SubPartsIterator();
42cf5bc1 154
155protected:
156
157
158
159 Interface_Graph thegraph;
160
161
162private:
163
164
165 //! Returns the Graph used by <me>. Used to create another
166 //! SubPartsIterator from <me>
167 Standard_EXPORT const Interface_Graph& Graph() const;
168
169
170 Handle(TColStd_HSequenceOfInteger) theparts;
171 Handle(TColStd_HSequenceOfInteger) thefirsts;
172 Standard_Integer thepart;
173 Standard_Integer thecurr;
174
175
176};
177
178
179
180
181
182
183
184#endif // _IFGraph_SubPartsIterator_HeaderFile