b311480e |
1 | -- Created on: 1992-05-13 |
2 | -- Created by: NW,JPB,CAL |
3 | -- Copyright (c) 1992-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
7fd59977 |
5 | -- |
b311480e |
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. |
7fd59977 |
10 | -- |
b311480e |
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. |
7fd59977 |
13 | -- |
b311480e |
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 | class GenId from Aspect |
23 | |
24 | ---Version: |
25 | |
26 | ---Level: Internal |
27 | ---Purpose: This class permits the creation and control of all |
28 | -- identifiers. |
29 | -- Warning: An identifier is an integer. |
30 | |
31 | ---References: |
32 | |
33 | uses |
34 | |
35 | ListOfInteger from TColStd |
36 | |
37 | raises |
38 | |
39 | IdentDefinitionError from Aspect |
40 | |
41 | is |
42 | |
43 | Create |
44 | returns GenId from Aspect; |
45 | ---Level: Internal |
46 | ---Purpose: Creates an available set of identifiers with the lower |
47 | -- bound 0 and the upper bound INT_MAX/2. |
48 | |
49 | Create ( Low, Up : Integer from Standard ) |
50 | returns GenId from Aspect |
51 | ---Level: Internal |
52 | ---Purpose: Creates an available set of identifiers with the lower |
53 | -- bound <Low> and the upper bound <Up>. |
54 | -- Warning: Raises IdentDefinitionError if <Up> is less than <Low>. |
55 | raises IdentDefinitionError from Aspect; |
56 | |
57 | --------------------------------------------------- |
58 | -- Category: Methods to modify the class definition |
59 | --------------------------------------------------- |
60 | |
61 | --Assign ( me : in out; |
62 | --Other : GenId from Aspect ); |
63 | ---Level: Internal |
64 | ---Purpose: Copies the content of <Other> into <me>. |
65 | ---Category: Methods to modify the class definition |
66 | -- C++: alias operator = |
67 | |
68 | Free ( me : in out ); |
69 | ---Level: Internal |
70 | ---Purpose: Frees all identifiers of <me>. |
71 | ---Category: Methods to modify the class definition |
72 | |
73 | Free ( me : in out; |
74 | Id : Integer from Standard ); |
75 | ---Level: Internal |
76 | ---Purpose: Frees the identifier <Id> of <me>. |
77 | ---Category: Methods to modify the class definition |
78 | |
79 | ---------------------------- |
80 | -- Category: Inquire methods |
81 | ---------------------------- |
82 | |
83 | Available ( me ) |
84 | returns Integer from Standard; |
85 | ---Level: Internal |
86 | ---Purpose: Returns the number of available identifiers of <me>. |
87 | ---Category: Inquire methods |
88 | |
89 | Lower ( me ) |
90 | returns Integer from Standard; |
91 | ---Level: Internal |
92 | ---Purpose: Returns the lower bound of <me>. |
93 | ---Category: Inquire methods |
94 | |
95 | Next ( me : in out ) |
96 | returns Integer from Standard |
97 | ---Level: Internal |
98 | ---Purpose: Returns an available identifier of <me>. |
99 | -- Warning: Raises IdentDefinitionError if all identifiers are busy. |
100 | raises IdentDefinitionError from Aspect; |
101 | |
102 | Upper ( me ) |
103 | returns Integer from Standard; |
104 | ---Level: Internal |
105 | ---Purpose: Returns the upper bound of <me>. |
106 | ---Category: Inquire methods |
107 | |
108 | --\f |
109 | |
110 | fields |
111 | |
112 | -- |
113 | -- Class : Aspect_GenId |
114 | -- |
115 | -- Purpose : Declaration of variables specific to identifiers |
116 | -- |
117 | -- Reminder : An identifier is an integer |
118 | -- |
119 | |
120 | -- the current number of available identifiers |
121 | MyCount : Integer from Standard; |
122 | |
123 | -- the number of identifiers |
124 | MyLength : Integer from Standard; |
125 | |
126 | -- the limits for identifiers |
127 | MyLowerBound : Integer from Standard; |
128 | MyUpperBound : Integer from Standard; |
129 | |
130 | -- to save free identifiers |
131 | MyFreeIds : ListOfInteger from TColStd; |
132 | |
133 | end GenId; |