// $Id: enum_in_struct.idl 55314 2004-01-10 00:04:15Z bala $

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

// Tests for correct parsing and code generation for
// both named and anonymous enums in a struct.

enum UnNamed
  {
    UNNAMED_FIRST,
    UNNAMED_SECOND,
    UNNAMED_THIRD
  };

struct HoldsEnum
{
  enum Named 
    { 
      NAMED_FIRST, 
      NAMED_SECOND, 
      NAMED_THIRD 
    } named_enum;

  UnNamed unnamed_enum;
};

// Test for anonymous arrays of member declarations

struct decl_heavy_struct
{
  enum str_en 
  {
    a, 
    b, 
    c
  } m_en[10];

  struct st 
  {
    long a; 
    char b;
  } m_st[10];

  union un switch (long) 
  {
    case 1: long a; 
    case 2: char b;
  } m_un[10];
};

// Similar case for exception included here - no sense
// in making a separte file for exceptions, which are
// almost the same as structs.

exception ErrorException
{
  enum ReasonCode
  {
    RESOURCE,
    COMMUNICATION,
    ASSERTION,
    STATE,
    ALREADY,
    OTHER
  } reason;
};

