b311480e |
1 | -- Created on: 1996-12-16 |
2 | -- Created by: Christian CAILLET |
3 | -- Copyright (c) 1996-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
8 | -- This library is free software; you can redistribute it and/or modify it under |
9 | -- the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | -- by the Free Software Foundation, with special exception defined in the file |
11 | -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | -- distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | class Field from StepData |
18 | |
19 | ---Purpose : Defines a generally defined Field for STEP data : can be used |
20 | -- either in any kind of entity to implement it or in free format |
21 | -- entities in a "late-binding" mode |
22 | -- A field can have : no value (or derived), a single value of |
23 | -- any kind, a list of value : single or double list |
24 | -- |
25 | -- When a field is set, this defines its new kind (Integer etc..) |
26 | -- A single value is immediately set. A list of value is, firstly |
27 | -- declared as for a kind (Integer String etc), then declared as |
28 | -- a list with its initial size, after this its items are set |
29 | -- Also it can be set in once if the HArray is ready |
30 | |
31 | uses Transient, HAsciiString, CString, |
32 | HArray1OfInteger from TColStd, HArray1OfReal from TColStd, |
33 | HArray1OfTransient from TColStd, HArray1OfHAsciiString from Interface, |
34 | Logical from StepData, SelectMember from StepData |
35 | |
36 | is |
37 | |
38 | Create returns Field; |
39 | ---Purpose : Creates a Field, empty ("no value defined") |
40 | |
41 | Create (other : Field; copy : Boolean = Standard_False) returns Field; |
42 | ---Purpose : Creates a Field from another one. If <copy> is True, Handled |
43 | -- data (Select,String,List, not entities) are copied |
44 | |
45 | CopyFrom (me : in out; other : Field); |
46 | ---Purpose : Gets the copy of the values of another field |
47 | |
48 | Clear (me : in out; kind : Integer = 0); |
49 | ---Purpose : Clears the field, to set it as "no value defined" |
50 | -- Just before SetList, predeclares it as "any" |
51 | -- A Kind can be directly set here to declare a type |
52 | |
53 | -- Setting a Single Value, or predeclaring a list |
54 | |
55 | SetDerived (me : in out); |
56 | ---Purpose : Codes a Field as derived (no proper value) |
57 | |
58 | SetInt (me : in out; val : Integer); |
59 | ---Purpose : Directly sets the Integer value, if its Kind matches |
60 | -- Integer, Boolean, Logical, or Enum (does not change Kind) |
61 | |
62 | SetInteger (me : in out; val : Integer = 0); |
63 | ---Purpose : Sets an Integer value (before SetList* declares it as Integer) |
64 | |
65 | SetBoolean (me : in out; val : Boolean = Standard_False); |
66 | ---Purpose : Sets a Boolean value (or predeclares a list as boolean) |
67 | |
68 | SetLogical (me : in out; val : Logical = StepData_LFalse); |
69 | ---Purpose : Sets a Logical Value (or predeclares a list as logical) |
70 | |
71 | SetReal (me : in out; val : Real = 0.0); |
72 | ---Purpose : Sets a Real Value (or predeclares a list as Real); |
73 | |
74 | SetString (me : in out; val : CString = ""); |
75 | ---Purpose : Sets a String Value (or predeclares a list as String) |
76 | -- Does not redefine the Kind if it is alread String or Enum |
77 | |
78 | SetEnum (me : in out; val : Integer = -1; text : CString = ""); |
79 | ---Purpose : Sets an Enum Value (as its integer counterpart) |
80 | -- (or predeclares a list as Enum) |
81 | -- If <text> is given , also sets its textual expression |
82 | -- <val> negative means unknown (known values begin at 0) |
83 | |
84 | SetSelectMember (me : in out; val : SelectMember); |
85 | ---Purpose : Sets a SelectMember (for Integer,Boolean,Enum,Real,Logical) |
86 | -- Hence, the value of the field is accessed through this member |
87 | |
88 | SetEntity (me : in out; val : Transient); |
89 | ---Purpose : Sets an Entity Value |
90 | |
91 | SetEntity (me : in out); |
92 | ---Purpose : Predeclares a list as of entity |
93 | |
94 | SetList (me : in out; size : Integer; first : Integer = 1); |
95 | ---Purpose : Declares a field as a list, with an initial size |
96 | -- Initial lower is defaulted as 1, can be defined |
97 | -- The list starts empty, typed by the last Set* |
98 | -- If no Set* before, sets it as "any" (transient/select) |
99 | |
100 | SetList2 (me : in out; siz1, siz2 : Integer; f1,f2 : Integer = 1); |
101 | ---Purpose : Declares a field as an homogeneous square list, with initial\ |
102 | -- sizes, and initial lowers |
103 | |
104 | Set (me : in out; val : Transient); |
105 | ---Purpose : Sets an undetermined value : can be String, SelectMember, |
106 | -- HArray(1-2) ... else, an Entity |
107 | -- In case of an HArray, determines and records its size(s) |
108 | |
109 | -- Setting List Items : Single List |
110 | |
111 | ClearItem (me : in out; num : Integer); |
112 | ---Purpose : Declares an item of the list as undefined |
113 | -- (ignored if list not defined as String,Entity or Any) |
114 | |
115 | SetInt (me : in out; num : Integer; val : Integer; kind : Integer); |
116 | ---Purpose : Internal access to an Integer Value for a list, plus its kind |
117 | |
118 | SetInteger (me : in out; num : Integer; val : Integer); |
119 | ---Purpose : Sets an Integer Value for a list (rank num) |
120 | -- (recognizes a SelectMember) |
121 | |
122 | SetBoolean (me : in out; num : Integer; val : Boolean); |
123 | |
124 | SetLogical (me : in out; num : Integer; val : Logical); |
125 | |
126 | SetEnum (me : in out; num : Integer; val : Integer; text: CString = ""); |
127 | ---Purpose : Sets an Enum Value (Integer counterpart), also its text |
128 | -- expression if known (if list has been set as "any") |
129 | |
130 | SetReal (me : in out; num : Integer; val : Real); |
131 | |
132 | SetString (me : in out; num : Integer; val : CString); |
133 | |
134 | SetEntity (me : in out; num : Integer; val : Transient); |
135 | |
136 | -- Quering Value |
137 | -- For a Single field, n1 and n2 are ignored |
138 | -- For a Single List, n1 is considered and n2 is ignored |
139 | |
140 | IsSet (me; n1, n2 : Integer = 1) returns Boolean; |
141 | |
142 | ItemKind (me; n1, n2 : Integer = 1) returns Integer; |
143 | ---Purpose : Returns the kind of an item in a list or double list |
144 | -- It is the kind of the list, except if it is "Any", in such a |
145 | -- case the true kind is determined and returned |
146 | |
147 | Kind (me; type : Boolean = Standard_True) returns Integer; -- enum ? |
148 | ---Purpose : Returns the kind of the field |
149 | -- <type> True (D) : returns only the type itself |
150 | -- else, returns the complete kind |
151 | |
152 | Arity (me) returns Integer; -- 0:single 1:list 2:list2 |
153 | |
154 | Length (me; index : Integer = 1) returns Integer; -- for index 1 or 2 |
155 | -- True Length, not simply the reserved one |
156 | |
157 | Lower (me; index : Integer = 1) returns Integer; -- for index 1 or 2 |
158 | |
159 | -- Single : |
160 | |
161 | Int (me) returns Integer; -- the field Integer itself |
162 | |
163 | Integer (me; n1, n2 : Integer = 1) returns Integer; |
164 | |
165 | Boolean (me; n1, n2 : Integer = 1) returns Boolean; |
166 | |
167 | Logical (me; n1, n2 : Integer = 1) returns Logical; |
168 | |
169 | Real (me; n1, n2 : Integer = 1) returns Real; |
170 | |
171 | String (me; n1, n2 : Integer = 1) returns CString; |
172 | |
173 | Enum (me; n1, n2 : Integer = 1) returns Integer; |
174 | |
175 | EnumText (me; n1, n2 : Integer = 1) returns CString; -- "" if unknown |
176 | |
177 | Entity (me; n1, n2 : Integer = 1) returns Transient; |
178 | |
179 | Transient (me) returns Transient; -- the fields itself |
180 | |
181 | fields |
182 | |
183 | thekind : Integer; |
184 | theint : Integer; |
185 | thereal : Real; |
186 | theany : Transient; |
187 | |
188 | end Field; |