Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tests / IDL_Test / interface.idl
blob1ee7dd843d000fd8eb224957407d6ac691c4b40d
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);
82 // Not a clash with the C++ keyword because they are case sensitive,
83 // but the Arg_Traits<> specialization parameter (ACE_InputCDR::to_boolean)
84 // needs the unaliased type name to work.
85 void op2 (in Bool inarg2);
88 struct later_holder
90 later member;
93 interface later {};
95 // Previously, we could have found v if it
96 // was inherited into Client, but not in
97 // the case below, where it is inherited into
98 // somewhere other than the scope where the
99 // lookup starts.
101 interface Begin
103 typedef long Value;
106 interface Middle : Begin
110 interface End : Middle
114 interface Client
116 attribute End::Value v;
119 // Tests arg_traits visitor for unaliased bounded (w)string
120 // attributes.
121 interface AttributeTester
123 typedef string string_1[1];
125 attribute string a_su;
126 attribute string_1 a_sb;
129 // All of the 'recursion' below is legal.
130 module ParamMod
132 interface ParameterTester
134 exception object_excep_type
136 ParameterTester objref;
139 typedef sequence<ParameterTester> object_seq_type;
141 typedef ParameterTester object_array_type[5];
143 struct object_struct_type
145 octet o1;
146 ParameterTester p1;
147 long l1;
150 union object_union_type switch (long)
152 case 0: string str;
153 case 1: ParameterTester pt;
156 object_seq_type parameter_tester_op (
157 in object_struct_type inarg,
158 inout object_array_type inoutarg,
159 out object_union_type outarg
161 raises (object_excep_type);
165 local interface testlocal
169 interface A {
170 union U switch (Bool)
172 case TRUE: A aa;
176 module M
178 interface A;
181 module M
183 interface A;
185 interface A {};
188 module i1
190 interface if1
192 string getStr();
196 module i2
198 interface if2 : ::i1::if1
200 string getstr2();
203 interface if3 : ::i2::if2
205 string getstr3();
209 /// Tests acceptance of legal redefinitions (of
210 /// constants, exceptions and types) in a derived
211 /// interface.
212 module redefs
214 interface base
216 const long lconst = -5;
218 exception ex
220 string info;
223 struct foo
225 short index;
229 interface derived : base
231 const long lconst = 44;
233 exception ex
235 long serial;
238 struct foo
240 string str;
245 // Had to relocate the spot where the typedef is marked as
246 // having its arg traits instantiation already generated.
247 // Otherwise, when the scope of the base interface is visited
248 // as part of this process, we had infinite recursion and a
249 // stack overflow.
250 module Rec_Arg_Traits
252 interface base
254 typedef Rec_Arg_Traits::base plan_stub_type;
257 interface derived : Rec_Arg_Traits::base
259 void remove_task (in plan_stub_type listener);
263 // Test to validate that the generated code is compilable
264 // when we have an argument `call`
265 module call_test
267 interface iTest
269 void do_op (in string call);
273 // Test that using an attribut call is working correctly
274 module call_attribute
276 interface iBar
278 attribute string call;