7fd59977 |
1 | -- File: DBC_VArray.cdl |
2 | -- Created: Mon Jan 30 10:15:00 1996 |
3 | -- Author: Kernel |
4 | -- <kernel@ylliox> |
5 | ---Copyright: Matra Datavision 1996 |
6 | |
7 | generic class VArray from DBC (Item as Storable) inherits BaseArray from DBC |
8 | |
9 | ---Purpose: The class VArray represents a unidimensional |
10 | -- array of fixed size known at execution time. |
11 | -- The range of the element is user defined and varies |
12 | -- from 0 to N - 1. |
13 | -- Warning: Programs client of such a class must be independant |
14 | -- of the range of the last element. Thus, a C++ "for" |
15 | -- loop must be written like this |
16 | -- |
17 | -- for (i = 0; i < A.Size(); i++) |
18 | -- Implement for ObjectStore and Objectivity |
19 | -- with the same functionnality |
20 | -- Purpose: New development for OBJY 3.5 |
21 | |
22 | uses |
23 | BaseArray from DBC |
24 | |
25 | raises NegativeValue, OutOfRange , DimensionMismatch, NullObject |
26 | |
27 | class VArrayNode from DBC |
28 | inherits ArrayNode from PStandard |
29 | is |
30 | |
31 | Create returns mutable VArrayNode from DBC; |
32 | Create(aValue : Item) returns mutable VArrayNode from DBC; |
33 | |
34 | SetValue(me : mutable; aValue : Item); |
35 | Value(me) returns Address from Standard; |
36 | |
37 | fields |
38 | myValue : Item; |
39 | end; |
40 | |
41 | ---Purpose: for DFLT profile, we dont need persistent nodes |
42 | class VArrayTNode from DBC |
43 | is |
44 | Create returns VArrayTNode from DBC; |
45 | ---C++: inline |
46 | Create(aValue : Item) returns VArrayTNode from DBC; |
47 | ---C++: inline |
48 | SetValue(me : out; aValue : Item); |
49 | ---C++: inline |
50 | Value(me) returns Address from Standard; |
51 | ---C++: inline |
52 | |
53 | fields |
54 | myValue : Item; |
55 | end; |
56 | |
57 | is |
58 | |
59 | Create returns VArray; |
60 | ---Puspose: Creates an array of null size |
61 | -- Raise NullOject if there is no |
62 | -- default database |
63 | |
64 | Create (Size: Integer) returns VArray |
65 | ---Purpose: Creates an array of lower bound 0 and |
66 | -- upper bound <Size>-1 . NegativeValue is raised |
67 | -- when <Size> is less than 0. |
68 | raises NegativeValue; |
69 | |
70 | Create (Varray: VArray) returns VArray; |
71 | ---Purpose: Creates an array which is the copy of the given |
72 | -- argument. |
73 | |
74 | |
75 | Resize (me : in out; Size: Integer) |
76 | raises NegativeValue; |
77 | ---Purpose: Change the size of an array with lower |
78 | -- bound 0 and upper bound <Size>-1 . NegativeValue |
79 | -- is raised when <Size> is less than 0. |
80 | |
81 | Assign (me: in out; Other: VArray from DBC) |
82 | ---Purpose: copy the contents of <Other> into <me>. |
83 | -- <Other> and <me> must have the same dimension. |
84 | ---C++: alias operator = |
85 | raises DimensionMismatch from Standard |
86 | is static; |
87 | |
88 | SetValue (me : in out; Index: Integer; Value: Item) |
89 | ---Purpose: Sets the <Index>th element of the array |
90 | -- to <Value>. |
91 | raises OutOfRange |
92 | is static ; |
93 | |
94 | |
95 | Value (me; Index: Integer) returns Item |
96 | ---Purpose: Returns the value of the <Index>th element |
97 | -- of the array. |
98 | ---C++: alias operator () |
99 | ---C++: return & |
100 | raises OutOfRange |
101 | is static; |
102 | |
103 | Destroy(me : in out); |
104 | ---C++: alias ~ |
105 | |
106 | end VArray ; |