summaryrefslogtreecommitdiff
path: root/trunk/TAO/tests/IDL_Test/array.idl
blob: f39886a127979de75a97eab5217d9644fde2405e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO/tests/IDL_Test
//
// = FILENAME
//    array.idl
//
// = DESCRIPTION
//    This file contains examples of IDL code that has
//    caused problems in the past for the TAO IDL
//    compiler. This test is to make sure the problems
//    stay fixed.
//
// = AUTHORS
//    Jeff Parsons <parsons@cs.wustl.edu> and TAO users.
//
// ============================================================================

// Multidimensional arrays - constant vigilance.
typedef short TwoDArray[64][63];

typedef short ThreeDArray[64][63][62];

typedef short FourDArray[64][63][62][61];

// This problem is a combination of two others
// that have long been fixed, but you never know...

typedef long inside_array[5];

struct wrap
  {
    inside_array member;
  };

typedef wrap outside_array[10];


// Once a problem with expressions in the brackets,
// as well as the typedef'd/anonymous thing.

interface tdef
{
  const short byteslen = 12;
  typedef octet Bytes[byteslen + 1];

  struct bytes_or_longs
    {
      Bytes the_bytes;	          // typedef'd
      long Longs[byteslen];       // anonymous
    };
};

// To test that all the octet arrays build and link as
// unique types.
module ABCModule
{
  struct RmtPhysicalInfo
  {
    octet rmtNodeId[22];
    octet rmtDetails[22];
  };

  struct bbbBubBubBubBaby
  {
    octet rmtNodeId[22];
    octet rmtDetails[22];
  };
};

typedef octet oa1[22];
typedef octet oa2[22];

// Test generation of Arg_Traits specialization for identical
// arrays.
interface array_args
{
  void all_arrays (in oa1 arg1,
                   in oa2 arg2);
};

// This should generate unique _var and _forany types, but
// also generate TAO_String_Manager as the element type for both.
module string_array
{
  typedef string ArrayOfString[15];
  typedef string MyString;
  typedef MyString ArrayOfMyString[15];
};

// Checks code generation for arrays and typedefs of arrays
// when they are not declared globally or inside a module.
interface testdata
{
  typedef char Arraychar[2];
  typedef Arraychar ArrayDeChar;

  struct struct2
  {
    Arraychar field_1;
    ArrayDeChar field_2;
  };

  typedef sequence<Arraychar> ArraycharList;
  typedef sequence<Arraychar,10> BdArraycharList;

  typedef sequence<ArrayDeChar> ArrayDeCharList;
  typedef sequence<ArrayDeChar,10> BdArrayDeCharList;
};

// Tests for explicit conversion of slice pointer to the
// corresponding forany class before using CDR or Any
// operators. This is required because myvec2_slice and
// myvec3_slice are the same type, so implicit conversion
// from myvec2_slice (in the case below) could go to
// myvec2_forany or myvec3_forany.
module arraytest
{
  typedef string myvec2[2];
  typedef string myvec3[3];

  interface MyTest
  {
    void test_method (out myvec2 mystring);
  };
};

// Caught the has_constructor() flag not being passed from the
// element type to the array in the AST.
module bug_2126
{
  union FirstUnion switch (boolean)
  {
    case TRUE: long first_union_foo;
    case FALSE: long first_union_bar;
  };

  typedef FirstUnion FirstUnionArray[2];

  struct MyStruct
  {
    FirstUnionArray my_struct_foo;
  };

  union SecondUnion switch (boolean)
  {
    case TRUE: MyStruct second_union_struct_member;
    case FALSE: long wibble;
  };

  typedef FirstUnion BdFirstUnionArray[2];

  struct BdMyStruct
  {
    BdFirstUnionArray my_struct_foo;
  };

  union BdSecondUnion switch (boolean)
  {
    case TRUE: BdMyStruct second_union_struct_member;
    case FALSE: long wibble;
  };
};