b311480e |
1 | -- Created on: 1996-02-15 |
2 | -- Created by: Christian CAILLET |
3 | -- Copyright (c) 1996-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | class Stat from MoniTool |
18 | |
19 | ---Purpose : This class manages Statistics to be queried asynchronously. |
20 | -- |
21 | -- It is organized as a stack of counters, identified by their |
22 | -- levels, from one to ... . Each one has a total account of |
23 | -- items to be counted, a count of already passed items, plus a |
24 | -- count of "current items". The counters of higher level play on |
25 | -- these current items. |
26 | -- For instance, if a counter has been opened for 100 items, 40 |
27 | -- already passed, 20 current, its own percent is 40, but there |
28 | -- is the contribution of higher level counters, rated for 20 % |
29 | -- of this counter. |
30 | -- |
31 | -- Hence, a counter is opened, items are added. Also items can be |
32 | -- add for sub-counter (of higher level), they will be added |
33 | -- definitively when the sub-counter will be closed. When the |
34 | -- count has ended, this counter is closed, the counter of |
35 | -- lower level cumulates it and goes on. As follows : |
36 | -- |
37 | -- Way of use : |
38 | -- Open(nbitems); |
39 | -- Add(..) : direct adding |
40 | -- Add(..) |
41 | -- AddSub (nsub) : for sub-counter |
42 | -- Open (nbsubs) : nbsubs for this sub-counter |
43 | -- Add (..) |
44 | -- Close : the sub-counter |
45 | -- AddEnd() |
46 | -- etc... |
47 | -- Close : the starting counter |
48 | -- |
49 | -- This means that a counter can be opened in a Stat, regardless |
50 | -- to the already opened ones :: this will be cumulated |
51 | -- |
52 | -- A Current Stat is available, but it is possible to have others |
53 | |
54 | uses Integer, Real, HArray1OfInteger, |
55 | CString, HAsciiString |
56 | |
57 | is |
58 | |
59 | -- -- Description of a Stat form -- -- |
60 | |
61 | Create (title : CString = "") returns Stat; |
62 | ---Purpose : Creates a Stat form. At start, one default phase is defined, |
63 | -- with one default step. Then, it suffises to start with a |
64 | -- count of items (and cycles if several) then record items, |
65 | -- to have a queryable report. |
66 | |
67 | Create (other : Stat) returns Stat; |
68 | ---Purpose : used when starting |
69 | |
70 | Current (myclass) returns Stat; |
71 | ---C++ : return & |
72 | |
73 | Open (me : in out; nb : Integer = 100) returns Integer; |
74 | ---Purpose : Opens a new counter with a starting count of items |
75 | |
76 | OpenMore (me : in out; id : Integer; nb : Integer); |
77 | ---Purpose : Adds more items to be counted by Add... on current level |
78 | |
79 | Add (me : in out; nb : Integer = 1); |
80 | ---Purpose : Directly addes items |
81 | |
82 | AddSub (me : in out; nb : Integer = 1); |
83 | ---Purpose : Declares a count of items to be added later. If a sub-counter |
84 | -- is opened, its percentage multiplies this sub-count to compute |
85 | -- the percent of current level |
86 | |
87 | AddEnd (me : in out); |
88 | ---Purpose : Ends the AddSub and cumulates the sub-count to current level |
89 | |
90 | Close (me : in out; id : Integer); |
91 | |
92 | Level (me) returns Integer; |
93 | |
94 | Percent (me; fromlev : Integer = 0) returns Real; |
95 | |
96 | fields |
97 | |
98 | thetit : HAsciiString from TCollection; |
99 | thelev : Integer; |
100 | thetot : HArray1OfInteger; |
101 | thedone : HArray1OfInteger; |
102 | thecurr : HArray1OfInteger; |
103 | |
104 | end Stat; |