01: /*
02: * Copyright 1998-2001 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04: *
05: * This code is free software; you can redistribute it and/or modify it
06: * under the terms of the GNU General Public License version 2 only, as
07: * published by the Free Software Foundation. Sun designates this
08: * particular file as subject to the "Classpath" exception as provided
09: * by Sun in the LICENSE file that accompanied this code.
10: *
11: * This code is distributed in the hope that it will be useful, but WITHOUT
12: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14: * version 2 for more details (a copy is included in the LICENSE file that
15: * accompanied this code).
16: *
17: * You should have received a copy of the GNU General Public License version
18: * 2 along with this work; if not, write to the Free Software Foundation,
19: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20: *
21: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22: * CA 95054 USA or visit www.sun.com if you need additional information or
23: * have any questions.
24: */
25:
26: package org.omg.CORBA;
27:
28: import org.omg.CORBA.portable.Streamable;
29: import org.omg.CORBA.portable.InputStream;
30: import org.omg.CORBA.portable.OutputStream;
31:
32: /**
33: * The Holder for <tt>Fixed</tt>. For more information on
34: * Holder files, see <a href="doc-files/generatedfiles.html#holder">
35: * "Generated Files: Holder Files"</a>.<P>
36: * FixedHolder is a container class for values of IDL type "fixed",
37: * which is mapped to the Java class java.math.BigDecimal.
38: * It is usually used to store "out" and "inout" IDL method parameters.
39: * If an IDL method signature has a fixed as an "out" or "inout" parameter,
40: * the programmer must pass an instance of FixedHolder as the corresponding
41: * parameter in the method invocation; for "inout" parameters, the programmer
42: * must also fill the "in" value to be sent to the server.
43: * Before the method invocation returns, the ORB will fill in the contained
44: * value corresponding to the "out" value returned from the server.
45: *
46: * @version 1.14 09/09/97
47: */
48: public final class FixedHolder implements Streamable {
49: /**
50: * The value held by the FixedHolder
51: */
52: public java.math.BigDecimal value;
53:
54: /**
55: * Construct the FixedHolder without initializing the contained value.
56: */
57: public FixedHolder() {
58: }
59:
60: /**
61: * Construct the FixedHolder and initialize it with the given value.
62: * @param initial the value used to initialize the FixedHolder
63: */
64: public FixedHolder(java.math.BigDecimal initial) {
65: value = initial;
66: }
67:
68: /**
69: * Read a fixed point value from the input stream and store it in
70: * the value member.
71: *
72: * @param input the <code>InputStream</code> to read from.
73: */
74: public void _read(InputStream input) {
75: value = input.read_fixed();
76: }
77:
78: /**
79: * Write the fixed point value stored in this holder to an
80: * <code>OutputStream</code>.
81: *
82: * @param output the <code>OutputStream</code> to write into.
83: */
84: public void _write(OutputStream output) {
85: output.write_fixed(value);
86: }
87:
88: /**
89: * Return the <code>TypeCode</code> of this holder object.
90: *
91: * @return the <code>TypeCode</code> object.
92: */
93: public org.omg.CORBA.TypeCode _type() {
94: return ORB.init().get_primitive_tc(TCKind.tk_fixed);
95: }
96:
97: }
|