
//=============================================================================
/**
 *  @file    enum_in_struct.idl
 *
 *  $Id: enum_in_struct.idl 93677 2011-03-29 12:36:41Z johnnyw $
 *
 *  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 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;
};

