ir.idl revision 608:7e06bf1dcb09
1/*
2 * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26/*
27 * This file contains OMG IDL from  CORBA V2.0, July 1995.
28 * It also contains the TypeCode creation APIs in CORBA::ORB
29 **/
30
31#pragma prefix "omg.org"
32
33module CORBA {
34    typedef string Identifier;
35    typedef string ScopedName;
36    typedef string RepositoryId;
37
38    enum DefinitionKind {
39	dk_none, dk_all,
40	dk_Attribute, dk_Constant, dk_Exception, dk_Interface,
41	dk_Module, dk_Operation, dk_Typedef,
42	dk_Alias, dk_Struct, dk_Union, dk_Enum,
43	dk_Primitive, dk_String, dk_Sequence, dk_Array,
44	dk_Repository,
45	dk_Wstring, dk_Fixed,
46	dk_Value, dk_ValueBox, dk_ValueMember, // orbos 98-01-18: Objects By Value
47	dk_Native
48    };
49
50
51    interface IRObject
52    /**
53      An IRObject IDL interface represents the most generic interface
54      from which all other Interface Repository interfaces are derived,
55      even the Repository itself.
56     */
57    {
58	// read interface
59	readonly attribute DefinitionKind def_kind;
60
61	// write interface
62	void destroy ();
63    };
64
65
66
67    typedef string VersionSpec;
68
69    interface Contained;
70    interface Repository;
71    interface Container;
72
73    interface Contained : IRObject
74    /**
75       The Contained Interface is inherited by all Interface Repository
76       interfaces that are contained by other objects.
77     */
78    {
79	// read/write interface
80
81	attribute RepositoryId id;
82	attribute Identifier name;
83	attribute VersionSpec version;
84
85	// read interface
86
87	readonly attribute Container defined_in;
88	readonly attribute ScopedName absolute_name;
89	readonly attribute Repository containing_repository;
90
91	struct Description {
92	    DefinitionKind kind;
93	    any value;
94	};
95
96	Description describe ();
97
98	// write interface
99
100	void move (
101	    in Container new_container,
102	    in Identifier new_name,
103	    in VersionSpec new_version
104	    );
105    };
106
107
108    interface ModuleDef;
109    interface ConstantDef;
110    interface IDLType;
111    interface StructDef;
112    interface UnionDef;
113    interface EnumDef;
114    interface AliasDef;
115    interface InterfaceDef;
116    interface ExceptionDef;
117    interface ValueDef;		// orbos 98-01-18: Objects By Value
118    interface ValueMemberDef;	// orbos 98-01-18: Objects By Value
119    interface ValueBoxDef;	// orbos 98-01-18: Objects By Value
120    interface NativeDef;
121
122
123    typedef sequence <InterfaceDef> InterfaceDefSeq;
124
125
126    typedef sequence <Contained> ContainedSeq;
127
128    struct StructMember {
129	Identifier name;
130	TypeCode type;
131	IDLType type_def;
132    };
133    typedef sequence <StructMember> StructMemberSeq;
134
135    struct UnionMember {
136	Identifier name;
137	any label;
138	TypeCode type;
139	IDLType type_def;
140    };
141    typedef sequence <UnionMember> UnionMemberSeq;
142
143
144    typedef sequence <Identifier> EnumMemberSeq;
145
146    // orbos 98-01-18: Objects By Value -- begin
147    typedef short Visibility;	
148    const Visibility PRIVATE_MEMBER = 0; 
149    const Visibility PUBLIC_MEMBER = 1;
150
151    struct ValueMember {
152        Identifier name;
153	RepositoryId id;
154	RepositoryId defined_in;
155	VersionSpec version;
156        TypeCode type;
157        IDLType type_def;
158        Visibility access;
159    };
160    typedef sequence <ValueMember> ValueMemberSeq;
161
162    struct Initializer {
163        StructMemberSeq members;
164    };
165    typedef sequence <Initializer> InitializerSeq;
166
167    typedef sequence <ValueDef> ValueDefSeq;
168    
169    // orbos 98-01-18: Objects By Value -- end
170
171
172    interface Container : IRObject
173    /**
174      The Container interface is used to form a containment hierarchy
175      in the Interface Repository. A Container can contain any number
176      of objects derived from the Contained interface.
177    */
178    {
179	// read interface
180
181	Contained lookup ( in ScopedName search_name);
182
183	ContainedSeq contents (
184	    in DefinitionKind limit_type,
185	    in boolean exclude_inherited
186	    );
187
188	ContainedSeq lookup_name (
189	    in Identifier search_name,
190	    in long levels_to_search,
191	    in DefinitionKind limit_type,
192	    in boolean exclude_inherited
193	    );
194
195	struct Description {
196	    Contained contained_object;
197	    DefinitionKind kind;
198	    any value;
199	};
200
201	typedef sequence<Description> DescriptionSeq;
202
203	DescriptionSeq describe_contents (
204	    in DefinitionKind limit_type,
205	    in boolean exclude_inherited,
206	    in long max_returned_objs
207	    );
208
209	// write interface
210
211	ModuleDef create_module (
212	    in RepositoryId id,
213	    in Identifier name,
214	    in VersionSpec version
215	    );
216
217	ConstantDef create_constant (
218	    in RepositoryId id,
219	    in Identifier name,
220	    in VersionSpec version,
221	    in IDLType type,
222	    in any value
223	    );
224
225	StructDef create_struct (
226	    in RepositoryId id,
227	    in Identifier name,
228	    in VersionSpec version,
229	    in StructMemberSeq members
230	    );
231
232	UnionDef create_union (
233	    in RepositoryId id,
234	    in Identifier name,
235	    in VersionSpec version,
236	    in IDLType discriminator_type,
237	    in UnionMemberSeq members
238	    );
239
240	EnumDef create_enum (
241	    in RepositoryId id,
242	    in Identifier name,
243	    in VersionSpec version,
244	    in EnumMemberSeq members
245	    );
246
247	AliasDef create_alias (
248	    in RepositoryId id,
249	    in Identifier name,
250	    in VersionSpec version,
251	    in IDLType original_type
252	    );
253
254        ExceptionDef create_exception (
255            in RepositoryId    id,
256            in Identifier      name,
257            in VersionSpec     version,
258            in StructMemberSeq members
259        );
260
261
262	InterfaceDef create_interface (
263	    in RepositoryId id,
264	    in Identifier name,
265	    in VersionSpec version,
266	    in boolean is_abstract,
267	    in InterfaceDefSeq base_interfaces
268	    );
269
270	// orbos 98-01-18: Objects By Value
271	ValueDef create_value(
272	    in RepositoryId id,
273	    in Identifier name,
274	    in VersionSpec version,
275	    in boolean is_custom,
276	    in boolean is_abstract,
277	    in octet flags,	// must be 0
278	    in ValueDef base_value,
279	    in boolean has_safe_base,
280	    in ValueDefSeq abstract_base_values,
281	    in InterfaceDefSeq supported_interfaces,
282	    in InitializerSeq initializers
283	    );
284	
285	// orbos 98-01-18: Objects By Value
286	ValueBoxDef create_value_box(
287	    in RepositoryId id,
288	    in Identifier name,
289	    in VersionSpec version,
290	    in IDLType original_type_def
291	    );
292	
293	NativeDef create_native(
294	    in RepositoryId id,
295	    in Identifier name,
296	    in VersionSpec version
297	    );
298	
299    };
300
301
302
303    interface IDLType : IRObject
304    /**
305       The IDLType interface is an abstract interface inherited by all
306       IR objects that represent the OMG IDL types. It provides access
307       to the TypeCode describing the type, and is used in defining the
308       other interfaces wherever definitions of IDLType must be referenced.
309    */
310    {
311	readonly attribute TypeCode type;
312    };
313
314
315
316    interface PrimitiveDef;
317    interface StringDef;
318    interface SequenceDef;
319    interface ArrayDef;
320
321    enum PrimitiveKind {
322	pk_null, pk_void, pk_short, pk_long, pk_ushort, pk_ulong,
323	pk_float, pk_double, pk_boolean, pk_char, pk_octet,
324	pk_any, pk_TypeCode, pk_Principal, pk_string, pk_objref
325    };
326
327    interface Repository : Container
328    /**
329      Repository is an interface that provides global access to the
330      Interface Repository. Repository objects can contain constants,
331      typedefs, exceptions, interfaces, and modules.
332    */
333    {
334	// read interface
335
336	Contained lookup_id (in RepositoryId search_id);
337
338	PrimitiveDef get_primitive (in PrimitiveKind kind);
339
340	// write interface
341
342	StringDef create_string (in unsigned long bound);
343
344	SequenceDef create_sequence (
345	    in unsigned long bound,
346	    in IDLType element_type
347	    );
348
349	ArrayDef create_array (
350	    in unsigned long length,
351	    in IDLType element_type
352	    );
353    };
354
355
356    interface ModuleDef : Container, Contained
357    /**
358      A ModuleDef can contain constants, typedefs, exceptions, interfaces,
359      and other module objects.
360    */
361    {
362    };
363
364    struct ModuleDescription {
365	Identifier name;
366	RepositoryId id;
367	RepositoryId defined_in;
368	VersionSpec version;
369    };
370
371
372    interface ConstantDef : Contained
373    /**
374      A ConstantDef object defines a named constant.
375    */
376    {
377	readonly attribute TypeCode type;
378	attribute IDLType type_def;
379	attribute any value;
380    };
381
382    struct ConstantDescription {
383	Identifier name;
384	RepositoryId id;
385	RepositoryId defined_in;
386	VersionSpec version;
387	TypeCode type;
388	any value;
389    };
390
391
392    interface TypedefDef : Contained, IDLType
393    /**
394      TypedefDef is an abstract interface used as a base interface for
395      all named non-object types(structures, unions, enumerations,
396      aliases). The TypedefDef interface is not inherited by the definition
397      objects for the primitive or anonymous types.
398    */
399    {
400    };
401
402    struct TypeDescription {
403	Identifier name;
404	RepositoryId id;
405	RepositoryId defined_in;
406	VersionSpec version;
407	TypeCode type;
408    };
409
410
411    interface StructDef : TypedefDef, Container
412    /**
413       A StructDef represents an OMG IDL structure definition.
414    */
415    {
416	attribute StructMemberSeq members;
417    };
418
419
420    interface UnionDef : TypedefDef, Container
421    /**
422       A UnionDef represents an OMG IDL union definition.
423     */
424    {
425	readonly attribute TypeCode discriminator_type;
426	attribute IDLType discriminator_type_def;
427	attribute UnionMemberSeq members;
428    };
429
430
431    interface EnumDef : TypedefDef
432    /**
433      A EnumDef represents an OMG IDL enum definition.
434     */
435    {
436	attribute EnumMemberSeq members;
437    };
438
439
440    interface AliasDef : TypedefDef
441    /**
442       An AliasDef represents an OMG IDL typedef that aliases other
443       definition.
444    */
445    {
446	attribute IDLType original_type_def;
447    };
448
449
450    interface PrimitiveDef: IDLType
451    /**
452      A PrimitiveDef represents one of the IDL primitive types. As
453      primitive types are unnamed, this interface is not derived from
454      TypedefDef or Contained.
455     */
456    {
457	readonly attribute PrimitiveKind kind;
458    };
459
460
461    interface StringDef : IDLType
462    /**
463      A StringDef represents an OMG IDL string type. As string
464      types are anonymous, this interface is not derived from TypedefDef
465      or Contained.
466    */
467    {
468	attribute unsigned long bound;
469    };
470
471
472    interface SequenceDef : IDLType
473    /**
474      A SequenceDef represents an OMG IDL sequence type. As sequence
475      types are anonymous, this interface is not derived from TypedefDef
476      or Contained.
477     */
478    {
479	attribute unsigned long bound;
480	readonly attribute TypeCode element_type;
481	attribute IDLType element_type_def;
482    };
483
484    interface ArrayDef : IDLType
485    /**
486      An ArrayDef represents an OMG IDL array type. As array
487      types are anonymous, this interface is not derived from TypedefDef
488      or Contained.
489    */
490    {
491	attribute unsigned long length;
492	readonly attribute TypeCode element_type;
493	attribute IDLType element_type_def;
494    };
495
496
497    interface ExceptionDef : Contained, Container
498    /**
499      An ExceptionDef represents an exception definition.
500    */
501    {
502	readonly attribute TypeCode type;
503	attribute StructMemberSeq members;
504    };
505    struct ExceptionDescription {
506	Identifier name;
507	RepositoryId id;
508	RepositoryId defined_in;
509	VersionSpec version;
510	TypeCode type;
511    };
512
513
514
515    enum AttributeMode {ATTR_NORMAL, ATTR_READONLY};
516
517    interface AttributeDef : Contained
518    /**
519      An AttributeDef represents the information that defines an
520      attribute of an interface.
521    */
522    {
523	readonly attribute TypeCode type;
524	attribute IDLType type_def;
525	attribute AttributeMode mode;
526    };
527
528    struct AttributeDescription {
529	Identifier name;
530	RepositoryId id;
531	RepositoryId defined_in;
532	VersionSpec version;
533	TypeCode type;
534	AttributeMode mode;
535    };
536
537
538
539    enum OperationMode {OP_NORMAL, OP_ONEWAY};
540
541    enum ParameterMode {PARAM_IN, PARAM_OUT, PARAM_INOUT};
542    struct ParameterDescription {
543	Identifier name;
544	TypeCode type;
545	IDLType type_def;
546	ParameterMode mode;
547    };
548    typedef sequence <ParameterDescription> ParDescriptionSeq;
549
550    typedef Identifier ContextIdentifier;
551    typedef sequence <ContextIdentifier> ContextIdSeq;
552
553    typedef sequence <ExceptionDef> ExceptionDefSeq;
554    typedef sequence <ExceptionDescription> ExcDescriptionSeq;
555
556    interface OperationDef : Contained
557    /**
558      An OperationDef represents the information that defines an
559      operation of an interface.
560     */
561    {
562	readonly attribute TypeCode result;
563	attribute IDLType result_def;
564	attribute ParDescriptionSeq params;
565	attribute OperationMode mode;
566	attribute ContextIdSeq contexts;
567	attribute ExceptionDefSeq exceptions;
568    };
569
570    struct OperationDescription {
571	Identifier name;
572	RepositoryId id;
573	RepositoryId defined_in;
574	VersionSpec version;
575	TypeCode result;
576	OperationMode mode;
577	ContextIdSeq contexts;
578	ParDescriptionSeq parameters;
579	ExcDescriptionSeq exceptions;
580    };
581
582
583
584    typedef sequence <RepositoryId> RepositoryIdSeq;
585    typedef sequence <OperationDescription> OpDescriptionSeq;
586    typedef sequence <AttributeDescription> AttrDescriptionSeq;
587
588    interface InterfaceDef : Container, Contained, IDLType
589    /**
590      An InterfaceDef object represents an interface definition. It can
591      contains constants, typedefs, exceptions, operations, and
592      attributes.
593     */
594    {
595	// read/write interface
596
597	attribute InterfaceDefSeq base_interfaces;
598	attribute boolean is_abstract;
599
600	// read interface
601
602	boolean is_a (in RepositoryId interface_id);
603
604	struct FullInterfaceDescription {
605	    Identifier name;
606	    RepositoryId id;
607	    RepositoryId defined_in;
608	    VersionSpec version;
609	    boolean is_abstract;
610	    OpDescriptionSeq operations;
611	    AttrDescriptionSeq attributes;
612	    RepositoryIdSeq base_interfaces;
613	    TypeCode type;
614	};
615
616	FullInterfaceDescription describe_interface();
617
618	// write interface
619
620	AttributeDef create_attribute (
621	    in RepositoryId id,
622	    in Identifier name,
623	    in VersionSpec version,
624	    in IDLType type,
625	    in AttributeMode mode
626	    );
627
628	OperationDef create_operation (
629	    in RepositoryId id,
630	    in Identifier name,
631	    in VersionSpec version,
632	    in IDLType result,
633	    in OperationMode mode,
634	    in ParDescriptionSeq params,
635	    in ExceptionDefSeq exceptions,
636	    in ContextIdSeq contexts
637	    );
638    };
639
640    struct InterfaceDescription {
641	Identifier name;
642	RepositoryId id;
643	RepositoryId defined_in;
644	VersionSpec version;
645	RepositoryIdSeq base_interfaces;
646    };
647
648
649    // orbos 98-01-18: Objects By Value -- begin
650
651    interface ValueMemberDef : Contained
652
653      /** A <code>ValueMemberDef</code> object represents the public
654      and private data member definition of a <code>Value</code> type
655      */
656
657 {
658        readonly attribute TypeCode type;
659	         attribute IDLType type_def;
660		 attribute Visibility access;
661    };
662
663    interface ValueDef : Container, Contained, IDLType
664      /**
665	A ValueDef object represents the definition of the
666	<code>Value</code> object used to pass the object state
667	between hosts
668	*/
669
670      {
671	   // read/write interface
672	    attribute InterfaceDefSeq supported_interfaces;
673	    attribute InitializerSeq initializers;
674	    attribute ValueDef base_value;
675	    attribute ValueDefSeq abstract_base_values;
676	    attribute boolean is_abstract;
677	    attribute boolean is_custom;
678	    attribute octet flags; // always 0
679	    attribute boolean has_safe_base;
680
681	    // read interface
682	    boolean is_a(in RepositoryId value_id);
683
684	    struct FullValueDescription {
685	      Identifier 	name;
686	      RepositoryId 	id;
687	      boolean 	is_abstract;
688	      boolean 	is_custom;
689	      octet 		flags; // always 0
690	      RepositoryId 	defined_in;
691	      VersionSpec 	version;
692	      OpDescriptionSeq operations;
693	      AttrDescriptionSeq attributes;
694	      ValueMemberSeq 	members;
695	      InitializerSeq 	initializers;
696	      RepositoryIdSeq supported_interfaces;
697	      RepositoryIdSeq abstract_base_values;
698	      boolean 	has_safe_base;
699	      RepositoryId	base_value;
700	      TypeCode	type;
701	  };
702
703	  FullValueDescription describe_value();
704
705	  // write interface
706
707	  ValueMemberDef create_value_member(
708	      in RepositoryId id,
709	      in Identifier name,
710	      in VersionSpec version,
711	      in IDLType type_def,
712	      in Visibility access
713	  );
714
715	  AttributeDef create_attribute(
716	      in RepositoryId id,
717	      in Identifier   name,
718	      in VersionSpec  version,
719	      in IDLType      type,
720	      in AttributeMode mode
721	  );
722
723	  OperationDef create_operation(
724	      in RepositoryId id,
725	      in Identifier   name,
726	      in VersionSpec  version,
727	      in IDLType      result,
728	      in OperationMode     mode,
729	      in ParDescriptionSeq params,
730	      in ExceptionDefSeq   exceptions,
731	      in ContextIdSeq contexts
732	  );
733    };
734    struct ValueDescription {
735        Identifier name;
736        RepositoryId id;
737        boolean is_abstract;
738        boolean is_custom;
739        octet   flags; // always 0
740        RepositoryId defined_in;
741        VersionSpec version;
742        RepositoryIdSeq supported_interfaces;
743        RepositoryIdSeq abstract_base_values;
744        boolean has_safe_base;
745        RepositoryId base_value;
746    };
747
748    interface ValueBoxDef : IDLType 
749
750      /** ValueBoxDef is an interface that reresents a value type with
751	a single data member inside its state section and no
752	inheritance or methods. For example, when transmitting a
753	string or sequence as an actual parameter on an interface
754	operation or as a data member of a value type that is an
755	actual parameter, it may be important to preserve any sharing
756	of the string or sequence within the object graph being
757	transmitted. Because current IDL data types do not preserve
758	referential integrity in this way, this requirement is
759	conveniently handled by using a value type. Value types also
760	support the transmission of nulls (as a distinguished value),
761	whereas IDL data types such as string and sequence (which are
762	mapped to empty strings and sequences) do not. The Java to IDL
763	mapping requires both preservation of referential integrity
764	and transmission of nulls. Because it would be cumbersome to
765	require the full IDL syntax for a value type for this specific
766	usage, this shorthand notation is introduced to cover this use
767	of value types for simple containment of a single data member.
768	*/
769
770{
771        attribute IDLType original_type_def;
772    };
773    
774    // orbos 98-01-18: Objects By Value -- end
775
776    interface NativeDef : TypedefDef {
777    };
778};
779