f995bb3d142e6bcb8dd40003cf23f0fe677f92da
[occt.git] / src / TCollection / TCollection_HArray1.cdl
1 -- Copyright (c) 1998-1999 Matra Datavision
2 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
3 --
4 -- The content of this file is subject to the Open CASCADE Technology Public
5 -- License Version 6.5 (the "License"). You may not use the content of this file
6 -- except in compliance with the License. Please obtain a copy of the License
7 -- at http://www.opencascade.org and read it completely before using this file.
8 --
9 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11 --
12 -- The Original Code and all software distributed under the License is
13 -- distributed on an "AS IS" basis, without warranty of any kind, and the
14 -- Initial Developer hereby disclaims all such warranties, including without
15 -- limitation, any warranties of merchantability, fitness for a particular
16 -- purpose or non-infringement. Please see the License for the specific terms
17 -- and conditions governing the rights and limitations under the License.
18
19 generic class HArray1 from TCollection 
20     (ItemHArray1 as any; 
21      TheArray1 as Array1 from TCollection(ItemHArray1))
22
23 inherits TShared
24
25 raises  RangeError from Standard,
26         DimensionMismatch from Standard,
27         OutOfRange from Standard,
28         OutOfMemory from Standard 
29
30         ---Purpose: The class HArray1 represents unidimensionnal arrays 
31         -- of fixed size dynamically dimensioned at construction time.
32         -- As with a C array, the access time to an HArray1 indexed
33         -- item is constant and is independent of the array size.
34         -- Arrays are commonly used as elementary data structures
35         -- for more complex objects.
36         -- HArray1 objects are handles to arrays.
37         -- -   HArray1 arrays may be shared by several objects.
38         -- -   You may use a TCollection_Array1 structure to have the actual array.
39         -- HArray1 is a generic class which depends on two parameters:
40         -- -   Item, the type of element in the array,
41         -- -   Array, the actual type of array handled by HArray1.
42         --   This is an instantiation with Item of the
43         --   TCollection_Array1 generic class.  
44         -- Warning
45         -- HArray1 indexes start and end at a user-defined position.
46         -- Thus, when accessing an item, you must base the index on
47         -- the lower and upper bounds of the array.
48
49
50
51 is
52     
53     Create (Low, Up: Integer from Standard) 
54     returns mutable  HArray1 from TCollection
55         ---Purpose: Creates an array  of lower  bound  <Low> and upper
56         -- bound  <Up>. Range  error is  raised when  <Up> is less than <Low>.
57     raises 
58         RangeError  from Standard,
59         OutOfMemory from Standard;
60         
61     Create (Low, Up: Integer from Standard; V : ItemHArray1) 
62     returns mutable  HArray1 from TCollection
63         ---Purpose: Creates an array  of lower  bound  <Low> and upper
64         -- bound  <Up>. Range  error is  raised when  <Up> is less than <Low>.
65     raises 
66         RangeError  from Standard,
67         OutOfMemory from Standard;
68
69     Init(me : mutable; V : ItemHArray1);
70         ---Purpose: Initialize the array with the value <V>
71
72     Length (me) returns Integer from Standard
73         ---Level: Public
74         ---Purpose: Returns the number of elements of <me>.
75         ---C++: inline
76     is static ;
77
78     Lower (me) returns Integer from Standard
79         ---Level: Public
80         ---Purpose:  Returns the lower bound.
81         ---C++: inline
82     is static ;
83
84     Upper (me) returns Integer from Standard
85         ---Level: Public
86         ---Purpose: Returns the upper bound.
87         ---C++: inline
88     is static ;
89
90
91     SetValue (me : mutable; Index: Integer from Standard; Value: ItemHArray1) 
92         ---Level: Public
93         ---Purpose: Assigns the value <Value> to the <Index>th item of this array.
94     raises 
95         OutOfRange from Standard
96         ---C++: inline
97     is static ;
98
99
100     Value (me; Index:Integer from Standard) returns any ItemHArray1
101         ---Level: Public
102         ---Purpose: Returns the value of the <Index>th element  of the array.
103         ---C++: inline
104         ---C++: return const &
105     raises 
106         OutOfRange from Standard
107     is static ;
108
109     ChangeValue (me : mutable; Index:Integer from Standard) returns any 
110     ItemHArray1
111         ---Level: Public
112         ---Purpose: Returns the value of the <Index>th element  of the array.
113         ---C++: inline
114         ---C++: return &
115     raises 
116         OutOfRange from Standard
117     is static ;
118
119     Array1(me) returns TheArray1
120         ---Purpose: Returns the Array array used as a field by this array;
121         --   the returned array is not modifiable;
122         ---C++: return const &
123         ---C++: inline
124     is static;
125     
126     ChangeArray1(me : mutable) returns TheArray1
127         ---Purpose:   Returns a modifiable reference on the Array array
128         --  used as a field by this array, in order to modify it.
129         ---C++: return &
130         ---C++: inline   
131     is static;
132     
133 fields
134         myArray : TheArray1;
135         
136 end HArray1 ;
137