b311480e |
1 | -- Created on: 2000-05-26 |
2 | -- Created by: Peter KURNEV |
973c2be1 |
3 | -- Copyright (c) 2000-2014 OPEN CASCADE SAS |
b311480e |
4 | -- |
973c2be1 |
5 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
6 | -- |
d5f74e42 |
7 | -- This library is free software; you can redistribute it and/or modify it under |
8 | -- the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | -- by the Free Software Foundation, with special exception defined in the file |
10 | -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | -- distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
12 | -- |
973c2be1 |
13 | -- Alternatively, this file may be used under the terms of Open CASCADE |
14 | -- commercial license or contractual agreement. |
b311480e |
15 | |
16 | ---Purpose: |
7fd59977 |
17 | |
18 | generic class CArray1 from IntTools (Array1Item as any) |
19 | |
20 | ---Purpose: The class CArray1 represents unidimensionnal arrays |
21 | -- of fixed size known at run time. Run-time boundary |
22 | -- check is performed |
23 | -- |
24 | -- The range of the index is user defined from 0 to Length |
25 | |
26 | raises |
27 | |
28 | ConstructionError from Standard, |
29 | OutOfRange from Standard, |
30 | OutOfMemory from Standard |
31 | |
32 | is |
33 | |
34 | Create (Length: Integer from Standard = 0) |
35 | returns CArray1 from IntTools |
36 | ---Purpose: |
37 | --- Creates an array of given Length. |
38 | --- |
39 | raises |
40 | ConstructionError from Standard, -- when Length < 0 |
41 | OutOfMemory from Standard; -- when not enough memory |
42 | |
43 | Create (AnArray : CArray1 from IntTools) |
44 | returns CArray1 from IntTools |
45 | ---Purpose: |
46 | --- Prohibits the creator by copy |
47 | --- |
48 | is private; |
49 | |
50 | Create(Item: Array1Item; |
51 | Length: Integer from Standard) |
52 | ---Purpose: |
53 | --- Creates an array sharing datas with an other. |
54 | -- Example: |
55 | --- Item tab[100]; |
56 | --- CArray1OfItem thetab (tab[0],100); |
57 | --- |
58 | --- CArray1OfItem aArray1(100); |
59 | --- CArray1OfItem anSharedArray1(aArray1.ChangeValue(0),aArray1.Length()); |
60 | --- |
61 | -- Warning: |
62 | --- The validity of length are under the responsability |
63 | --- of the user. |
64 | --- The sahred array must have a valid address during the life of |
65 | --- the Array1. |
66 | --- |
67 | returns CArray1 from IntTools |
68 | raises ConstructionError from Standard; -- when Length < 0 |
69 | |
70 | Init (me: in out; V: Array1Item); |
71 | ---Purpose: |
72 | --- Initializes the array with a given value. |
73 | --- |
74 | |
75 | |
76 | Resize(me: in out; |
77 | theNewLength: Integer from Standard); |
78 | ---Purpose: |
79 | --- destroy current content and realloc the new size |
80 | --- does nothing if Length() == theLength |
81 | --- |
82 | |
83 | Destroy (me: in out); |
84 | ---Purpose: |
85 | --- Frees the allocated area corresponding to the |
86 | --- array. |
87 | --- |
88 | ---C++: alias ~ |
89 | |
90 | Length (me) returns Integer from Standard; |
91 | ---Purpose: |
92 | --- Returns the number of elements of <me>. |
93 | --- |
94 | ---C++: inline |
95 | |
96 | Append (me:out; Value: Array1Item); |
97 | ---Purpose: |
98 | |
99 | SetValue (me : out; Index: Integer from Standard; Value: Array1Item) |
100 | raises OutOfRange from Standard; |
101 | ---Purpose: |
102 | --- Sets the <Index>th element of the array to |
103 | --- <Value>. |
104 | --- |
105 | |
106 | |
107 | Value (me; Index:Integer from Standard) returns any Array1Item |
108 | ---Purpose: |
109 | --- Returns the value of the <Index>th element of the |
110 | --- array. |
111 | --- |
112 | ---C++: alias operator () |
113 | ---C++: return const & |
114 | raises OutOfRange from Standard; |
115 | |
116 | ChangeValue (me: in out; Index:Integer from Standard) returns any Array1Item |
117 | ---Purpose: |
118 | --- Returns the value of the <Index>th element of the |
119 | --- array. |
120 | --- |
121 | ---C++: alias operator () |
122 | ---C++: return & |
123 | raises OutOfRange from Standard; |
124 | |
125 | IsEqual(me; Other: CArray1 from IntTools) |
126 | returns Boolean from Standard; |
127 | ---Purpose: |
128 | --- Applys the == operator on each array item |
129 | --- |
130 | ---C++: alias operator == |
131 | |
132 | fields |
133 | |
134 | myStart: Address; |
135 | myLength: Integer; |
136 | myIsAllocated: Boolean; |
137 | |
138 | end CArray1; |
139 | |
140 | |
141 | |