7fd59977 |
1 | -- File: IFSelect_SignatureList.cdl |
2 | -- Created: Thu Oct 27 18:49:25 1994 |
3 | -- Author: Christian CAILLET |
4 | -- <cky@stylox> |
5 | ---Copyright: Matra Datavision 1994 |
6 | |
7 | |
8 | class SignatureList from IFSelect inherits TShared |
9 | |
10 | ---Purpose : A SignatureList is given as result from a Counter (any kind) |
11 | -- It gives access to a list of signatures, with counts, and |
12 | -- optionally with list of corresponding entities |
13 | -- |
14 | -- It can also be used only to give a signature, through SignOnly |
15 | -- Mode. This can be useful for a specific counter (used in a |
16 | -- Selection), while it remains better to use a Signature |
17 | -- whenever possible |
18 | |
19 | uses CString, HSequenceOfTransient, |
20 | DictionaryOfInteger, DictionaryOfTransient, |
21 | AsciiString from TCollection, |
22 | HAsciiString from TCollection, |
23 | HSequenceOfHAsciiString from TColStd, |
24 | Messenger from Message, |
25 | InterfaceModel, PrintCount |
26 | |
27 | is |
28 | |
29 | Create (withlist : Boolean = Standard_False) returns mutable SignatureList; |
30 | ---Purpose : Creates a SignatureList. If <withlist> is True, entities will |
31 | -- be not only counted per signature, but also listed. |
32 | |
33 | SetList (me : mutable; withlist : Boolean); |
34 | ---Purpose : Changes the record-list status. The list is not cleared but |
35 | -- its use changes |
36 | |
37 | ModeSignOnly (me : mutable) returns Boolean; |
38 | ---Purpose : Returns modifiable the SignOnly Mode |
39 | -- If False (D), the counter normally counts |
40 | -- If True, the counting work is turned off, Add only fills the |
41 | -- LastValue, which can be used as signature, when a counter |
42 | -- works from data which are not available from a Signature |
43 | ---C++ : return & |
44 | |
45 | Clear (me : mutable) is virtual; |
46 | |
47 | Add (me : mutable; ent : Transient; sign : CString); |
48 | ---Purpose : Adds an entity with its signature, i.e. : |
49 | -- - counts an item more for <sign> |
50 | -- - if record-list status is set, records the entity |
51 | -- Accepts a null entity (the signature is then for the global |
52 | -- model). But if the string is empty, counts a Null item. |
53 | -- |
54 | -- If SignOnly Mode is set, this work is replaced by just |
55 | -- setting LastValue |
56 | |
57 | LastValue (me) returns CString; |
58 | ---Purpose : Returns the last value recorded by Add (only if SignMode set) |
59 | -- Cleared by Clear or Init |
60 | |
61 | Init (me : mutable; |
62 | name : CString; |
63 | count : DictionaryOfInteger; |
64 | list : DictionaryOfTransient; |
65 | nbnuls : Integer); |
66 | ---Purpose : Aknowledges the list in once. Name identifies the Signature |
67 | |
68 | List (me; root : CString = "") returns HSequenceOfHAsciiString; |
69 | ---Purpose : Returns the list of signatures, as a sequence of strings |
70 | -- (but without their respective counts). It is ordered. |
71 | -- By default, for all the signatures. |
72 | -- If <root> is given non empty, for the signatures which |
73 | -- begin by <root> |
74 | |
75 | HasEntities (me) returns Boolean; |
76 | ---Purpose : Returns True if the list of Entities is aknowledged, else |
77 | -- the method Entities will always return a Null Handle |
78 | |
79 | NbNulls (me) returns Integer; |
80 | ---Purpose : Returns the count of null entities |
81 | |
82 | NbTimes (me; sign : CString) returns Integer; |
83 | ---Purpose : Returns the number of times a signature was counted, |
84 | -- 0 if it has not been recorded at all |
85 | |
86 | Entities (me; sign : CString) returns HSequenceOfTransient; |
87 | ---Purpose : Returns the list of entities attached to a signature |
88 | -- It is empty if <sign> has not been recorded |
89 | -- It is a Null Handle if the list of entities is not known |
90 | |
91 | SetName (me : mutable; name : CString); |
92 | ---Purpose : Defines a name for a SignatureList (used to print it) |
93 | |
94 | Name (me) returns CString is virtual; |
95 | ---Purpose : Returns the recorded Name. |
96 | -- Remark : default is "..." (no SetName called) |
97 | |
98 | PrintCount (me; S : Messenger from Message) is virtual; |
99 | ---Purpose : Prints the counts of items (not the list) |
100 | |
101 | PrintList (me; S : Messenger from Message; model : InterfaceModel; |
102 | mod : PrintCount = IFSelect_ListByItem) is virtual; |
103 | ---Purpose : Prints the lists of items, if they are present (else, prints |
104 | -- a message "no list available") |
105 | -- Uses <model> to determine for each entity to be listed, its |
106 | -- number, and its specific identifier (by PrintLabel) |
107 | -- <mod> gives a mode for printing : |
108 | -- - CountByItem : just count (as PrintCount) |
109 | -- - ShortByItem : minimum i.e. count plus 5 first entity numbers |
110 | -- - ShortByItem(D) complete list of entity numbers (0: "Global") |
111 | -- - EntitiesByItem : list of (entity number/PrintLabel from the model) |
112 | -- other modes are ignored |
113 | |
114 | PrintSum (me; S : Messenger from Message) is virtual; |
115 | ---Purpose : Prints a summary |
116 | -- Item which has the greatest count of entities |
117 | -- For items which are numeric values : their count, maximum, |
118 | -- minimum values, cumul, average |
119 | |
120 | fields |
121 | |
122 | thesignonly : Boolean; |
123 | thelistat : Boolean; |
124 | thenbnuls : Integer; |
125 | thename : HAsciiString; |
126 | thelastval : AsciiString; |
127 | thedicount : DictionaryOfInteger; |
128 | thediclist : DictionaryOfTransient; |
129 | |
130 | end SignatureList; |