More tests update
[ACE_TAO.git] / TAO / tests / IDL_Test / array.idl
blob63febd22d689883b1aed45d29b6dd7a2c412c915
2 //=============================================================================
3 /**
4 * @file array.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 // Multidimensional arrays - constant vigilance.
18 typedef short TwoDArray[64][63];
20 typedef short ThreeDArray[64][63][62];
22 typedef short FourDArray[64][63][62][61];
24 // This problem is a combination of two others
25 // that have long been fixed, but you never know...
27 typedef long inside_array[5];
29 struct wrap
31 inside_array member;
34 typedef wrap outside_array[10];
37 // Once a problem with expressions in the brackets,
38 // as well as the typedef'd/anonymous thing.
40 interface tdef
42 const short byteslen = 12;
43 typedef octet Bytes[byteslen + 1];
45 struct bytes_or_longs
47 Bytes the_bytes; // typedef'd
48 long Longs[byteslen]; // anonymous
52 // To test that all the octet arrays build and link as
53 // unique types.
54 module ABCModule
56 struct RmtPhysicalInfo
58 octet rmtNodeId[22];
59 octet rmtDetails[22];
62 struct bbbBubBubBubBaby
64 octet rmtNodeId[22];
65 octet rmtDetails[22];
69 typedef octet oa1[22];
70 typedef octet oa2[22];
72 // Test generation of Arg_Traits specialization for identical
73 // arrays.
74 interface array_args
76 void all_arrays (in oa1 arg1,
77 in oa2 arg2);
80 // This should generate unique _var and _forany types, but
81 // also generate TAO_String_Manager as the element type for both.
82 module string_array
84 typedef string ArrayOfString[15];
85 typedef string MyString;
86 typedef MyString ArrayOfMyString[15];
89 // Checks code generation for arrays and typedefs of arrays
90 // when they are not declared globally or inside a module.
91 interface testdata
93 typedef char Arraychar[2];
94 typedef Arraychar ArrayDeChar;
96 struct struct2
98 Arraychar field_1;
99 ArrayDeChar field_2;
102 typedef sequence<Arraychar> ArraycharList;
103 typedef sequence<Arraychar,10> BdArraycharList;
105 typedef sequence<ArrayDeChar> ArrayDeCharList;
106 typedef sequence<ArrayDeChar,10> BdArrayDeCharList;
109 // Tests for explicit conversion of slice pointer to the
110 // corresponding forany class before using CDR or Any
111 // operators. This is required because myvec2_slice and
112 // myvec3_slice are the same type, so implicit conversion
113 // from myvec2_slice (in the case below) could go to
114 // myvec2_forany or myvec3_forany.
115 module arraytest
117 typedef string myvec2[2];
118 typedef string myvec3[3];
120 interface MyTest
122 void test_method (out myvec2 mystring);
126 // Caught the has_constructor() flag not being passed from the
127 // element type to the array in the AST.
128 module bug_2126
130 union FirstUnion switch (boolean)
132 case TRUE: long first_union_foo;
133 case FALSE: long first_union_bar;
136 typedef FirstUnion FirstUnionArray[2];
138 struct MyStruct
140 FirstUnionArray my_struct_foo;
143 union SecondUnion switch (boolean)
145 case TRUE: MyStruct second_union_struct_member;
146 case FALSE: long wibble;
149 typedef FirstUnion BdFirstUnionArray[2];
151 struct BdMyStruct
153 BdFirstUnionArray my_struct_foo;
156 union BdSecondUnion switch (boolean)
158 case TRUE: BdMyStruct second_union_struct_member;
159 case FALSE: long wibble;