1 -- Created on: 1994-10-27
2 -- Created by: Christian CAILLET
3 -- Copyright (c) 1994-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
23 class SignatureList from IFSelect inherits TShared
25 ---Purpose : A SignatureList is given as result from a Counter (any kind)
26 -- It gives access to a list of signatures, with counts, and
27 -- optionally with list of corresponding entities
29 -- It can also be used only to give a signature, through SignOnly
30 -- Mode. This can be useful for a specific counter (used in a
31 -- Selection), while it remains better to use a Signature
34 uses CString, HSequenceOfTransient,
35 DictionaryOfInteger, DictionaryOfTransient,
36 AsciiString from TCollection,
37 HAsciiString from TCollection,
38 HSequenceOfHAsciiString from TColStd,
39 Messenger from Message,
40 InterfaceModel, PrintCount
44 Create (withlist : Boolean = Standard_False) returns mutable SignatureList;
45 ---Purpose : Creates a SignatureList. If <withlist> is True, entities will
46 -- be not only counted per signature, but also listed.
48 SetList (me : mutable; withlist : Boolean);
49 ---Purpose : Changes the record-list status. The list is not cleared but
52 ModeSignOnly (me : mutable) returns Boolean;
53 ---Purpose : Returns modifiable the SignOnly Mode
54 -- If False (D), the counter normally counts
55 -- If True, the counting work is turned off, Add only fills the
56 -- LastValue, which can be used as signature, when a counter
57 -- works from data which are not available from a Signature
60 Clear (me : mutable) is virtual;
62 Add (me : mutable; ent : Transient; sign : CString);
63 ---Purpose : Adds an entity with its signature, i.e. :
64 -- - counts an item more for <sign>
65 -- - if record-list status is set, records the entity
66 -- Accepts a null entity (the signature is then for the global
67 -- model). But if the string is empty, counts a Null item.
69 -- If SignOnly Mode is set, this work is replaced by just
72 LastValue (me) returns CString;
73 ---Purpose : Returns the last value recorded by Add (only if SignMode set)
74 -- Cleared by Clear or Init
78 count : DictionaryOfInteger;
79 list : DictionaryOfTransient;
81 ---Purpose : Aknowledges the list in once. Name identifies the Signature
83 List (me; root : CString = "") returns HSequenceOfHAsciiString;
84 ---Purpose : Returns the list of signatures, as a sequence of strings
85 -- (but without their respective counts). It is ordered.
86 -- By default, for all the signatures.
87 -- If <root> is given non empty, for the signatures which
90 HasEntities (me) returns Boolean;
91 ---Purpose : Returns True if the list of Entities is aknowledged, else
92 -- the method Entities will always return a Null Handle
94 NbNulls (me) returns Integer;
95 ---Purpose : Returns the count of null entities
97 NbTimes (me; sign : CString) returns Integer;
98 ---Purpose : Returns the number of times a signature was counted,
99 -- 0 if it has not been recorded at all
101 Entities (me; sign : CString) returns HSequenceOfTransient;
102 ---Purpose : Returns the list of entities attached to a signature
103 -- It is empty if <sign> has not been recorded
104 -- It is a Null Handle if the list of entities is not known
106 SetName (me : mutable; name : CString);
107 ---Purpose : Defines a name for a SignatureList (used to print it)
109 Name (me) returns CString is virtual;
110 ---Purpose : Returns the recorded Name.
111 -- Remark : default is "..." (no SetName called)
113 PrintCount (me; S : Messenger from Message) is virtual;
114 ---Purpose : Prints the counts of items (not the list)
116 PrintList (me; S : Messenger from Message; model : InterfaceModel;
117 mod : PrintCount = IFSelect_ListByItem) is virtual;
118 ---Purpose : Prints the lists of items, if they are present (else, prints
119 -- a message "no list available")
120 -- Uses <model> to determine for each entity to be listed, its
121 -- number, and its specific identifier (by PrintLabel)
122 -- <mod> gives a mode for printing :
123 -- - CountByItem : just count (as PrintCount)
124 -- - ShortByItem : minimum i.e. count plus 5 first entity numbers
125 -- - ShortByItem(D) complete list of entity numbers (0: "Global")
126 -- - EntitiesByItem : list of (entity number/PrintLabel from the model)
127 -- other modes are ignored
129 PrintSum (me; S : Messenger from Message) is virtual;
130 ---Purpose : Prints a summary
131 -- Item which has the greatest count of entities
132 -- For items which are numeric values : their count, maximum,
133 -- minimum values, cumul, average
137 thesignonly : Boolean;
140 thename : HAsciiString;
141 thelastval : AsciiString;
142 thedicount : DictionaryOfInteger;
143 thediclist : DictionaryOfTransient;