//
// %CopyrightBegin%
//
// Copyright Ericsson AB 1999-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%
//

#ifndef _ORBER_TEST_SERVER_IDL
#define _ORBER_TEST_SERVER_IDL
#pragma prefix "omg.org"

module orber_parent {
  interface inherrit {
    void print();
  };
};

module orber_test { 

  // interface server
  interface server : orber_parent::inherrit {
    typedef string array[2];
    typedef sequence <long, 3> seq;
    typedef wstring<6> WstrLength6;
    typedef string<6> StrLength6;

    struct  struc {long a; short b;};
    union uni switch(long) {
    case 1: long a;}; 
      
    union uni_d switch(long) {
    case 1: long a;
    default: boolean b;
    }; 
    enum enumerant {one, two};

    exception UserDefinedException {};

    typedef sequence<struc> StrucSeq;
    typedef sequence<uni> UniSeq;
    exception ComplexUserDefinedException { StrucSeq strseq; };

    // Testing fixed
    const fixed val1 = 3.14D;
    const fixed val2 = 003.14D;
    const fixed val3 = 003.1400D;
    const fixed val4 = 3.1400D;
    const fixed val5 = .1400D;
    const fixed val6 = 3.D;
    const fixed val7 = -.1400D;
    const fixed val8 = -3.D;
    const fixed val9 = val4+val5;
    const fixed val10 = val4*val5;
    const fixed val11 = val4/val5;
    const fixed val12 = 123.140001D;
    const fixed val13 = 12314000.1D;
    const fixed val14 = val12-val13;
    const fixed val15 = val12+val13;
    const fixed val16 = val12*val13;
    const fixed val17 = 2.01D+2.01D;
    const fixed val18 = 2.01D*2.01D;
    const fixed val19 = 200D;
    const fixed val20 = 9999999999999999999999999999999D+9999999999999999999999999999999D;
    const fixed val21 = 9999999999999999999999999999999D-9999999999999999999999999999999D;
    const fixed val22 = 9999999999999999999999999999999D*9999999999999999999999999999999D;
    const fixed val23 = 9999999999999999999999999999999D/9999999999999999999999999999999D;
    const fixed val24 = 9999D+9999D;
    const fixed val25 = 400D/10D;
    const fixed val26 = 9999999999999999999999999999999D;


    typedef fixed<5,2> fixed52;
    const fixed52 fixed52const1 = 123.45d;
    const fixed52 fixed52const2 = 123.00d;
    const fixed52 fixed52const3 = 023.00d;
    const fixed52 fixed52negconst1 = -123.45d;
    const fixed52 fixed52negconst2 = -123.00d;
    const fixed52 fixed52negconst3 = -023.00d;

    struct rec_struct; // Forward declaration
    typedef sequence<rec_struct> rec_struct_seq;
    struct rec_struct {
	rec_struct_seq chain;
    };
    
    
    union rec_union; // Forward declaration
    typedef sequence<rec_union>rec_union_seq;
    
    enum MyEnum {RecursiveType, NameType};
    
    union rec_union switch (MyEnum) {
    case RecursiveType : rec_union_seq chain;
    case NameType :  string aName;
    };
    
    void stop_normal();

    void stop_brutal();

    // Testing encode and decode
    void testing_iiop_float(inout  float          Fl);
    void testing_iiop_double(inout double         Do);
    void testing_iiop_short(inout  short          Sh);
    void testing_iiop_ushort(inout unsigned short Us);
    void testing_iiop_long(inout   long           Lo);
    void testing_iiop_longlong(inout long long   LLo);
    void testing_iiop_ulong(inout  unsigned long  Ulo);
    void testing_iiop_ulonglong(inout unsigned long long LLo);
    void testing_iiop_char(inout   char           Ch);
    void testing_iiop_wchar(inout   wchar         WCh);
    void testing_iiop_bool(inout   boolean        Bool);
    void testing_iiop_octet(inout  octet          Oct);
    void testing_iiop_any(inout    any            AnyType);
    void testing_iiop_obj(inout    Object         Obj);
    void testing_iiop_string(inout StrLength6     Str);
    void testing_iiop_wstring(inout WstrLength6   WStr);
    void testing_iiop_struct(inout struc          Stru);
    void testing_iiop_union(inout  uni            Uni);
    void testing_iiop_union_d(inout  uni_d        Uni);
    void testing_iiop_enum(inout   enumerant      Enumerant);
    void testing_iiop_seq(inout    seq            Seq);
    void testing_iiop_uni_seq(inout    UniSeq     USeq);
    void testing_iiop_struc_seq(inout  StrucSeq   SSeq);
    void testing_iiop_array(inout  array          Arr);
    void testing_iiop_fixed(inout  fixed52        MyFixed);
    void testing_iiop_void();
    void testing_iiop_context();
    void testing_iiop_server_marshal(inout StrLength6 Str);

    // Recursive types
    any testing_iiop_rec_any(in any RecType);
    rec_struct testing_iiop_rec_struct(in rec_struct RecS);
    rec_union testing_iiop_rec_union(in rec_union RecU);


    oneway void testing_iiop_oneway_delay(in long Time);
    void testing_iiop_twoway_delay(in long Time);

    // Testing relay calls/casts to, for example, test that sending implicit
    // Contexts works.
    void relay_call(in Object Target);
    oneway void relay_cast(in Object Target);

    // Testing pseudo calls/casts
    void pseudo_call();
    oneway void pseudo_cast();
    void pseudo_call_delay(inout    long           Lo);
    oneway void pseudo_cast_delay(in long         Lo);
    void pseudo_call_raise_exc(in  long           Lo);
    void raise_local_exception() 
      raises(UserDefinedException);
    void raise_complex_local_exception() 
      raises(ComplexUserDefinedException);
  };
 
  interface timeout_server {
    oneway void oneway_function(in long time);
    void twoway_function(in long time);
  };
 
}; 
 
#endif
