7fd59977 |
1 | -- File: UndefinedContent.cdl |
2 | -- Created: Tue Feb 4 13:56:27 1992 |
3 | -- Author: Christian CAILLET |
4 | -- <cky@phobox> |
5 | ---Copyright: Matra Datavision 1992 |
6 | |
7 | |
8 | class UndefinedContent from Interface inherits TShared |
9 | |
10 | ---Purpose : Defines resources for an "Undefined Entity" : such an Entity |
11 | -- is used to describe an Entity which complies with the Norm, |
12 | -- but of an Unknown Type : hence it is kept under a literal |
13 | -- form (avoiding to loose data). UndefinedContent offers a way |
14 | -- to store a list of Parameters, as literals or references to |
15 | -- other Entities |
16 | -- |
17 | -- Each Interface must provide one "UndefinedEntity", which must |
18 | -- have same basic description as all its types of entities : |
19 | -- the best way would be double inheritance : on the Entity Root |
20 | -- of the Norm and on an general "UndefinedEntity" |
21 | -- |
22 | -- While it is not possible to do so, the UndefinedEntity of each |
23 | -- Interface can define its own UndefinedEntity by INCLUDING |
24 | -- (in a field) this UndefinedContent |
25 | -- |
26 | -- Hence, for that UndefinedEntity, define a Constructor which |
27 | -- creates this UndefinedContent, plus access methods to it |
28 | -- (or to its data, calling methods defined here). |
29 | -- |
30 | -- Finally, the Protocols of each norm have to Create and |
31 | -- Recognize Unknown Entities of this norm |
32 | ---See Also : Protocol |
33 | |
34 | uses Transient, HAsciiString from TCollection, |
35 | HArray1OfInteger from TColStd, HArray1OfHAsciiString from Interface, |
36 | ParamType, EntityList, CopyTool |
37 | |
38 | raises OutOfRange, NoSuchObject, InterfaceMismatch, InterfaceError |
39 | |
40 | is |
41 | |
42 | Create returns mutable UndefinedContent; |
43 | ---Purpose : Defines an empty UndefinedContent |
44 | |
45 | -- -- Access to Parameters -- -- |
46 | |
47 | NbParams (me) returns Integer is static; |
48 | ---Purpose : Gives count of recorded parameters |
49 | |
50 | NbLiterals (me) returns Integer is static; |
51 | ---Purpose : Gives count of Literal Parameters |
52 | |
53 | ParamData (me; num : Integer; ptype : out ParamType; |
54 | ent : out mutable Transient; |
55 | val : out HAsciiString from TCollection) |
56 | returns Boolean is static; |
57 | ---Purpose : Returns data of a Parameter : its type, and the entity if it |
58 | -- designates en entity ("ent") or its literal value else ("str") |
59 | -- Returned value (Boolean) : True if it is an Entity, False else |
60 | |
61 | ParamType (me; num : Integer) returns ParamType |
62 | raises OutOfRange is static; |
63 | ---Purpose : Returns the ParamType of a Param, given its rank |
64 | -- Error if num is not between 1 and NbParams |
65 | |
66 | IsParamEntity (me; num : Integer) returns Boolean |
67 | raises OutOfRange is static; |
68 | ---Purpose : Returns True if a Parameter is recorded as an entity |
69 | -- Error if num is not between 1 and NbParams |
70 | |
71 | ParamEntity (me; num : Integer) returns mutable Transient |
72 | ---Purpose : Returns Entity corresponding to a Param, given its rank |
73 | raises InterfaceError, OutOfRange is static; |
74 | -- Error if out of range or if Param num does not designate |
75 | -- an Entity |
76 | |
77 | ParamValue (me; num : Integer) returns HAsciiString from TCollection |
78 | ---Purpose : Returns litteral value of a Parameter, given its rank |
79 | raises InterfaceError, OutOfRange is static; |
80 | -- Error if num is out of range, or if Parameter is not literal |
81 | |
82 | |
83 | Reservate (me : mutable; nb,nblit : Integer) is static; |
84 | ---Purpose : Manages reservation for parameters (internal use) |
85 | -- (nb : total count of parameters, nblit : count of literals) |
86 | |
87 | AddLiteral (me : mutable; ptype : ParamType; |
88 | val : HAsciiString from TCollection) is static; |
89 | ---Purpose : Adds a literal Parameter to the list |
90 | |
91 | AddEntity (me : mutable; ptype : ParamType; ent : mutable Transient) |
92 | is static; |
93 | ---Purpose : Adds a Parameter which references an Entity |
94 | |
95 | RemoveParam (me : mutable; num : Integer) |
96 | ---Purpose : Removes a Parameter given its rank |
97 | raises OutOfRange is static; |
98 | -- Error if num is out of range |
99 | |
100 | SetLiteral (me : mutable; num : Integer; ptype : ParamType; |
101 | val : HAsciiString from TCollection) |
102 | ---Purpose : Sets a new value for the Parameter <num>, to a literal value |
103 | -- (if it referenced formerly an Entity, this Entity is removed) |
104 | raises OutOfRange is static; |
105 | -- Error if num is out of range |
106 | |
107 | SetEntity (me : mutable; num : Integer; ptype : ParamType; |
108 | ent : mutable Transient) |
109 | ---Purpose : Sets a new value for the Parameter <num>, to reference an |
110 | -- Entity. To simply change the Entity, see the variant below |
111 | raises OutOfRange is static; |
112 | -- Error if num is out of range |
113 | |
114 | SetEntity (me : mutable; num : Integer; ent : mutable Transient) |
115 | ---Purpose : Changes the Entity referenced by the Parameter <num> |
116 | -- (with same ParamType) |
117 | raises InterfaceError, OutOfRange is static; |
118 | -- Error if num is out of range or if <num> is not for an Entity |
119 | |
120 | |
121 | EntityList (me) returns EntityList is static; |
122 | ---Purpose : Returns globally the list of param entities. Note that it can |
123 | -- be used as shared entity list for the UndefinedEntity |
124 | |
125 | |
126 | GetFromAnother (me : mutable; |
127 | other : UndefinedContent; TC : in out CopyTool) |
128 | is static; |
129 | ---Purpose : Copies contents of undefined entities; deigned to be called by |
130 | -- GetFromAnother method from Undefined entity of each Interface |
131 | -- (the basic operation is the same regardless the norm) |
132 | |
133 | fields |
134 | |
135 | thenbparams : Integer; -- total count of parameters |
136 | thenbstr : Integer; -- count of literal parameters |
137 | theparams : HArray1OfInteger from TColStd; |
138 | thevalues : HArray1OfHAsciiString from Interface; |
139 | theentities : EntityList; |
140 | |
141 | end UndefinedContent; |