1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
|
%%--------------------------------------------------------------------
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
%%
%% %CopyrightEnd%
%%
%%
%%%----------------------------------------------------------------------
%%% File : ir_objects.hrl
%%% Purpose : Record definitions for the IR DB
%%%----------------------------------------------------------------------
%%%----------------------------------------------------------------------
%%% *********************************************************************
%%% * *
%%% * PLEASE NOTE *
%%% * *
%%% * If a record is removed or added in this file, the corresponding *
%%% * database initialization code _MUST_ be updated accordingly. *
%%% * *
%%% * The initialization code is defined in a macro in this file. *
%%% * *
%%% * Also remember to update select/2 in orber_ifr.erl when adding *
%%% * or deleting a record in this file. *
%%% * *
%%% *********************************************************************
%%%----------------------------------------------------------------------
%% Interface objects
%% There are eight interface objects in an interface repository:
%% Repository, ModuleDef, InterfaceDef, AttributeDef, OperationDef,
%% TypedefDef, ConstantDef and ExceptionDef (CORBA V2.0, page 6-5/6).
% The other objects defined here are used to build the above objects
% (CORBA V2.0, page 6-7).
% Object references are stored as mnesia object IDs, i.e. a tuple with
% the table name and the ir_Internal_ID.
% Inheritance strategy. We incorporate the inherited object into the
% inheriting object. The record element 'inherited_objects' is a list
% of objects that "this" object inherits from (i.e. full object
% records and not object references).
% The record element 'ir_Internal_ID' is a tag that uniquely
% identifies a record. See the function orber_ifr:unique().
% IRObject, page 6-9
-record(ir_IRObject, {ir_Internal_ID,def_kind}).
% Contained, page 6-9
-record(ir_Contained, {ir_Internal_ID, %[IRObject]
def_kind, %from IRObject
id,
name,
version,
defined_in,
absolute_name,
containing_repository}).
% Container, page 6-10
-record(ir_Container, {ir_Internal_ID, %[IRObject]
def_kind, %from IRObject
contents}).
% IDLType, page 6-15
-record(ir_IDLType, {ir_Internal_ID, %[IRObject]
def_kind, %from IRObject
type}).
% Repository, page 6-16
-record(ir_Repository, {ir_Internal_ID, %[Container]
def_kind, %from IRObject
contents, %from Container
primitivedefs}).
% ModuleDef, page 6-17
-record(ir_ModuleDef, {ir_Internal_ID, %[Container,Contained]
def_kind, %from IRObject
contents, %from Container
id, %from Contained
name, %from Contained
version, %from Contained
defined_in, %from Contained
absolute_name, %from Contained
containing_repository %from Contained
}).
% ConstantDef, page 6-17
-record(ir_ConstantDef, {ir_Internal_ID, %[Contained]
def_kind, %from IRObject
id, %from Contained
name, %from Contained
version, %from Contained
defined_in, %from Contained
absolute_name, %from Contained
containing_repository, %from Contained
type,
type_def,
value}).
% TypedefDef, page 6-18
-record(ir_TypedefDef, {ir_Internal_ID, %[Contained,IDLType]
def_kind, %from IRObject
id, %from Contained
name, %from Contained
version, %from Contained
defined_in, %from Contained
absolute_name, %from Contained
containing_repository, %from Contained
type %from IDLType
}).
% StructDef, page 6-19
-record(ir_StructDef, {ir_Internal_ID, %[TypedefDef]
def_kind, %from IRObject
id, %from Contained
name, %from Contained
version, %from Contained
defined_in, %from Contained
absolute_name, %from Contained
containing_repository, %from Contained
type, %from IDLType
members}).
% UnionDef, page 6-19
-record(ir_UnionDef, {ir_Internal_ID, %[TypedefDef]
def_kind, %from IRObject
id, %from Contained
name, %from Contained
version, %from Contained
defined_in, %from Contained
absolute_name, %from Contained
containing_repository, %from Contained
type, %from IDLType
discriminator_type,
discriminator_type_def,
members}).
% EnumDef, page 6-20
-record(ir_EnumDef, {ir_Internal_ID, %[TypedefDef]
def_kind, %from IRObject
id, %from Contained
name, %from Contained
version, %from Contained
defined_in, %from Contained
absolute_name, %from Contained
containing_repository, %from Contained
type, %from IDLType
members}).
% AliasDef, page 6-21
-record(ir_AliasDef, {ir_Internal_ID, %[TypedefDef]
def_kind, %from IRObject
id, %from Contained
name, %from Contained
version, %from Contained
defined_in, %from Contained
absolute_name, %from Contained
containing_repository, %from Contained
type, %from IDLType
original_type_def}).
% PrimitiveDef, page 6-21
-record(ir_PrimitiveDef, {ir_Internal_ID, %[IDLType]
def_kind, %from IRObject
type, %from IDLType
kind}).
% StringDef, page 6-22
-record(ir_StringDef, {ir_Internal_ID, %[IDLType]
def_kind, %from IRObject
type, %from IDLType
bound}).
-record(ir_WstringDef, {ir_Internal_ID, %[IDLType]
def_kind, %from IRObject
type, %from IDLType
bound}).
% SequenceDef, page 6-22
-record(ir_SequenceDef, {ir_Internal_ID, %[IDLType]
def_kind, %from IRObject
type, %from IDLType
bound,
element_type,
element_type_def}).
% ArrayDef, page 6-23
-record(ir_ArrayDef, {ir_Internal_ID, %[IDLType]
def_kind, %from IRObject
type, %from IDLType
length,
element_type,
element_type_def}).
% ExceptionDef, page 6-23
-record(ir_ExceptionDef, {ir_Internal_ID, %[Contained]
def_kind, %from IRObject
id, %from Contained
name, %from Contained
version, %from Contained
defined_in, %from Contained
absolute_name, %from Contained
containing_repository, %from Contained
type,
members}).
% AttributeDef, page 6-24
-record(ir_AttributeDef, {ir_Internal_ID, %[Contained]
def_kind, %from IRObject
id, %from Contained
name, %from Contained
version, %from Contained
defined_in, %from Contained
absolute_name, %from Contained
containing_repository, %from Contained
type,
type_def,
mode}).
% OperationDef, page 6-25
-record(ir_OperationDef, {ir_Internal_ID, %[Contained]
def_kind, %from IRObject
id, %from Contained
name, %from Contained
version, %from Contained
defined_in, %from Contained
absolute_name, %from Contained
containing_repository, %from Contained
result,
result_def,
params,
mode,
contexts,
exceptions}).
% InterfaceDef, page 6-27
-record(ir_InterfaceDef, {ir_Internal_ID, %[Container,Contained,IDLType]
def_kind, %from IRObject
contents, %from Container
id, %from Contained
name, %from Contained
version, %from Contained
defined_in, %from Contained
absolute_name, %from Contained
containing_repository, %from Contained
type, %from IDLType
base_interfaces}).
% TypeCode, page 6-33
-record(ir_FixedDef, {ir_Internal_ID, %[IDLType]
def_kind, %from IRObject
type, %from IDLType
digits,
scale}).
% TypeCodes cannot be defined as records, since each type code has a
% quite unique structure depending on the type. The old TypeCode
% record definition is left here as a comment in case we want to
% change back to the old style.
%% ir_TypeCode does not have a field ir_Internal_ID. TypeCodes are
%% never explicitly written to the database as separate DB-records.
%% TypeCodes are stored as full records whenever they are used in an
%% IFR-object.
%%-record(ir_TypeCode, {kind,
%% parameter_list}).
% ORB, page 6-39
-record(ir_ORB, {ir_Internal_ID, % *** Do we need any attributes
dummy}). % for this table? ORB is a pseudo-
% object so perhaps the table is
% unnecessary?
-record(orber_light_ifr, {id, %% IFR-id
module,
type,
base_id}).
-define(IFR_ModuleDef, 0).
-define(IFR_ConstantDef, 1).
-define(IFR_StructDef, 2).
-define(IFR_UnionDef, 3).
-define(IFR_EnumDef, 4).
-define(IFR_AliasDef, 5).
-define(IFR_InterfaceDef, 6).
-define(IFR_ExceptionDef, 7).
%%%----------------------------------------------------------------------
%%% 'ifr_object_list' is used by other modules. Do NOT remove or rename
%%% this list!
%%% An addition or deletion of a record above must be duplicated here in
%%% this list and in the macro 'ifr_record_tuple_list' below.
-define(ifr_object_list, [ir_ModuleDef,
ir_Contained,
ir_AttributeDef,
ir_Repository,
ir_OperationDef,
ir_InterfaceDef,
ir_TypedefDef,
ir_Container,
ir_EnumDef,
ir_UnionDef,
ir_StringDef,
ir_WstringDef,
ir_ORB,
ir_IDLType,
ir_ExceptionDef,
ir_IRObject,
ir_PrimitiveDef,
ir_ArrayDef,
ir_AliasDef,
ir_ConstantDef,
ir_StructDef,
ir_SequenceDef,
ir_FixedDef]).
-define(ifr_light_object_list, [orber_light_ifr]).
-define(cr_fun_tuple(Table, Options),
{Table,
fun() ->
case mnesia:create_table(Table,[{attributes,
record_info(fields,
Table)}]++Options)of
{atomic,ok} ->
ok;
R ->
R
end
end}
).
-define(cr_fun_tuple_local(Table, IFR_storage_type),
{Table,
fun() ->
case mnesia:add_table_copy(Table,node(), IFR_storage_type)of
{atomic,ok} ->
ok;
R ->
R
end
end}
).
-define(ifr_record_tuple_list(Options),
[?cr_fun_tuple(ir_IRObject, Options),
?cr_fun_tuple(ir_Contained, [{index, [#ir_Contained.id]}|Options]),
?cr_fun_tuple(ir_Container, Options),
?cr_fun_tuple(ir_IDLType, Options),
?cr_fun_tuple(ir_Repository, Options),
?cr_fun_tuple(ir_ModuleDef, [{index, [#ir_ModuleDef.id]}|Options]),
?cr_fun_tuple(ir_ConstantDef, [{index, [#ir_ConstantDef.id]}|Options]),
?cr_fun_tuple(ir_TypedefDef, [{index, [#ir_TypedefDef.id]}|Options]),
?cr_fun_tuple(ir_StructDef, [{index, [#ir_StructDef.id]}|Options]),
?cr_fun_tuple(ir_UnionDef, [{index, [#ir_UnionDef.id]}|Options]),
?cr_fun_tuple(ir_EnumDef, [{index, [#ir_EnumDef.id]}|Options]),
?cr_fun_tuple(ir_AliasDef, [{index, [#ir_AliasDef.id]}|Options]),
?cr_fun_tuple(ir_PrimitiveDef, Options),
?cr_fun_tuple(ir_StringDef, Options),
?cr_fun_tuple(ir_WstringDef, Options),
?cr_fun_tuple(ir_SequenceDef, Options),
?cr_fun_tuple(ir_ArrayDef, Options),
?cr_fun_tuple(ir_ExceptionDef, [{index, [#ir_ExceptionDef.id]}|Options]),
?cr_fun_tuple(ir_AttributeDef, [{index, [#ir_AttributeDef.id]}|Options]),
?cr_fun_tuple(ir_OperationDef, [{index, [#ir_OperationDef.id]}|Options]),
?cr_fun_tuple(ir_InterfaceDef, [{index, [#ir_InterfaceDef.id]}| Options]),
% ?cr_fun_tuple(ir_TypeCode, Options),
?cr_fun_tuple(ir_ORB, Options),
?cr_fun_tuple(ir_FixedDef, Options)]).
-define(ifr_light_record_tuple_list(Options),
[?cr_fun_tuple(orber_light_ifr, Options)]).
-define(ifr_record_tuple_list_local(IFR_storage_type),
[?cr_fun_tuple_local(ir_IRObject, IFR_storage_type),
?cr_fun_tuple_local(ir_Contained, IFR_storage_type),
?cr_fun_tuple_local(ir_Container, IFR_storage_type),
?cr_fun_tuple_local(ir_IDLType, IFR_storage_type),
?cr_fun_tuple_local(ir_Repository, IFR_storage_type),
?cr_fun_tuple_local(ir_ModuleDef, IFR_storage_type),
?cr_fun_tuple_local(ir_ConstantDef, IFR_storage_type),
?cr_fun_tuple_local(ir_TypedefDef, IFR_storage_type),
?cr_fun_tuple_local(ir_StructDef, IFR_storage_type),
?cr_fun_tuple_local(ir_UnionDef, IFR_storage_type),
?cr_fun_tuple_local(ir_EnumDef, IFR_storage_type),
?cr_fun_tuple_local(ir_AliasDef, IFR_storage_type),
?cr_fun_tuple_local(ir_PrimitiveDef, IFR_storage_type),
?cr_fun_tuple_local(ir_StringDef, IFR_storage_type),
?cr_fun_tuple_local(ir_WstringDef, IFR_storage_type),
?cr_fun_tuple_local(ir_SequenceDef, IFR_storage_type),
?cr_fun_tuple_local(ir_ArrayDef, IFR_storage_type),
?cr_fun_tuple_local(ir_ExceptionDef, IFR_storage_type),
?cr_fun_tuple_local(ir_AttributeDef, IFR_storage_type),
?cr_fun_tuple_local(ir_OperationDef, IFR_storage_type),
?cr_fun_tuple_local(ir_InterfaceDef, IFR_storage_type),
% ?cr_fun_tuple_local(ir_TypeCode, IFR_storage_type),
?cr_fun_tuple_local(ir_ORB, IFR_storage_type),
?cr_fun_tuple_local(ir_FixedDef, IFR_storage_type)]).
-define(ifr_light_record_tuple_list_local(IFR_storage_type),
[?cr_fun_tuple_local(orber_light_ifr, IFR_storage_type)]).
|