summaryrefslogtreecommitdiff
path: root/TAO/tests/IDL_Test/interface.idl
blob: d5e713d6e44c09626a7526a082e20a9a1bb9285c (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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO/tests/IDL_Test
//
// = FILENAME
//    interface.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.
//
// ============================================================================

// Used to be a problem in the get() and set()
// generated code.

interface Base
{
  attribute long value;
};

interface Derived : Base
{
};

// The fact that the interface begins with 'foo' was causing
// problems. The IDL compiler thought the interface was in
// foo's scope.
module foo_mod
{
  struct date
    {
      short month;
    };
};

interface foostep
{
  foo_mod::date getDate ();
};

// Only operations or attributes should cause a clash
// in this type of situation.
interface mother
{
  struct member
    {
      long val;
    };
};

interface father
{
  struct member
    {
      short ident;
    };
};

interface child : mother, father
{
};

interface try
{
};

// Definition below in file.
interface later;

typedef boolean Bool;

interface later_user
{
  later op (in later inarg,
            inout later inoutarg,
            out later outarg);


  // Not a clash with the C++ keyword because they are case sensitive,
  // but the Arg_Traits<> specialization parameter (ACE_InputCDR::to_boolean)
  // needs the unaliased type name to work.
  void op2 (in Bool inarg2);
};

struct later_holder
{
  later member;
};

interface later {};

// Previously, we could have found v if it
// was inherited into Client, but not in
// the case below, where it is inherited into
// somewhere other than the scope where the
// lookup starts.

interface Begin
{
  typedef long Value;
};

interface Middle : Begin
{
};

interface End : Middle
{
};

interface Client
{
  attribute End::Value v;
};

// Tests arg_traits visitor for unaliased bounded (w)string
// attributes.
interface AttributeTester
{
  attribute string a_su;
  attribute string<1> a_sb;
};

// All of the 'recursion' below is legal.
module ParamMod
{
  interface ParameterTester
  {
    exception object_excep_type
    {
      ParameterTester objref;
    };

    typedef sequence<ParameterTester> object_seq_type;

    typedef ParameterTester object_array_type[5];

    struct object_struct_type
    {
      octet o1;
      ParameterTester p1;
      long l1;
    };

    union object_union_type switch (long)
    {
      case 0: string str;
      case 1: ParameterTester pt;
    };

    object_seq_type parameter_tester_op (
        in object_struct_type inarg,
        inout object_array_type inoutarg,
        out object_union_type outarg
      )
      raises (object_excep_type);
  };
};

local interface testlocal
{
};

interface A {
  union U switch(boolean)
  {
    case TRUE: A aa;
  };
};

module M
{
  interface A;
};

module M
{
  interface A;

  interface A {};
};

module i1
{
  interface if1
  {
    string getStr();
  };
};

module i2
{
  interface if2 : ::i1::if1
    {
      string getstr2();
    };

  interface if3 : ::i2::if2
    {
      string getstr3();
    };
};

/// Tests acceptance of legal redefinitions (of
/// constants, exceptions and types) in a derived
/// interface.
module redefs
{
  interface base
  {
    const long lconst = -5;
    
    exception ex
    {
      string info;
    };
    
    struct foo
    {
      short index;
    };
  };

  interface derived : base
  {
    const long lconst = 44;
    
    exception ex
    {
      long serial;
    };
    
    struct foo
    {
      string str;
    };
  };
};