0024428: Implementation of LGPL license
[occt.git] / src / StepData / StepData_SelectType.cdl
1 -- Created on: 1993-03-26
2 -- Created by: Christian CAILLET
3 -- Copyright (c) 1993-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
5 --
6 -- This file is part of Open CASCADE Technology software library.
7 --
8 -- This library is free software; you can redistribute it and / or modify it
9 -- under the terms of the GNU Lesser General Public 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.
13 --
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
16
17 deferred class SelectType  from StepData  --  inherits Storable
18
19     ---Purpose : SelectType is the basis used for SELECT_TYPE definitions from
20     --           the EXPRESS form. A SELECT_TYPE in EXPRESS is an enumeration
21     --           of Types, it corresponds in a way to a Super-Type, but with
22     --           no specific Methods, and no exclusivity (a given Type can be
23     --           member of several SELECT_TYPES, plus be itself a SUB_TYPE).
24     --           
25     --           A SelectType can be field of a Transient Entity (it is itself
26     --           Storable) or only used to control an input Argument
27     --           
28     --           This class implies to designate each member Type by a Case
29     --           Number which is a positive Integer value (this allows a faster
30     --           treatement).
31     --           
32     --           With this class, a specific SelectType can :
33     --           - recognize an Entity as complying or not with its definition,
34     --           - storing it, with the garanty that the stored Entity complies
35     --             with the definition of the SelectType
36     --           - and (if judged useful) give the stored Entity under the good
37     --             Type rather than simply "Transient".
38
39 uses CString, Transient, Type, Logical, SelectMember, PDescr
40
41 raises TypeMismatch
42
43 is
44
45     CaseNum (me; ent : Transient) returns Integer  is deferred;
46     ---Purpose : Recognizes the Type of an Entity. Returns a positive Number
47     --           which identifies the Type in the definition List of the
48     --           SelectType. Returns Zero if its Type in not in this List.
49
50     Matches (me; ent : Transient) returns Boolean;
51     ---Purpose : Returns True if the Type of an Entity complies with the
52     --           definition list of the SelectType.
53     --           Also checks for a SelectMember
54     --           Default Implementation looks for CaseNum  or CaseMem positive
55
56     SetValue (me : in out; ent : any Transient)
57     ---Purpose : Stores an Entity. This allows to define a specific SelectType
58     --           class with one read method per member Type, which returns the
59     --           Value casted with the good Type.
60         raises TypeMismatch  is static;
61     --           Error if <ent> does not match the definition List of Types.
62
63     Nullify (me : in out)  is static;
64     ---Purpose : Nullifies the Stored Entity
65
66     Value (me) returns any Transient  is static;
67     ---Purpose : Returns the Stored Entity. Can be used to define specific
68     --           read methods (see above)
69     ---C++ : return const &
70
71     IsNull (me) returns Boolean  is static;
72     ---Purpose : Returns True if there is no Stored Entity (i.e. it is Null)
73
74         --  Entity (plain Transient)
75
76     Type (me) returns Type  is static;
77     ---Purpose : Returns the Effective (Dynamic) Type of the Stored Entity
78     --           If it is Null, returns TYPE(Transient)
79
80     CaseNumber (me) returns Integer  is static;
81     ---Purpose : Recognizes the Type of the stored Entity, or zero if it is
82     --           Null or SelectMember. Calls the first method CaseNum on Value
83
84         --  Others (through a SelectMember)
85
86     Description (me) returns PDescr  is virtual;
87     ---Purpose : Returns the Description which corresponds to <me>
88     --           Null if no specific description to give. This description is
89     --           used to control reading an check validity.
90     --           Default returns a Null Handle, i.e. undefined description
91     --           It can suffice if CaseNum and CaseMem give enough control
92
93     NewMember   (me) returns SelectMember  is virtual;
94     ---Purpose : Returns a preferred SelectMember. Default returns a Null
95     --           By default, a SelectMember can be set according to data type
96     --           and Name : it is a SelectNamed if Name is defined
97     --           
98     --           This method allows to define, for a specific SelectType, a
99     --           specific SelectMember than SelectNamed. For instance for a
100     --           Real plus a Name, a SelectReal plus a case number is a good
101     --           solution, lighter than SelectNamed which is very multipurpose
102
103     CaseMem    (me; ent : SelectMember) returns Integer  is virtual;
104     ---Purpose : Recognize a SelectMember (kind, name). Returns a positive
105     --           value which identifies the case in the List of immediate cases
106     --           (distinct from the List of Entity Types). Zero if not
107     --           recognizes
108     --           Default returns 0, saying that no immediate value is allowed
109
110     CaseMember (me) returns Integer;
111     ---Purpose : Returns the Type of the stored SelectMember, or zero if it is
112     --            Null or Entity. Calls the method CaseMem on Value
113
114     Member (me) returns SelectMember;
115     ---Purpose : Returns Value as a SelectMember. Null if not a SelectMember
116
117     SelectName (me) returns CString;
118     ---Purpose : Returns the type name of SelectMember. If no SelectMember or
119     --           with no type name, returns an empty string
120     --           To change it, pass through the SelectMember itself
121
122     Int (me) returns Integer;
123     ---Purpose : This internal method gives access to a value implemented by an
124     --           Integer (to read it)
125
126     SetInt (me : in out; val : Integer)
127     ---Purpose : This internal method gives access to a value implemented by an
128     --           Integer (to set it) : a SelectMember MUST ALREADY BE THERE !
129         raises TypeMismatch  is static;
130
131     Integer (me) returns Integer;
132     ---Purpose : Gets the value as an Integer
133
134     SetInteger (me : in out; val : Integer; name : CString = "")
135     ---Purpose : Sets a new Integer value, with an optional type name
136     --  Warning : If a SelectMember is already set, works on it : value and
137     --           name must then be accepted by this SelectMember
138         raises TypeMismatch  is static;
139     --           Error if no Integer value is accepted (see CaseMem)
140
141     Boolean (me) returns Boolean;
142
143     SetBoolean (me : in out; val : Boolean; name : CString = "")
144         raises TypeMismatch  is static;
145
146     Logical (me) returns Logical;
147
148     SetLogical (me : in out; val : Logical; name : CString = "")
149         raises TypeMismatch  is static;
150
151     Real (me) returns Real;
152
153     SetReal (me : in out; val : Real; name : CString = "")
154         raises TypeMismatch  is static;
155
156     Destroy (me: in out) is virtual;
157     ---C++ : alias "Standard_EXPORT virtual ~StepData_SelectType() { Destroy(); }"
158
159 fields
160
161     thevalue : Transient;
162
163 end SelectType;