0023952: Improving thread-safety of intersections, approximations and other modeling...
[occt.git] / src / IntTools / IntTools_CArray1.cdl
CommitLineData
b311480e 1-- Created on: 2000-05-26
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.
7fd59977 19
20
b311480e 21
22---Purpose:
7fd59977 23
24generic class CArray1 from IntTools (Array1Item as any)
25
26 ---Purpose: The class CArray1 represents unidimensionnal arrays
27 -- of fixed size known at run time. Run-time boundary
28 -- check is performed
29 --
30 -- The range of the index is user defined from 0 to Length
31
32raises
33
34 ConstructionError from Standard,
35 OutOfRange from Standard,
36 OutOfMemory from Standard
37
38is
39
40 Create (Length: Integer from Standard = 0)
41 returns CArray1 from IntTools
42 ---Purpose:
43 --- Creates an array of given Length.
44 ---
45 raises
46 ConstructionError from Standard, -- when Length < 0
47 OutOfMemory from Standard; -- when not enough memory
48
49 Create (AnArray : CArray1 from IntTools)
50 returns CArray1 from IntTools
51 ---Purpose:
52 --- Prohibits the creator by copy
53 ---
54 is private;
55
56 Create(Item: Array1Item;
57 Length: Integer from Standard)
58 ---Purpose:
59 --- Creates an array sharing datas with an other.
60 -- Example:
61 --- Item tab[100];
62 --- CArray1OfItem thetab (tab[0],100);
63 ---
64 --- CArray1OfItem aArray1(100);
65 --- CArray1OfItem anSharedArray1(aArray1.ChangeValue(0),aArray1.Length());
66 ---
67 -- Warning:
68 --- The validity of length are under the responsability
69 --- of the user.
70 --- The sahred array must have a valid address during the life of
71 --- the Array1.
72 ---
73 returns CArray1 from IntTools
74 raises ConstructionError from Standard; -- when Length < 0
75
76 Init (me: in out; V: Array1Item);
77 ---Purpose:
78 --- Initializes the array with a given value.
79 ---
80
81
82 Resize(me: in out;
83 theNewLength: Integer from Standard);
84 ---Purpose:
85 --- destroy current content and realloc the new size
86 --- does nothing if Length() == theLength
87 ---
88
89 Destroy (me: in out);
90 ---Purpose:
91 --- Frees the allocated area corresponding to the
92 --- array.
93 ---
94 ---C++: alias ~
95
96 Length (me) returns Integer from Standard;
97 ---Purpose:
98 --- Returns the number of elements of <me>.
99 ---
100 ---C++: inline
101
102 Append (me:out; Value: Array1Item);
103 ---Purpose:
104
105 SetValue (me : out; Index: Integer from Standard; Value: Array1Item)
106 raises OutOfRange from Standard;
107 ---Purpose:
108 --- Sets the <Index>th element of the array to
109 --- <Value>.
110 ---
111
112
113 Value (me; Index:Integer from Standard) returns any Array1Item
114 ---Purpose:
115 --- Returns the value of the <Index>th element of the
116 --- array.
117 ---
118 ---C++: alias operator ()
119 ---C++: return const &
120 raises OutOfRange from Standard;
121
122 ChangeValue (me: in out; Index:Integer from Standard) returns any Array1Item
123 ---Purpose:
124 --- Returns the value of the <Index>th element of the
125 --- array.
126 ---
127 ---C++: alias operator ()
128 ---C++: return &
129 raises OutOfRange from Standard;
130
131 IsEqual(me; Other: CArray1 from IntTools)
132 returns Boolean from Standard;
133 ---Purpose:
134 --- Applys the == operator on each array item
135 ---
136 ---C++: alias operator ==
137
138fields
139
140 myStart: Address;
141 myLength: Integer;
142 myIsAllocated: Boolean;
143
144end CArray1;
145
146
147