2 //=============================================================================
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
12 * @author Jeff Parsons <parsons@cs.wustl.edu> and TAO users.
14 //=============================================================================
17 // Implicit default case
26 union Data
switch (DataType
)
28 case dtLong
: long longData
;
29 case dtShort
: short shortData
;
30 // by default, empty union
33 // Explicit default case
37 // It is important to have a module, in which
38 // the following union is declared.
48 union WhichResult
switch (Kind
)
50 case e_Result
: Result m_Result
;
51 default: long m_Unused
;
55 // Union with negative cases
56 union foo
switch (short)
60 case -1: string foo_str_member
;
61 default: long foo_iface_member
;
62 case 0: long foo_iface_member2
;
65 // Make sure that CORBA_Any::to_* is used everywhere.
68 union BooleanUnion
switch (boolean)
70 case TRUE
: string value
;
73 union CharUnion
switch (char)
75 case 'a'
: string value
;
81 union OneBranchT
switch (boolean) { case TRUE
: octet val
; };
82 union OneBranchF
switch (boolean) { case FALSE
: octet val
; };
83 union OneBranchD
switch (boolean) { default: octet val
; };
84 union OneBranchTF
switch (boolean) { case TRUE
: case FALSE
: octet val
; };
85 union OneBranchFT
switch (boolean) { case FALSE
: case TRUE
: octet val
; };
86 union OneBranchTD
switch (boolean) { case TRUE
: default: octet val
; };
87 union OneBranchDT
switch (boolean) { default: case TRUE
: octet val
; };
88 union OneBranchFD
switch (boolean) { case FALSE
: default : octet val
; };
89 union OneBranchDF
switch (boolean) { default: case FALSE
: octet val
; };
90 union TwoBranchesTF
switch (boolean) { case TRUE
: octet val1
; case FALSE
: char val2
; };
91 union TwoBranchesFT
switch (boolean) { case FALSE
: octet val1
; case TRUE
: char val2
; };
92 union TwoBranchesTD
switch (boolean) { case TRUE
: octet val1
; default: char val2
; };
93 union TwoBranchesDT
switch (boolean) { default: octet val1
; case TRUE
: char val2
; };
94 union TwoBranchesFD
switch (boolean) { case FALSE
: octet val1
; default: char val2
; };
95 union TwoBranchesDF
switch (boolean) { default: octet val1
; case FALSE
: char val2
; };
118 union inner1
switch (disc1
)
124 union inner2
switch (disc2
)
130 union outer
switch (disc_outer
)
132 case out1
: inner1 first
;
133 case out2
: inner2 second
;
144 union ValType
switch(ValChoice
)
146 case intVal
: long integerValue
;
147 case realVal
: double realValue
;
168 union IndType
switch(IndChoice
)
170 case up_Level
: UpType up
;
171 case down_Level
: DownType down
;
175 // Make sure inner union is generated in header file with
176 // proper scoping (or lack thereof) in its name, depending
188 union X
switch (XType
)
193 union Z
switch (ZType
)
200 // Example involving union members with multiple case labels.
208 union FieldValue
switch (FieldType
)
223 // A fix to the IDL compiler's typecode generation created
224 // a problem with unions that have more than one member,
225 // where any member except the last is itself a scoped type.
226 // This is the simplest example that will reproduce the problem,
227 // if it ever reappears.
240 union TestUnion
switch (short)
242 case 1: TestOneEnum oneEnum
;
243 case 2: TestTwoEnum twoEnum
;
246 typedef long U41
[2][3];
249 union U85
switch (long) {
254 typedef string UString
[2];
255 union U86
switch (long) {
256 case 1: string b_86_1
;
259 union U88
switch (long) {
260 case 1: UString b_86_1
;
267 typedef UBar UBarArray
[2];
269 union U87
switch (long) {
273 union U89
switch (long) {
274 case 1: UBarArray b_87_1
;
284 typedef U90 U90Array
[2];
286 union U91
switch (long) {
287 case 1: U90Array b_91_1
;
291 union U92
switch (long) {
294 default: UBar b_92_3
;
297 union U93
switch (long) {
298 case 1: UBarArray b_93_1
;
300 default: UBarArray b_93_3
;
303 union U94
switch (long) {
304 case 1: U90Array b_94_1
;
306 default: U90Array b_94_3
;