Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / IDL_Test / interface.idl
blob6ff89c19f4aac437be8d3801bfb67f9c31df7f57
2 //=============================================================================
3 /**
4 * @file interface.idl
6 * This file contains examples of IDL code that has
7 * caused problems in the past for the TAO IDL
8 * compiler. This test is to make sure the problems
9 * stay fixed.
12 * @author Jeff Parsons <parsons@cs.wustl.edu> and TAO users.
14 //=============================================================================
17 // Used to be a problem in the get() and set()
18 // generated code.
20 interface Base
22 attribute long value;
25 interface Derived : Base
29 // The fact that the interface begins with 'foo' was causing
30 // problems. The IDL compiler thought the interface was in
31 // foo's scope.
32 module foo_mod
34 struct date
36 short month;
40 interface foostep
42 foo_mod::date getDate ();
45 // Only operations or attributes should cause a clash
46 // in this type of situation.
47 interface mother
49 struct member
51 long val;
55 interface father
57 struct member
59 short ident;
63 interface child : mother, father
67 interface try
71 // Definition below in file.
72 interface later;
74 typedef boolean Bool;
76 interface later_user
78 later op (in later inarg,
79 inout later inoutarg,
80 out later outarg);
83 // Not a clash with the C++ keyword because they are case sensitive,
84 // but the Arg_Traits<> specialization parameter (ACE_InputCDR::to_boolean)
85 // needs the unaliased type name to work.
86 void op2 (in Bool inarg2);
89 struct later_holder
91 later member;
94 interface later {};
96 // Previously, we could have found v if it
97 // was inherited into Client, but not in
98 // the case below, where it is inherited into
99 // somewhere other than the scope where the
100 // lookup starts.
102 interface Begin
104 typedef long Value;
107 interface Middle : Begin
111 interface End : Middle
115 interface Client
117 attribute End::Value v;
120 // Tests arg_traits visitor for unaliased bounded (w)string
121 // attributes.
122 interface AttributeTester
124 typedef string string_1[1];
126 attribute string a_su;
127 attribute string_1 a_sb;
130 // All of the 'recursion' below is legal.
131 module ParamMod
133 interface ParameterTester
135 exception object_excep_type
137 ParameterTester objref;
140 typedef sequence<ParameterTester> object_seq_type;
142 typedef ParameterTester object_array_type[5];
144 struct object_struct_type
146 octet o1;
147 ParameterTester p1;
148 long l1;
151 union object_union_type switch (long)
153 case 0: string str;
154 case 1: ParameterTester pt;
157 object_seq_type parameter_tester_op (
158 in object_struct_type inarg,
159 inout object_array_type inoutarg,
160 out object_union_type outarg
162 raises (object_excep_type);
166 local interface testlocal
170 interface A {
171 union U switch (Bool)
173 case TRUE: A aa;
177 module M
179 interface A;
182 module M
184 interface A;
186 interface A {};
189 module i1
191 interface if1
193 string getStr();
197 module i2
199 interface if2 : ::i1::if1
201 string getstr2();
204 interface if3 : ::i2::if2
206 string getstr3();
210 /// Tests acceptance of legal redefinitions (of
211 /// constants, exceptions and types) in a derived
212 /// interface.
213 module redefs
215 interface base
217 const long lconst = -5;
219 exception ex
221 string info;
224 struct foo
226 short index;
230 interface derived : base
232 const long lconst = 44;
234 exception ex
236 long serial;
239 struct foo
241 string str;
246 // Had to relocate the spot where the typedef is marked as
247 // having its arg traits instantiation already generated.
248 // Otherwise, when the scope of the base interface is visited
249 // as part of this process, we had infinite recursion and a
250 // stack overflow.
251 module Rec_Arg_Traits
253 interface base
255 typedef Rec_Arg_Traits::base plan_stub_type;
258 interface derived : Rec_Arg_Traits::base
260 void remove_task (in plan_stub_type listener);