Commit | Line | Data |
---|---|---|
b311480e | 1 | -- Created on: 2000-11-14 |
2 | -- Created by: Peter KURNEV | |
3 | -- Copyright (c) 2000-2012 OPEN CASCADE SAS | |
4 | -- | |
5 | -- The content of this file is subject to the Open CASCADE Technology Public | |
6 | -- License Version 6.5 (the "License"). You may not use the content of this file | |
7 | -- except in compliance with the License. Please obtain a copy of the License | |
8 | -- at http://www.opencascade.org and read it completely before using this file. | |
9 | -- | |
10 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its | |
11 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. | |
12 | -- | |
13 | -- The Original Code and all software distributed under the License is | |
14 | -- distributed on an "AS IS" basis, without warranty of any kind, and the | |
15 | -- Initial Developer hereby disclaims all such warranties, including without | |
16 | -- limitation, any warranties of merchantability, fitness for a particular | |
17 | -- purpose or non-infringement. Please see the License for the specific terms | |
18 | -- and conditions governing the rights and limitations under the License. | |
19 | ||
7fd59977 | 20 | |
21 | generic class CArray1 from BOPTColStd (Array1Item as any) | |
22 | ||
23 | ---Purpose: | |
24 | -- The class CArray1 represents unidimensionnal arrays | |
25 | -- of fixed size known at run time. Run-time boundary | |
26 | -- check is performed | |
27 | -- The range of the index is user defined from 0 to Length-1 | |
28 | ||
29 | raises | |
30 | OutOfRange from Standard, | |
31 | OutOfMemory from Standard | |
32 | ||
33 | is | |
34 | ||
35 | Create (Length : Integer from Standard = 0; | |
36 | BlockLength : Integer from Standard = 5) | |
37 | returns CArray1 from BOPTColStd | |
38 | raises OutOfMemory from Standard; | |
39 | ---Purpose: | |
40 | -- Creates an array of given Length. | |
41 | -- | |
42 | Create (AnArray : CArray1 from BOPTColStd) | |
43 | returns CArray1 from BOPTColStd | |
44 | is private; | |
45 | ---Purpose: | |
46 | -- Prohibits the creator by copy | |
47 | -- | |
251450e5 P |
48 | Assign (me:out; Other : |
49 | CArray1 from BOPTColStd) | |
7fd59977 | 50 | returns CArray1 from BOPTColStd |
51 | is private; | |
52 | ---C++: alias operator = | |
53 | ---C++: return & | |
54 | ---Purpose: | |
55 | -- Prohibits the operator = | |
56 | -- | |
251450e5 P |
57 | Resize(me: in out; |
58 | theNewLength: Integer from Standard); | |
7fd59977 | 59 | ---Purpose: |
60 | -- destroy current content and realloc the new size | |
61 | -- | |
62 | Destroy (me: in out); | |
63 | ---C++: alias ~ | |
64 | ---Purpose: | |
65 | -- Frees the allocated area corresponding to the | |
66 | -- array. | |
67 | -- | |
251450e5 P |
68 | Length (me) |
69 | returns Integer from Standard; | |
7fd59977 | 70 | ---Purpose: |
71 | -- Returns the number of elements of <me> | |
72 | -- | |
251450e5 P |
73 | Extent (me) |
74 | returns Integer from Standard; | |
7fd59977 | 75 | ---Purpose: |
76 | -- The same as Length(). | |
77 | --- | |
251450e5 P |
78 | FactLength (me) |
79 | returns Integer from Standard; | |
7fd59977 | 80 | ---Purpose: |
81 | -- Returns the number of elements of <me>. | |
82 | --- | |
251450e5 P |
83 | Append (me:out; |
84 | Value: Array1Item) | |
7fd59977 | 85 | returns Integer from Standard |
86 | raises OutOfMemory from Standard; | |
87 | ---Purpose: | |
88 | -- Remove the Item[Index] from the array. | |
89 | --- | |
251450e5 P |
90 | Remove (me:out; |
91 | Index:Integer from Standard) | |
7fd59977 | 92 | raises OutOfMemory from Standard; |
93 | ---Purpose: | |
94 | -- Appends the Value at the end of me | |
95 | --- | |
251450e5 P |
96 | Value (me; |
97 | Index:Integer from Standard) | |
98 | returns any Array1Item | |
7fd59977 | 99 | ---C++: alias operator () |
100 | ---C++: return const & | |
101 | raises OutOfRange from Standard; | |
102 | ---Purpose: | |
103 | -- Return the value of the <Index>th element of the | |
104 | -- array. | |
105 | -- | |
106 | ||
251450e5 P |
107 | ChangeValue (me: in out; |
108 | Index:Integer from Standard) | |
109 | returns any Array1Item | |
7fd59977 | 110 | ---C++: alias operator () |
111 | ---C++: return & | |
112 | raises OutOfRange from Standard; | |
113 | ---Purpose: | |
114 | -- Returns the value of the Index-th element of the | |
115 | -- array. | |
116 | ||
251450e5 P |
117 | SetBlockLength(me:out; |
118 | aBL: Integer from Standard); | |
7fd59977 | 119 | ---Purpose: |
120 | -- Sets the size of the allocated block | |
121 | --- | |
122 | BlockLength(me) | |
123 | returns Integer from Standard; | |
124 | ---Purpose: | |
125 | -- Returns the current size of the allocated block | |
251450e5 P |
126 | --- |
127 | IsInvalidIndex (me; | |
128 | Index:Integer from Standard) | |
7fd59977 | 129 | returns Boolean from Standard |
130 | is private; | |
131 | ---Purpose: | |
132 | -- Checks the input value of an Index for validity in | |
133 | -- array. | |
251450e5 P |
134 | |
135 | --modified by NIZNHY-PKV Wed Nov 09 09:32:13 2011f | |
136 | Purge(me:out); | |
137 | ---Purpose: | |
138 | -- Release the memory that is allocated but unused. | |
139 | -- | |
140 | --modified by NIZNHY-PKV Wed Nov 09 09:32:16 2011t | |
141 | ||
7fd59977 | 142 | fields |
7fd59977 | 143 | myStart : Address; |
144 | myLength : Integer; | |
145 | myFactLength : Integer; | |
146 | myBlockLength: Integer; | |
147 | myIsAllocated: Boolean; | |
148 | ||
149 | ||
150 | end CArray1; |