1 -- Created on: 1996-12-16
2 -- Created by: Christian CAILLET
3 -- Copyright (c) 1996-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
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
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 class Field from StepData
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
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
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
39 ---Purpose : Creates a Field, empty ("no value defined")
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
45 CopyFrom (me : in out; other : Field);
46 ---Purpose : Gets the copy of the values of another field
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
53 -- Setting a Single Value, or predeclaring a list
55 SetDerived (me : in out);
56 ---Purpose : Codes a Field as derived (no proper value)
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)
62 SetInteger (me : in out; val : Integer = 0);
63 ---Purpose : Sets an Integer value (before SetList* declares it as Integer)
65 SetBoolean (me : in out; val : Boolean = Standard_False);
66 ---Purpose : Sets a Boolean value (or predeclares a list as boolean)
68 SetLogical (me : in out; val : Logical = StepData_LFalse);
69 ---Purpose : Sets a Logical Value (or predeclares a list as logical)
71 SetReal (me : in out; val : Real = 0.0);
72 ---Purpose : Sets a Real Value (or predeclares a list as Real);
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
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)
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
88 SetEntity (me : in out; val : Transient);
89 ---Purpose : Sets an Entity Value
91 SetEntity (me : in out);
92 ---Purpose : Predeclares a list as of entity
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)
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
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)
109 -- Setting List Items : Single List
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)
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
118 SetInteger (me : in out; num : Integer; val : Integer);
119 ---Purpose : Sets an Integer Value for a list (rank num)
120 -- (recognizes a SelectMember)
122 SetBoolean (me : in out; num : Integer; val : Boolean);
124 SetLogical (me : in out; num : Integer; val : Logical);
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")
130 SetReal (me : in out; num : Integer; val : Real);
132 SetString (me : in out; num : Integer; val : CString);
134 SetEntity (me : in out; num : Integer; val : Transient);
137 -- For a Single field, n1 and n2 are ignored
138 -- For a Single List, n1 is considered and n2 is ignored
140 IsSet (me; n1, n2 : Integer = 1) returns Boolean;
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
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
152 Arity (me) returns Integer; -- 0:single 1:list 2:list2
154 Length (me; index : Integer = 1) returns Integer; -- for index 1 or 2
155 -- True Length, not simply the reserved one
157 Lower (me; index : Integer = 1) returns Integer; -- for index 1 or 2
161 Int (me) returns Integer; -- the field Integer itself
163 Integer (me; n1, n2 : Integer = 1) returns Integer;
165 Boolean (me; n1, n2 : Integer = 1) returns Boolean;
167 Logical (me; n1, n2 : Integer = 1) returns Logical;
169 Real (me; n1, n2 : Integer = 1) returns Real;
171 String (me; n1, n2 : Integer = 1) returns CString;
173 Enum (me; n1, n2 : Integer = 1) returns Integer;
175 EnumText (me; n1, n2 : Integer = 1) returns CString; -- "" if unknown
177 Entity (me; n1, n2 : Integer = 1) returns Transient;
179 Transient (me) returns Transient; -- the fields itself