// $Id: interface.idl 90153 2010-05-17 21:56:29Z parsons $

// ============================================================================
//
// = 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();
    };
};
