tests/libjava-mauve/src/gnu/testlet/org/omg/CORBA/ORB/RF11/D_d_shortHelper.java
branchjk_new_structure
changeset 1541 75c2e24dea9a
parent 1540 92ac284961c1
child 1542 be11db817bcf
equal deleted inserted replaced
1540:92ac284961c1 1541:75c2e24dea9a
     1 // Tags: not-a-test
       
     2 // Copyright (c) 2000, 2001 NEC Corporation.
       
     3 
       
     4 // Adapted for Mauve by Audrius Meskauskas <audriusa@bluewin.ch>
       
     5 
       
     6 // This file is part of Mauve.
       
     7 
       
     8 // Mauve is free software; you can redistribute it and/or modify
       
     9 // it under the terms of the GNU General Public License as published by
       
    10 // the Free Software Foundation; either version 2, or (at your option)
       
    11 // any later version.
       
    12 
       
    13 // Mauve is distributed in the hope that it will be useful,
       
    14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    16 // GNU General Public License for more details.
       
    17 
       
    18 // You should have received a copy of the GNU General Public License
       
    19 // along with Mauve; see the file COPYING.  If not, write to
       
    20 // the Free Software Foundation, 59 Temple Place - Suite 330,
       
    21 // Boston, MA 02111-1307, USA.
       
    22 
       
    23 /*
       
    24 This code originally came from the OMG's CORBA Open Source Testing project,
       
    25 which lived at cost.omg.org. That site no longer exists.
       
    26 
       
    27 All the contributing companies agreed to release their tests under the
       
    28 terms of the GNU Lesser General Public License, available in the file
       
    29 COPYING.LIB.
       
    30 
       
    31 The code has been modified integrating into Mauve test environment and
       
    32 removing tests that are not yet supported by Suns jre 1.4. Hence the license
       
    33 is now GPL.
       
    34 
       
    35 We downloaded the code from http://sourceforge.net/projects/corba-cost/,
       
    36 administrated by Duncan Grisby.
       
    37 */
       
    38 
       
    39 // D
       
    40 package gnu.testlet.org.omg.CORBA.ORB.RF11;
       
    41 
       
    42 public abstract class D_d_shortHelper
       
    43 {
       
    44   private static String _id = "IDL:gnu/testlet/org/omg/CORBA/ORB/RF11/D_d_short:1.0";
       
    45 
       
    46   public static void insert(org.omg.CORBA.Any a, D_d_short that)
       
    47   {
       
    48     org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
       
    49     a.type(type());
       
    50     write(out, that);
       
    51     a.read_value(out.create_input_stream(), type());
       
    52   }
       
    53 
       
    54   public static D_d_short extract(org.omg.CORBA.Any a)
       
    55   {
       
    56     return read(a.create_input_stream());
       
    57   }
       
    58 
       
    59   private static org.omg.CORBA.TypeCode __typeCode = null;
       
    60 
       
    61   public static synchronized org.omg.CORBA.TypeCode type()
       
    62   {
       
    63     if (__typeCode == null)
       
    64       {
       
    65         org.omg.CORBA.TypeCode _disTypeCode0;
       
    66         _disTypeCode0 =
       
    67           org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
       
    68 
       
    69         org.omg.CORBA.UnionMember[] _members0 =
       
    70           new org.omg.CORBA.UnionMember[ 2 ];
       
    71         org.omg.CORBA.TypeCode _tcOf_members0;
       
    72         org.omg.CORBA.Any _anyOf_members0;
       
    73 
       
    74         // Branch for l1
       
    75         _anyOf_members0 = org.omg.CORBA.ORB.init().create_any();
       
    76         _anyOf_members0.insert_short((short) 1);
       
    77         _tcOf_members0 =
       
    78           org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
       
    79         _members0 [ 0 ] =
       
    80           new org.omg.CORBA.UnionMember("l1", _anyOf_members0, _tcOf_members0,
       
    81                                         null
       
    82                                        );
       
    83 
       
    84         // Branch for l2
       
    85         _anyOf_members0 = org.omg.CORBA.ORB.init().create_any();
       
    86         _anyOf_members0.insert_short((short) 2);
       
    87         _tcOf_members0 =
       
    88           org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
       
    89         _members0 [ 1 ] =
       
    90           new org.omg.CORBA.UnionMember("l2", _anyOf_members0, _tcOf_members0,
       
    91                                         null
       
    92                                        );
       
    93         __typeCode =
       
    94           org.omg.CORBA.ORB.init().create_union_tc(D_d_shortHelper.id(),
       
    95                                                    "D_d_short", _disTypeCode0,
       
    96                                                    _members0
       
    97                                                   );
       
    98       }
       
    99     return __typeCode;
       
   100   }
       
   101 
       
   102   public static String id()
       
   103   {
       
   104     return _id;
       
   105   }
       
   106 
       
   107   public static D_d_short read(org.omg.CORBA.portable.InputStream istream)
       
   108   {
       
   109     D_d_short value = new D_d_short();
       
   110     short _dis0 = (short) 0;
       
   111     _dis0 = istream.read_short();
       
   112     switch (_dis0)
       
   113       {
       
   114         case 1 :
       
   115 
       
   116           int _l1 = (int) 0;
       
   117           _l1 = istream.read_long();
       
   118           value.l1(_l1);
       
   119           break;
       
   120 
       
   121         case 2 :
       
   122 
       
   123           int _l2 = (int) 0;
       
   124           _l2 = istream.read_long();
       
   125           value.l2(_l2);
       
   126           break;
       
   127 
       
   128         default :
       
   129           throw new org.omg.CORBA.BAD_OPERATION();
       
   130       }
       
   131     return value;
       
   132   }
       
   133 
       
   134   public static void write(org.omg.CORBA.portable.OutputStream ostream,
       
   135                            D_d_short value
       
   136                           )
       
   137   {
       
   138     ostream.write_short(value.discriminator());
       
   139     switch (value.discriminator())
       
   140       {
       
   141         case 1 :
       
   142           ostream.write_long(value.l1());
       
   143           break;
       
   144 
       
   145         case 2 :
       
   146           ostream.write_long(value.l2());
       
   147           break;
       
   148 
       
   149         default :
       
   150           throw new org.omg.CORBA.BAD_OPERATION();
       
   151       }
       
   152   }
       
   153 }