summaryrefslogtreecommitdiff
path: root/TAO/tests/IDL_Test/valuetype.idl
blob: 804ead729478d0c3feaf26be22363bc32e6c122b (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
//=============================================================================

/**
 *  @file    valuetype.idl
 *
 *  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.
 *
 *
 *  @author Gary Duzan <gduzan@bbn.com> Jeff Parsons <j.parsons@vanderbilt.edu>
 */

//=============================================================================


#ifndef IDL_TEST_VALUETYPE_IDL
#define IDL_TEST_VALUETYPE_IDL

#include "included.idl"

// A valuetype factory can have exceptions, so the declaration must pull in
// an #include of SystemException.h.

valuetype MyValueType
{
  public string my_string_value;
  factory make_one ();
};

enum ValueSort2 {
  SYMBOL_TYPE2
};

union MyValueTypeUnion switch (ValueSort2) {
  case SYMBOL_TYPE2:
    MyValueType symbol_val;
};

// The original bug was caused by the default factory visitor
// constructing a temporary arg of this field type. When the
// arg was then destroyed, it called its base destroyer
// AST_Field::destroy() which in turn destroyed the member
// because it was anonymous. This declaration was copied from
// an unautomated TAO/tests directory and authored by Simon McQueen
// <sm@prismtechnologies>.
valuetype RecValueType
{
  private sequence<RecValueType> rec_value_types;
  private sequence<RecValueType,2> rec_value_types2;
};

// Inherits an anonymous sequence member, which was not named
// correctly in the original bug when used in the arglist for
// this valuetype's constructor from values.
valuetype GetsDeprecatedMember : IncludedBase
{
  public string StringMember;
};

module X
{
  abstract valuetype AXXX
  {
    Object make_object ();
  };

  abstract valuetype BXXX : AXXX
  {
  };
  typedef sequence<BXXX> BSeq;
};

// The original problem with the construct below was probably the
// union member, but other features from the original example IDL
// have been left in just in case.
module ModSelection
{
  module SelectionDefns
  {
    abstract valuetype Criterion
    {
      void setCriterionRequiredAttributes (inout string theSelectedAttrs);
      boolean isValid (in wstring theTrackSelectionAttrs);
    };

    valuetype CriterionExpr : Criterion
    {
      struct RightCriterionInfos
      {
        long theCriterionId;
        CriterionExpr theRightExpr;
      };

      union RightCriterionExpr switch (boolean)
      {
        case TRUE: string theRightCriterionInfos;
      };

      public Criterion theLeftCriterion;
      public RightCriterionExpr theRightCriterionExpr;

      factory createWithCriterionLink (in Criterion theLeftCriterion,
                                       in string link,
                                       in CriterionExpr theRightCriterion);

      factory createWithSingleCriterion (in Criterion theSingleCriterion);
    };
  };
};

#endif /* IDL_TEST_VALUETYPE_IDL */