0024947: Redesign OCCT legacy type system
[occt.git] / src / Standard / Standard_Type.cdl
1 -- Created on: 1991-09-06
2 -- Created by: jean pierre TIRAULT
3 -- Copyright (c) 1991-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 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.
13 --
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
16
17 class Type from Standard 
18
19    ---Purpose: 
20    --   The class <Type> provides services to find out information
21    --   about a type defined in CDL.
22    --
23    --   Note that multiple inheritance is not supported by the moment;
24    --   the array of ancestors accepted by constructors is assumed to
25    --   represent hierarchy of ancestors up to the root.
26    --   However, only first element is actually used by SubType method,
27    --   higher level ancestors are requested recursively.
28    --
29    --  Warning:
30    --   The information given by <Type> is about the type from which
31    --   it is created and not about the <Type> itself. 
32    --
33
34 inherits
35    Transient from Standard
36
37 uses 
38      Boolean from Standard,
39      Integer from Standard,
40      CString from Standard,
41      KindOfType from Standard,
42      AncestorIterator from Standard
43
44 raises 
45    TypeMismatch from Standard,
46    NoSuchObject from Standard,
47    OutOfRange   from Standard
48
49 is
50         
51    ---------------------------------------------------------------------
52    ---Category: The general information about a type.
53    ---------------------------------------------------------------------   
54
55    Name(me) returns CString;
56    ---Purpose: 
57    --   Returns the type name of <me>.
58    ---Level: Advanced
59
60    Size(me) returns Integer;
61    ---Purpose: 
62    --   Returns the size of <me> in bytes.
63    ---Level: Advanced
64   
65    ---------------------------------------------------------------------
66    ---Category: The Constructor of Type 
67    ---------------------------------------------------------------------
68    Create(aName           : CString;
69           aSize           : Integer) 
70    ---Purpose:
71    --   The constructor for a imported type.
72    ---Level: Advanced
73    returns Type;
74
75    Create(aName           : CString;
76           aSize           : Integer;
77           aNumberOfParent : Integer;
78           aAncestors      : Address) 
79    ---Purpose:
80    --   The constructor for a primitive.
81    ---Level: Advanced
82    returns Type;
83
84    Create(aName           : CString;
85           aSize           : Integer;
86           aNumberOfElement: Integer;
87           aNumberOfParent : Integer;
88           anAncestors     : Address;
89           aElements       : Address)
90    ---Purpose:
91    --   The constructor for an enumeration.
92    ---Level: Advanced
93    returns Type;
94
95    Create(aName           : CString;
96           aSize           : Integer;
97           aNumberOfParent : Integer;
98           anAncestors     : Address;
99           aFields         : Address) 
100    ---Purpose:
101    --   The constructor for a class.
102    ---Level: Advanced
103    returns Type;
104
105    ---------------------------------------------------------------------
106    ---Category: Comparison between types
107    ---------------------------------------------------------------------
108    SubType(me; aOther: Type) returns Boolean;
109    ---Purpose:
110    --   Returns "True", if <me> is the same as <aOther>,
111    --   or inherits from <aOther>.
112    --   Note that multiple inheritance is not supported.
113    ---Level: Advanced
114    
115    SubType(me; theName: CString) returns Boolean;
116    ---Purpose:
117    --   Returns "True", if <me> or one of its ancestors has the name 
118    --   equal to theName.
119    --   Note that multiple inheritance is not supported.
120    ---Level: Advanced
121    
122    ---------------------------------------------------------------------
123    ---Category: Information about nature of the type.   
124    ---------------------------------------------------------------------
125
126    IsImported(me) returns Boolean;
127    ---Purpose: 
128    --   Returns "True", if the type is imported.
129    ---Level: Advanced
130
131    IsPrimitive(me) returns Boolean;
132    ---Purpose: 
133    --   Returns "True", if the type is a primitive.
134    ---Level: Advanced
135
136    IsEnumeration(me) returns Boolean;
137    ---Purpose: 
138    --   Returns "True", if the type is an "Enumeration".
139    ---Level: Advanced
140
141    IsClass(me) returns Boolean;
142    ---Purpose: 
143    --   Returns "True", if the type is a "Class".
144    ---Level: Advanced
145
146    ---------------------------------------------------------------------
147    ---Category: The information about the ancestors of a type.
148    ---------------------------------------------------------------------
149
150    NumberOfParent(me) returns Integer;
151    ---Purpose: 
152    --   Returns the number of direct parents of the class.
153    --   
154    ---Level: Advanced
155
156    NumberOfAncestor(me) returns Integer;
157    ---Purpose: 
158    --   Returns the number of ancestors of the class.
159    --  
160    ---Level: Advanced
161
162    Ancestors(me) returns Address is private;
163    ---Purpose: 
164    --   Returns the address of the ancestors array. It can be used only by 
165    --   AncestorIterator.
166    ---Level: Advanced
167
168    Print (me; s: in out OStream);
169    ---Purpose: 
170    --   Prints on the stream <s> the name of Type.
171    --  Warning:
172    --   The operator "OStream& operator<< (Standard_OStream&,
173    --                                      Handle(Standard_Type)&)"
174    --   is implemented. (This operator uses the method Print)
175    --   
176    ---Level: Advanced   
177    ---C++: alias "Standard_EXPORT     void operator<<(Standard_OStream& s) const  {  Print(s); }  "
178  
179    InLineDummy(me) is static private;
180    ---Purpose:
181    --    Just for inline.
182    --    
183    ---Level: Advanced   
184    ---C++: inline
185     
186 fields
187
188    myName             : CString;
189    mySize             : Integer;   
190    myKind             : KindOfType;
191    myNumberOfParent   : Integer;
192    myNumberOfAncestor : Integer;
193    myAncestors        : Address;
194
195 friends
196
197    class AncestorIterator from Standard
198
199 end Type from Standard;