0024157: Parallelization of assembly part of BO
[occt.git] / src / IFSelect / IFSelect_SignCounter.cdl
CommitLineData
b311480e 1-- Created on: 1994-11-07
2-- Created by: Christian CAILLET
3-- Copyright (c) 1994-1999 Matra Datavision
4-- Copyright (c) 1999-2012 OPEN CASCADE SAS
5--
6-- The content of this file is subject to the Open CASCADE Technology Public
7-- License Version 6.5 (the "License"). You may not use the content of this file
8-- except in compliance with the License. Please obtain a copy of the License
9-- at http://www.opencascade.org and read it completely before using this file.
10--
11-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13--
14-- The Original Code and all software distributed under the License is
15-- distributed on an "AS IS" basis, without warranty of any kind, and the
16-- Initial Developer hereby disclaims all such warranties, including without
17-- limitation, any warranties of merchantability, fitness for a particular
18-- purpose or non-infringement. Please see the License for the specific terms
19-- and conditions governing the rights and limitations under the License.
20
7fd59977 21
22
23class SignCounter from IFSelect inherits SignatureList
24
25 ---Purpose : SignCounter gives the frame to count signatures associated
26 -- with entities, deducted from them. Ex.: their Dynamic Type.
27 --
28 -- It can sort a set of Entities according a signature, i.e. :
29 -- - list of different values found for this Signature
30 -- - for each one, count and list of entities
31 -- Results are returned as a SignatureList, which can be queried
32 -- on the count (list of strings, count per signature, or list of
33 -- entities per signature)
34 --
35 -- A SignCounter can be filled, either directly from lists, or
36 -- from the result of a Selection : hence, its content can be
37 -- automatically recomputed as desired
38 --
39 -- SignCounter works by using a Signature in its method AddSign
40 --
41 -- Methods can be redefined to, either
42 -- - directly compute the value without a Signature
43 -- - compute the value in the context of a Graph
44
45uses CString, Transient, MapOfTransient, HAsciiString from TCollection,
46 HSequenceOfTransient,
47 InterfaceModel, Graph, Selection, Signature
48
49is
50
51 Create (withmap : Boolean = Standard_True;
52 withlist : Boolean = Standard_False) returns mutable SignCounter;
53 ---Purpose : Creates a SignCounter, without proper Signature
54 -- If <withmap> is True (default), added entities are counted
55 -- only if they are not yet recorded in the map
56 -- Map control can be set off if the input garantees uniqueness
57 -- of data
58 -- <withlist> is transmitted to SignatureList (option to list
59 -- entities, not only to count them).
60
61 Create (matcher : mutable Signature;
62 withmap : Boolean = Standard_True;
63 withlist : Boolean = Standard_False) returns mutable SignCounter;
64 ---Purpose : Creates a SignCounter, with a predefined Signature
65 -- Other arguments as for Create without Signature.
66
67 Signature (me) returns mutable Signature;
68 ---Purpose : Returns the Signature used to count entities. It can be null.
69
70 SetMap (me : mutable; withmap : Boolean);
71 ---Purpose : Changes the control status. The map is not cleared, simply
72 -- its use changes
73
74 AddEntity (me : mutable; ent : Transient; model : InterfaceModel)
75 returns Boolean is virtual;
76 ---Purpose : Adds an entity by considering its signature, which is given by
77 -- call to method AddSign
78 -- Returns True if added, False if already in the map (and
79 -- map control status set)
80
81 AddSign (me : mutable; ent : Transient; model : InterfaceModel)
82 is virtual;
83 ---Purpose : Adds an entity (already filtered by Map) with its signature.
84 -- This signature can be computed with the containing model.
85 -- Its value is provided by the object Signature given at start,
86 -- if no Signature is defined, it does nothing.
87 --
88 -- Can be redefined (in this case, see also Sign)
89
90 AddList (me : mutable; list : HSequenceOfTransient; model : InterfaceModel);
91 ---Purpose : Adds a list of entities by adding each of the items
92
93 AddWithGraph (me : mutable; list : HSequenceOfTransient; graph : Graph)
94 is virtual;
95 ---Purpose : Adds a list of entities in the context given by the graph
96 -- Default just call basic AddList
97 -- Can be redefined to get a signature computed with the graph
98
99 AddModel (me : mutable; model : InterfaceModel);
100 ---Purpose : Adds all the entities contained in a Model
101
102 AddFromSelection (me : mutable; sel : Selection; G : Graph);
103 ---Purpose : Adds the result determined by a Selection from a Graph
104 -- Remark : does not impact at all data from SetSelection & Co
105
106 -- Counting on selection result --
107
108 SetSelection (me : mutable; sel : Selection);
109 ---Purpose : Sets a Selection as input : this causes content to be cleared
110 -- then the Selection to be ready to compute (but not immediatly)
111
112 Selection (me) returns Selection;
113 ---Purpose : Returns the selection, or a null Handle
114
115 SetSelMode (me : mutable; selmode : Integer);
116 ---Purpose : Changes the mode of working with the selection :
117 -- -1 just clears optimisation data and nothing else
118 -- 0 clears it 1 inhibits it for computing (but no clearing)
119 -- 2 sets it active for computing
120 -- Default at creation is 0, after SetSelection (not null) is 2
121
122 SelMode (me) returns Integer;
123 ---Purpose : Returns the mode of working with the selection
124
125 ComputeSelected (me : mutable; G : Graph; forced : Boolean=Standard_False)
126 returns Boolean;
127 ---Purpose : Computes from the selection result, if selection is active
128 -- (mode 2). If selection is not defined (mode 0) or is inhibited
129 -- (mode 1) does nothing.
130 -- Returns True if computation is done (or optimised), False else
131 -- This method is called by ComputeCounter from WorkSession
132 --
133 -- If <forced> is True, recomputes systematically
134 -- Else (D), if the counter was not cleared and if the former
135 -- computed result started from the same total size of Graph and
136 -- same count of selected entities : computation is not redone
137 -- unless <forced> is given as True
138
139
140 Sign (me; ent : Transient; model : InterfaceModel)
141 returns HAsciiString is virtual;
142 ---Purpose : Determines and returns the value of the signature for an
143 -- entity as an HAsciiString. This method works exactly as
144 -- AddSign, which is optimized
145 --
146 -- Can be redefined, accorded with AddSign
147
148 ComputedSign (me : mutable; ent : Transient; G : Graph) returns CString;
149 ---Purpose : Applies AddWithGraph on one entity, and returns the Signature
150 -- Value which has been recorded
151 -- To do this, Add is called with SignOnly Mode True during the
152 -- call, the returned value is LastValue
153
154fields
155
156 themapstat : Boolean;
157 themap : MapOfTransient;
158 thematcher : Signature;
159
160 theselect : Selection;
161 theselmode : Integer;
162 thenbcomp1 : Integer;
163 thenbcomp2 : Integer;
164
165end SignCounter;