001: /*
002: * Copyright 1995-2001 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package org.omg.CORBA;
027:
028: import org.omg.CORBA.portable.Streamable;
029: import org.omg.CORBA.portable.InputStream;
030: import org.omg.CORBA.portable.OutputStream;
031:
032: /**
033: * The Holder for <tt>Double</tt>. For more information on
034: * Holder files, see <a href="doc-files/generatedfiles.html#holder">
035: * "Generated Files: Holder Files"</a>.<P>
036: * A Holder class for a <code>double</code>
037: * that is used to store "out" and "inout" parameters in IDL methods.
038: * If an IDL method signature has an IDL <code>double</code> as an "out"
039: * or "inout" parameter, the programmer must pass an instance of
040: * <code>DoubleHolder</code> as the corresponding
041: * parameter in the method invocation; for "inout" parameters, the programmer
042: * must also fill the "in" value to be sent to the server.
043: * Before the method invocation returns, the ORB will fill in the
044: * value corresponding to the "out" value returned from the server.
045: * <P>
046: * If <code>myDoubleHolder</code> is an instance of <code>DoubleHolder</code>,
047: * the value stored in its <code>value</code> field can be accessed with
048: * <code>myDoubleHolder.value</code>.
049: *
050: * @version 1.14, 09/09/97
051: * @since JDK1.2
052: */
053: public final class DoubleHolder implements Streamable {
054:
055: /**
056: * The <code>double</code> value held by this <code>DoubleHolder</code>
057: * object.
058: */
059:
060: public double value;
061:
062: /**
063: * Constructs a new <code>DoubleHolder</code> object with its
064: * <code>value</code> field initialized to 0.0.
065: */
066: public DoubleHolder() {
067: }
068:
069: /**
070: * Constructs a new <code>DoubleHolder</code> object for the given
071: * <code>double</code>.
072: * @param initial the <code>double</code> with which to initialize
073: * the <code>value</code> field of the new
074: * <code>DoubleHolder</code> object
075: */
076: public DoubleHolder(double initial) {
077: value = initial;
078: }
079:
080: /**
081: * Read a double value from the input stream and store it in the
082: * value member.
083: *
084: * @param input the <code>InputStream</code> to read from.
085: */
086: public void _read(InputStream input) {
087: value = input.read_double();
088: }
089:
090: /**
091: * Write the double value stored in this holder to an
092: * <code>OutputStream</code>.
093: *
094: * @param output the <code>OutputStream</code> to write into.
095: */
096: public void _write(OutputStream output) {
097: output.write_double(value);
098: }
099:
100: /**
101: * Return the <code>TypeCode</code> of this holder object.
102: *
103: * @return the <code>TypeCode</code> object.
104: */
105: public org.omg.CORBA.TypeCode _type() {
106: return ORB.init().get_primitive_tc(TCKind.tk_double);
107: }
108:
109: }
|