UnionMemberHelper.java revision 608:7e06bf1dcb09
1238374Skib/*
2238374Skib * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
3238374Skib * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4238374Skib *
5238374Skib * This code is free software; you can redistribute it and/or modify it
6238374Skib * under the terms of the GNU General Public License version 2 only, as
7238374Skib * published by the Free Software Foundation.  Oracle designates this
8238374Skib * particular file as subject to the "Classpath" exception as provided
9238374Skib * by Oracle in the LICENSE file that accompanied this code.
10238374Skib *
11238374Skib * This code is distributed in the hope that it will be useful, but WITHOUT
12238374Skib * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13238374Skib * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14238374Skib * version 2 for more details (a copy is included in the LICENSE file that
15238374Skib * accompanied this code).
16238374Skib *
17238374Skib * You should have received a copy of the GNU General Public License version
18238374Skib * 2 along with this work; if not, write to the Free Software Foundation,
19238374Skib * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20238374Skib *
21238374Skib * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22238374Skib * or visit www.oracle.com if you need additional information or have any
23238374Skib * questions.
24238374Skib */
25238374Skibpackage org.omg.CORBA;
26238374Skib
27238374Skib
28238374Skib/**
29238374Skib* The Helper for <tt>UnionMember</tt>.  For more information on
30238374Skib* Helper files, see <a href="doc-files/generatedfiles.html#helper">
31238374Skib* "Generated Files: Helper Files"</a>.<P>
32238374Skib* org/omg/CORBA/UnionMemberHelper.java
33238374Skib* Generated by the IDL-to-Java compiler (portable), version "3.0"
34238374Skib* from ir.idl
35238374Skib* 03 June 1999 11:33:43 o'clock GMT+00:00
36238374Skib*/
37238374Skib
38238374Skibabstract public class UnionMemberHelper
39238374Skib{
40238374Skib  private static String  _id = "IDL:omg.org/CORBA/UnionMember:1.0";
41238374Skib
42238374Skib  public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.UnionMember that)
43238374Skib  {
44238374Skib    org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
45238374Skib    a.type (type ());
46238374Skib    write (out, that);
47238374Skib    a.read_value (out.create_input_stream (), type ());
48238374Skib  }
49238374Skib
50238374Skib  public static org.omg.CORBA.UnionMember extract (org.omg.CORBA.Any a)
51238374Skib  {
52238374Skib    return read (a.create_input_stream ());
53238374Skib  }
54238374Skib
55238374Skib  private static org.omg.CORBA.TypeCode __typeCode = null;
56238374Skib  private static boolean __active = false;
57238374Skib  synchronized public static org.omg.CORBA.TypeCode type ()
58238374Skib  {
59238374Skib    if (__typeCode == null)
60238374Skib    {
61238374Skib      synchronized (org.omg.CORBA.TypeCode.class)
62238374Skib      {
63238374Skib        if (__typeCode == null)
64238374Skib        {
65238374Skib          if (__active)
66238374Skib          {
67238374Skib            return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
68238374Skib          }
69238374Skib          __active = true;
70238374Skib          org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [4];
71238374Skib          org.omg.CORBA.TypeCode _tcOf_members0 = null;
72238374Skib          _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
73238374Skib          _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0);
74238374Skib          _members0[0] = new org.omg.CORBA.StructMember (
75238374Skib            "name",
76238374Skib            _tcOf_members0,
77238374Skib            null);
78238374Skib          _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_any);
79238374Skib          _members0[1] = new org.omg.CORBA.StructMember (
80238374Skib            "label",
81238374Skib            _tcOf_members0,
82238374Skib            null);
83238374Skib          _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode);
84238374Skib          _members0[2] = new org.omg.CORBA.StructMember (
85238374Skib            "type",
86238374Skib            _tcOf_members0,
87238374Skib            null);
88238374Skib          _tcOf_members0 = org.omg.CORBA.IDLTypeHelper.type ();
89238374Skib          _members0[3] = new org.omg.CORBA.StructMember (
90238374Skib            "type_def",
91238374Skib            _tcOf_members0,
92238374Skib            null);
93238374Skib          __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (org.omg.CORBA.UnionMemberHelper.id (), "UnionMember", _members0);
94238374Skib          __active = false;
95238374Skib        }
96238374Skib      }
97238374Skib    }
98238374Skib    return __typeCode;
99238374Skib  }
100238374Skib
101238374Skib  public static String id ()
102238374Skib  {
103238374Skib    return _id;
104238374Skib  }
105238374Skib
106238374Skib  public static org.omg.CORBA.UnionMember read (org.omg.CORBA.portable.InputStream istream)
107238374Skib  {
108238374Skib    org.omg.CORBA.UnionMember value = new org.omg.CORBA.UnionMember ();
109238374Skib    value.name = istream.read_string ();
110238374Skib    value.label = istream.read_any ();
111238374Skib    value.type = istream.read_TypeCode ();
112238374Skib    value.type_def = org.omg.CORBA.IDLTypeHelper.read (istream);
113238374Skib    return value;
114238374Skib  }
115238374Skib
116238374Skib  public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.UnionMember value)
117238374Skib  {
118238374Skib    ostream.write_string (value.name);
119238374Skib    ostream.write_any (value.label);
120238374Skib    ostream.write_TypeCode (value.type);
121238374Skib    org.omg.CORBA.IDLTypeHelper.write (ostream, value.type_def);
122238374Skib  }
123238374Skib
124238374Skib}
125238374Skib