//
// %CopyrightBegin%
//
// Copyright Ericsson AB 1997-2010. All Rights Reserved.
//
// The contents of this file are subject to the Erlang Public License,
// Version 1.1, (the "License"); you may not use this file except in
// compliance with the License. You should have received a copy of the
// Erlang Public License along with this software. If not, it can be
// retrieved online at http://www.erlang.org/.
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
// the License for the specific language governing rights and limitations
// under the License.
//
// %CopyrightEnd%
//
#include "cos_naming.idl"

module iiop_module
{

  typedef long Array1[10];

  enum Enum1 {horse, pig, cow};

  typedef sequence<long> Sequence1;

  typedef Sequence1 Sequence2;

  struct Struct1 {
    string s;
    unsigned short us;
    unsigned long ul;
  };

  union Union1 switch (short) {
  case 0: short First;
  case 1: string Second;
  case 2: char Third;
  };

  exception Except1 {
    string why;
    sequence <string> rest_of_name;
  };
 
  typedef sequence<any> test_values;
  struct test_retval {
    test_values R;
    test_values InOut;
    test_values Out;
  };

  interface test;

  interface do_test {
    void run_systemexception(in test x) 
      raises(CosNaming::NamingContext::NotFound,
	     CosNaming::NamingContext::CannotProceed,
	     CosNaming::NamingContext::InvalidName);
    void run_userexception(in test x)
      raises(iiop_module::Except1,
	     CosNaming::NamingContext::NotFound,
	     CosNaming::NamingContext::CannotProceed,
	     CosNaming::NamingContext::InvalidName);
    test_retval run_all(in test x, in test_values tlist)
      raises(iiop_module::Except1,
	     CosNaming::NamingContext::NotFound,
	     CosNaming::NamingContext::CannotProceed,
	     CosNaming::NamingContext::InvalidName);
  };
  
  interface test {
    // Function to run all tests from java to erlang 
    // and return the answers
    // Primitive types
    void send_void();
    short send_short(in short p1, inout short p2, out short p3);
    unsigned short send_ushort(in unsigned short p1, inout unsigned short p2,
			       out unsigned short  p3);
    long send_long(in long p1, inout long p2, out long p3);
    unsigned long send_ulong(in unsigned long p1, inout unsigned long p2,
			     out unsigned long p3);
    float send_float(in float p1, inout float p2, out float p3);
    double send_double(in double p1, inout double p2, out double p3);
    boolean send_boolean(in boolean p1, inout boolean p2, out boolean p3);
    char send_char(in char p1, inout char p2, out char p3);
    octet send_octet(in octet p1, inout octet p2, out octet p3);
    any send_any(in any p1, inout any p2, out any p3);
    Object send_object(in Object p1, inout Object p2, out Object p3);
    //    TypeCode send_typecode(in TypeCode p1, inout TypeCode p2, out TypeCode p3);
    //    Principal send_principal(in Principal p); //tested in every request

    // Complex types    
    Struct1 send_struct1(in Struct1 p1, inout Struct1 p2, out Struct1 p3);
    Union1 send_union1(in Union1 p1, inout Union1 p2, out Union1 p3);
    Enum1 send_enum1(in Enum1 p1, inout Enum1 p2, out Enum1 p3);
    string send_string(in string p1, inout string p2, out string p3);
    Sequence1 send_sequence1(in Sequence1 p1, inout Sequence1 p2, 
			     out Sequence1 p3);
    Array1 send_array1(in Array1 p1, inout Array1 p2, out Array1 p3);

    void ret_systemexception();
    void ret_userexception() raises(iiop_module::Except1);

   
  };

};