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