Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tests / Param_Test / param_test.idl
blobf1ba518f199f0b29fe03554c90fecdc20d5c7f04
2 //=============================================================================
3 /**
4 * @file param_test.idl
6 * This IDL description is used to test all the parameter passing modes (in,
7 * inout, out, and return) for a number of IDL data types. The goal is to
8 * verify the correctness of the generated stubs and skeletons, and the
9 * the marshaling engine of TAO.
11 * @author Aniruddha Gokhale
13 //=============================================================================
16 #include <orb.idl>
17 #include "tao/AnyTypeCode/AnySeq.pidl"
19 interface Coffee
21 struct Desc
23 string name;
26 attribute Desc description; // provides us the coffee object type
29 //typedef sequence<Coffee> ObjSeq;
31 interface Param_Test
33 // Add exceptions to each
35 // primitive types
36 short test_short (in short s1,
37 inout short s2,
38 out short s3);
40 // NOTE: use unsigned long long instead of long long, because
41 // unsigned long long has much better support on platforms that
42 // do not have a native 64 bit int type.
43 unsigned long long test_ulonglong (in unsigned long long s1,
44 inout unsigned long long s2,
45 out unsigned long long s3);
47 // strings unbounded
48 string test_unbounded_string (in string s1,
49 inout string s2,
50 out string s3);
52 // strings bounded
53 typedef string<128> short_string;
54 short_string test_bounded_string (in short_string s1,
55 inout short_string s2,
56 out short_string s3);
58 // wstrings unbounded
59 wstring test_unbounded_wstring (in wstring ws1,
60 inout wstring ws2,
61 out wstring ws3);
63 // wstrings bounded
64 typedef wstring<128> short_wstring;
65 short_wstring test_bounded_wstring (in short_wstring ws1,
66 inout short_wstring ws2,
67 out short_wstring ws3);
69 // structures (fixed size)
70 struct Fixed_Struct
72 long l;
73 char c;
74 short s;
75 octet o;
76 float f;
77 boolean b;
78 double d;
81 Fixed_Struct test_fixed_struct (in Fixed_Struct s1,
82 inout Fixed_Struct s2,
83 out Fixed_Struct s3);
85 // = Sequences of long, strings, Var_Struct and Object
86 // references...
89 struct NameComponent
91 string id;
92 string kind;
95 struct Step
97 NameComponent name;
98 boolean process;
101 typedef sequence<Step> PathSpec;
103 PathSpec test_unbounded_struct_sequence (in PathSpec s1,
104 inout PathSpec s2,
105 out PathSpec s3);
106 CORBA::ShortSeq test_short_sequence (in CORBA::ShortSeq s1,
107 inout CORBA::ShortSeq s2,
108 out CORBA::ShortSeq s3);
110 typedef sequence<short,32> Bounded_Short_Seq;
111 Bounded_Short_Seq test_bounded_short_sequence (in Bounded_Short_Seq s1,
112 inout Bounded_Short_Seq s2,
113 out Bounded_Short_Seq s3);
115 CORBA::LongSeq test_long_sequence (in CORBA::LongSeq s1,
116 inout CORBA::LongSeq s2,
117 out CORBA::LongSeq s3);
119 typedef sequence<long,32> Bounded_Long_Seq;
120 Bounded_Long_Seq test_bounded_long_sequence (in Bounded_Long_Seq s1,
121 inout Bounded_Long_Seq s2,
122 out Bounded_Long_Seq s3);
124 CORBA::StringSeq test_strseq (in CORBA::StringSeq s1,
125 inout CORBA::StringSeq s2,
126 out CORBA::StringSeq s3);
128 typedef sequence<string,32> Bounded_StrSeq;
129 Bounded_StrSeq test_bounded_strseq (in Bounded_StrSeq s1,
130 inout Bounded_StrSeq s2,
131 out Bounded_StrSeq s3);
133 CORBA::WStringSeq test_wstrseq (in CORBA::WStringSeq ws1,
134 inout CORBA::WStringSeq ws2,
135 out CORBA::WStringSeq ws3);
137 typedef sequence<wstring,32> Bounded_WStrSeq;
138 Bounded_WStrSeq test_bounded_wstrseq (in Bounded_WStrSeq ws1,
139 inout Bounded_WStrSeq ws2,
140 out Bounded_WStrSeq ws3);
142 typedef sequence<Fixed_Struct> StructSeq;
143 StructSeq test_struct_sequence (in StructSeq s1,
144 inout StructSeq s2,
145 out StructSeq s3);
147 typedef sequence<Fixed_Struct,32> Bounded_StructSeq;
148 Bounded_StructSeq test_bounded_struct_sequence (in Bounded_StructSeq s1,
149 inout Bounded_StructSeq s2,
150 out Bounded_StructSeq s3);
152 typedef sequence<Coffee> Coffee_Mix;
153 Coffee_Mix test_coffe_mix (in Coffee_Mix s1,
154 inout Coffee_Mix s2,
155 out Coffee_Mix s3);
157 typedef sequence<Coffee,32> Bounded_Coffee_Mix;
158 Bounded_Coffee_Mix test_bounded_coffe_mix (in Bounded_Coffee_Mix s1,
159 inout Bounded_Coffee_Mix s2,
160 out Bounded_Coffee_Mix s3);
162 CORBA::AnySeq test_anyseq (in CORBA::AnySeq s1,
163 inout CORBA::AnySeq s2,
164 out CORBA::AnySeq s3);
166 /* typedef sequence<any, 32> Bounded_AnySeq;
167 Bounded_AnySeq test_bounded_anyseq (in Bounded_AnySeq s1,
168 inout Bounded_AnySeq s2,
169 out Bounded_AnySeq s3);
172 typedef string DUMMY;
173 // variable structures
174 struct Var_Struct
176 double dbl;
177 DUMMY dummy1;
178 boolean boole;
179 DUMMY dummy2;
180 short shrt;
181 CORBA::StringSeq seq;
184 Var_Struct test_var_struct (in Var_Struct s1,
185 inout Var_Struct s2,
186 out Var_Struct s3);
188 // nested structs (We reuse the var_struct defn above to make a very
189 // complicated nested structure)
190 struct Nested_Struct
192 Var_Struct vs;
195 Nested_Struct test_nested_struct (in Nested_Struct s1,
196 inout Nested_Struct s2,
197 out Nested_Struct s3);
199 // object references
200 Coffee make_coffee (); // make a Coffee object
202 // test the parameter passing conventions for ObjRefs
203 Coffee test_objref (in Coffee o1, inout Coffee o2, out Coffee o3);
205 // test typecodes
206 CORBA::TypeCode test_typecode (in CORBA::TypeCode t1,
207 inout CORBA::TypeCode t2,
208 out CORBA::TypeCode t3);
210 // Anys. We try to pump in all kinds of data types thru these Anys
211 any test_any (in any a1, inout any a2, out any a3);
213 struct Objref_Struct
215 long x;
216 Coffee y;
218 Objref_Struct test_objref_struct (in Objref_Struct t1,
219 inout Objref_Struct t2,
220 out Objref_Struct t3);
221 // test structures that contain object references.
223 // arrays (fixed)
224 const unsigned long DIM1 = 10;
225 typedef long Fixed_Array [DIM1];
227 Fixed_Array test_fixed_array (in Fixed_Array l1,
228 inout Fixed_Array l2,
229 out Fixed_Array l3);
231 // arrays (variable)
232 const unsigned long DIM2 = 5;
233 typedef string Var_Array [DIM2];
235 Var_Array test_var_array (in Var_Array v1,
236 inout Var_Array v2,
237 out Var_Array v3);
239 // Bounded and unbounced sequences of arrays.
240 typedef sequence<Fixed_Array> ArraySeq;
241 ArraySeq test_array_sequence (in ArraySeq s1,
242 inout ArraySeq s2,
243 out ArraySeq s3);
245 typedef sequence<Fixed_Array, 32> Bounded_ArraySeq;
246 Bounded_ArraySeq test_bounded_array_sequence (in Bounded_ArraySeq s1,
247 inout Bounded_ArraySeq s2,
248 out Bounded_ArraySeq s3);
250 // Just to test report a problem
251 exception Ooops {
252 string reason;
253 unsigned long input;
255 // To test what happens when an unexpected exception is thrown.
256 exception BadBoy {
258 unsigned long test_exception (in unsigned long s1,
259 inout unsigned long s2,
260 out unsigned long s3)
261 raises (Ooops);
263 typedef short short_array[32];
265 union Big_Union switch (short)
267 case 0:
268 Fixed_Array the_array;
269 case 1:
270 Coffee the_interface;
271 case 2:
272 long the_long;
273 case 3:
274 short_array another_array;
275 case 4:
276 string the_string;
277 case 5:
278 CORBA::ShortSeq the_sequence;
279 case 6:
280 any the_any;
281 case 7:
282 octet the_octet;
283 case 8:
284 char the_char;
285 case 9:
286 boolean the_boolean;
287 case 10:
288 Var_Struct the_var_struct;
289 case 11:
290 Fixed_Struct the_fixed_struct;
291 // case 12:
292 // Other_Union the_union;
295 Big_Union test_big_union (in Big_Union u1,
296 inout Big_Union u2,
297 out Big_Union u3);
299 enum Small_Union_Switch { A_LONG, A_SHORT };
300 union Small_Union switch (Small_Union_Switch)
302 case A_LONG:
303 long the_long;
304 case A_SHORT:
305 short the_short;
307 Small_Union test_small_union (in Small_Union u1,
308 inout Small_Union u2,
309 out Small_Union u3);
311 // The following two structs are used to help compose
312 // a complex Any for the test function below.
313 struct level4
315 string level5_string;
317 any level5_any;
320 struct level8
322 string level9_string;
324 boolean level9_boolean;
326 short level9_short;
329 any test_complex_any (in any ca1,
330 inout any ca2,
331 out any ca3);
333 // Recursive structs. Contains a sequence of itself.
334 struct Recursive_Struct;
335 typedef sequence<Recursive_Struct> RecStructSeq;
337 struct Recursive_Struct
339 long x;
341 RecStructSeq children;
344 Recursive_Struct test_recursive_struct (in Recursive_Struct rs1,
345 inout Recursive_Struct rs2,
346 out Recursive_Struct rs3);
348 // Recursive unions. We have one recursive union nested in a different
349 // recursive union.
350 union nested_rec_union;
351 typedef sequence<nested_rec_union> NestedSeq;
353 union nested_rec_union switch (short)
355 case 0: long value;
356 case 1: NestedSeq nested_rec_member;
359 union Recursive_Union;
360 typedef sequence<Recursive_Union> RecUnionSeq;
362 union Recursive_Union switch (short)
364 case 0: RecUnionSeq rec_member;
365 case 1: nested_rec_union nested_member;
368 Recursive_Union test_recursive_union (in Recursive_Union ru1,
369 inout Recursive_Union ru2,
370 out Recursive_Union ru3);
372 // multidimensional arrays (fixed). The following will give rise to a 3
373 // dimensional array. The following will define a 3-dimensional array of size
374 // DIM1 X DIM2 X DIM3
375 const unsigned long DIM3 = 3;
377 typedef Fixed_Array Multdim_Array [DIM2][DIM3];
379 Multdim_Array test_multdim_array (in Multdim_Array m1,
380 inout Multdim_Array m2,
381 out Multdim_Array m3);
383 // sequence of typecodes
384 // typedef sequence<TypeCode> TypeCodeSeq;
385 // TypeCodeSeq test_tcseq (in TypeCodeSeq t1, inout TypeCodeSeq t2, out TypeCodeSeq t3);
387 void shutdown ();
388 // Shutdown the server: this is useful to check for memory leaks,
389 // performance results and in general to verify that orderly
390 // shutdown is possible.
392 // test simple objects
393 // Object test_object (in Object o1, inout Object o2, out Object o3);