duke@1: /* xdono@13: * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. duke@1: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@1: * duke@1: * This code is free software; you can redistribute it and/or modify it duke@1: * under the terms of the GNU General Public License version 2 only, as duke@1: * published by the Free Software Foundation. Sun designates this duke@1: * particular file as subject to the "Classpath" exception as provided duke@1: * by Sun in the LICENSE file that accompanied this code. duke@1: * duke@1: * This code is distributed in the hope that it will be useful, but WITHOUT duke@1: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@1: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@1: * version 2 for more details (a copy is included in the LICENSE file that duke@1: * accompanied this code). duke@1: * duke@1: * You should have received a copy of the GNU General Public License version duke@1: * 2 along with this work; if not, write to the Free Software Foundation, duke@1: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@1: * duke@1: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, duke@1: * CA 95054 USA or visit www.sun.com if you need additional information or duke@1: * have any questions. duke@1: */ duke@1: duke@1: // IDL duke@1: // File: DynamicAny.idl duke@1: duke@1: #ifndef _DYNAMIC_ANY_IDL_ duke@1: #define _DYNAMIC_ANY_IDL_ duke@1: duke@1: #pragma prefix "omg.org" duke@1: #include duke@1: duke@1: /** duke@1: * An any can be passed to a program that doesn't have any static information for the duke@1: type of the any (code generated for the type by an IDL compiler has not been duke@1: compiled with the object implementation). As a result, the object receiving the any duke@1: does not have a portable method of using it. duke@1:

DynAnys enable traversal of the data value associated with an any at duke@1: runtime and extraction of the primitive constituents of the data value. This is especially duke@1: helpful for writing powerful generic servers (bridges, event channels supporting duke@1: filtering). duke@1:

Similarly, this facility enables the construction of an any at runtime, without having duke@1: static knowledge of its type. This is especially helpful for writing generic clients duke@1: (bridges, browsers, debuggers, user interface tools). duke@1: */ duke@1: module DynamicAny { duke@1: /** duke@1: * Any values can be dynamically interpreted (traversed) and constructed through DynAny objects. duke@1: * A DynAny object is associated with a data value which corresponds to a copy of the value duke@1: * inserted into an any. duke@1: *

A DynAny object may be viewed as an ordered collection of component DynAnys. duke@1: * For DynAnys representing a basic type, such as long, or a type without components, duke@1: * such as an empty exception, the ordered collection of components is empty. duke@1: * Each DynAny object maintains the notion of a current position into its collection duke@1: * of component DynAnys. The current position is identified by an index value that runs duke@1: * from 0 to n-1, where n is the number of components. duke@1: * The special index value -1 indicates a current position that points nowhere. duke@1: * For values that cannot have a current position (such as an empty exception), duke@1: * the index value is fixed at -1. duke@1: * If a DynAny is initialized with a value that has components, the index is initialized to 0. duke@1: * After creation of an uninitialized DynAny (that is, a DynAny that has no value but a TypeCode duke@1: * that permits components), the current position depends on the type of value represented by duke@1: * the DynAny. (The current position is set to 0 or -1, depending on whether the new DynAny duke@1: * gets default values for its components.) duke@1: *

The iteration operations rewind, seek, and next can be used to change the current position duke@1: * and the current_component operation returns the component at the current position. duke@1: * The component_count operation returns the number of components of a DynAny. duke@1: * Collectively, these operations enable iteration over the components of a DynAny, for example, duke@1: * to (recursively) examine its contents. duke@1: *

A constructed DynAny object is a DynAny object associated with a constructed type. duke@1: * There is a different interface, inheriting from the DynAny interface, associated with duke@1: * each kind of constructed type in IDL (fixed, enum, struct, sequence, union, array, duke@1: * exception, and value type). duke@1: *

A constructed DynAny object exports operations that enable the creation of new DynAny objects, duke@1: * each of them associated with a component of the constructed data value. duke@1: * As an example, a DynStruct is associated with a struct value. This means that the DynStruct duke@1: * may be seen as owning an ordered collection of components, one for each structure member. duke@1: * The DynStruct object exports operations that enable the creation of new DynAny objects, duke@1: * each of them associated with a member of the struct. duke@1: *

If a DynAny object has been obtained from another (constructed) DynAny object, duke@1: * such as a DynAny representing a structure member that was created from a DynStruct, duke@1: * the member DynAny is logically contained in the DynStruct. duke@1: * Calling an insert or get operation leaves the current position unchanged. duke@1: * Destroying a top-level DynAny object (one that was not obtained as a component of another DynAny) duke@1: * also destroys any component DynAny objects obtained from it. duke@1: * Destroying a non-top level DynAny object does nothing. duke@1: * Invoking operations on a destroyed top-level DynAny or any of its descendants raises OBJECT_NOT_EXIST. duke@1: * If the programmer wants to destroy a DynAny object but still wants to manipulate some component duke@1: * of the data value associated with it, then he or she should first create a DynAny for the component duke@1: * and, after that, make a copy of the created DynAny object. duke@1: *

The behavior of DynAny objects has been defined in order to enable efficient implementations duke@1: * in terms of allocated memory space and speed of access. DynAny objects are intended to be used duke@1: * for traversing values extracted from anys or constructing values of anys at runtime. duke@1: * Their use for other purposes is not recommended. duke@1: *

Insert and get operations are necessary to handle basic DynAny objects duke@1: * but are also helpful to handle constructed DynAny objects. duke@1: * Inserting a basic data type value into a constructed DynAny object duke@1: * implies initializing the current component of the constructed data value duke@1: * associated with the DynAny object. For example, invoking insert_boolean on a duke@1: * DynStruct implies inserting a boolean data value at the current position duke@1: * of the associated struct data value. duke@1: * A type is consistent for inserting or extracting a value if its TypeCode is equivalent to duke@1: * the TypeCode contained in the DynAny or, if the DynAny has components, is equivalent to the TypeCode duke@1: * of the DynAny at the current position. duke@1: *

DynAny and DynAnyFactory objects are intended to be local to the process in which they are duke@1: * created and used. This means that references to DynAny and DynAnyFactory objects cannot be exported duke@1: * to other processes, or externalized with ORB.object_to_string(). duke@1: * If any attempt is made to do so, the offending operation will raise a MARSHAL system exception. duke@1: * Since their interfaces are specified in IDL, DynAny objects export operations defined in the standard duke@1: * org.omg.CORBA.Object interface. However, any attempt to invoke operations exported through the Object duke@1: * interface may raise the standard NO_IMPLEMENT exception. duke@1: * An attempt to use a DynAny object with the DII may raise the NO_IMPLEMENT exception. duke@1: */ duke@1: interface DynAny { duke@1: #pragma sun_localservant DynAny "" duke@1: exception InvalidValue {}; duke@1: exception TypeMismatch {}; duke@1: duke@1: /** duke@1: * Returns the TypeCode associated with this DynAny object. duke@1: * A DynAny object is created with a TypeCode value assigned to it. duke@1: * This TypeCode value determines the type of the value handled through the DynAny object. duke@1: * Note that the TypeCode associated with a DynAny object is initialized at the time the duke@1: * DynAny is created and cannot be changed during lifetime of the DynAny object. duke@1: * duke@1: * @return The TypeCode associated with this DynAny object duke@1: */ duke@1: CORBA::TypeCode type(); duke@1: duke@1: /** duke@1: * Initializes the value associated with a DynAny object with the value duke@1: * associated with another DynAny object. duke@1: * The current position of the target DynAny is set to zero for values that have components duke@1: * and to -1 for values that do not have components. duke@1: * duke@1: * @param dyn_any duke@1: * @exception TypeMismatch if the type of the passed DynAny is not equivalent to the type of target DynAny duke@1: */ duke@1: void assign(in DynAny dyn_any) duke@1: raises(TypeMismatch); duke@1: duke@1: /** duke@1: * Initializes the value associated with a DynAny object with the value contained in an any. duke@1: * The current position of the target DynAny is set to zero for values that have components duke@1: * and to -1 for values that do not have components. duke@1: * duke@1: * @exception TypeMismatch if the type of the passed Any is not equivalent to the type of target DynAny duke@1: * @exception InvalidValue if the passed Any does not contain a legal value (such as a null string) duke@1: */ duke@1: void from_any(in any value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Creates an any value from a DynAny object. duke@1: * A copy of the TypeCode associated with the DynAny object is assigned to the resulting any. duke@1: * The value associated with the DynAny object is copied into the any. duke@1: * duke@1: * @return a new Any object with the same value and TypeCode duke@1: */ duke@1: any to_any(); duke@1: duke@1: /** duke@1: * Compares two DynAny values for equality. duke@1: * Two DynAny values are equal if their TypeCodes are equivalent and, recursively, all component DynAnys duke@1: * have equal values. duke@1: * The current position of the two DynAnys being compared has no effect on the result of equal. duke@1: * duke@1: * @return true of the DynAnys are equal, false otherwise duke@1: */ duke@1: boolean equal(in DynAny dyn_any); duke@1: duke@1: /** duke@1: * Destroys a DynAny object. duke@1: * This operation frees any resources used to represent the data value associated with a DynAny object. duke@1: * It must be invoked on references obtained from one of the creation operations on the ORB interface duke@1: * or on a reference returned by DynAny.copy() to avoid resource leaks. duke@1: * Invoking destroy on component DynAny objects (for example, on objects returned by the duke@1: * current_component operation) does nothing. duke@1: * Destruction of a DynAny object implies destruction of all DynAny objects obtained from it. duke@1: * That is, references to components of a destroyed DynAny become invalid. duke@1: * Invocations on such references raise OBJECT_NOT_EXIST. duke@1: * It is possible to manipulate a component of a DynAny beyond the life time of the DynAny duke@1: * from which the component was obtained by making a copy of the component with the copy operation duke@1: * before destroying the DynAny from which the component was obtained. duke@1: */ duke@1: void destroy(); duke@1: duke@1: /** duke@1: * Creates a new DynAny object whose value is a deep copy of the DynAny on which it is invoked. duke@1: * The operation is polymorphic, that is, invoking it on one of the types derived from DynAny, duke@1: * such as DynStruct, creates the derived type but returns its reference as the DynAny base type. duke@1: * duke@1: * @return a deep copy of the DynAny object duke@1: */ duke@1: DynAny copy(); duke@1: duke@1: /** duke@1: * Inserts a boolean value into the DynAny. duke@1: * duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: */ duke@1: void insert_boolean(in boolean value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Inserts a byte value into the DynAny. The IDL octet data type is mapped to the Java byte data type. duke@1: * duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: */ duke@1: void insert_octet(in octet value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Inserts a char value into the DynAny. duke@1: * duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: */ duke@1: void insert_char(in char value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Inserts a short value into the DynAny. duke@1: * duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: */ duke@1: void insert_short(in short value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Inserts a short value into the DynAny. The IDL ushort data type is mapped to the Java short data type. duke@1: * duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: */ duke@1: void insert_ushort(in unsigned short value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Inserts an integer value into the DynAny. The IDL long data type is mapped to the Java int data type. duke@1: * duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: */ duke@1: void insert_long(in long value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Inserts an integer value into the DynAny. The IDL ulong data type is mapped to the Java int data type. duke@1: * duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: */ duke@1: void insert_ulong(in unsigned long value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Inserts a float value into the DynAny. duke@1: * duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: */ duke@1: void insert_float(in float value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Inserts a double value into the DynAny. duke@1: * duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: */ duke@1: void insert_double(in double value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Inserts a string value into the DynAny. duke@1: * Both bounded and unbounded strings are inserted using this method. duke@1: * duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: * @exception InvalidValue if the string inserted is longer than the bound of a bounded string duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: */ duke@1: void insert_string(in string value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Inserts a reference to a CORBA object into the DynAny. duke@1: * duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: */ duke@1: void insert_reference(in Object value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Inserts a TypeCode object into the DynAny. duke@1: * duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: */ duke@1: void insert_typecode(in CORBA::TypeCode value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Inserts a long value into the DynAny. The IDL long long data type is mapped to the Java long data type. duke@1: * duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: */ duke@1: void insert_longlong(in long long value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Inserts a long value into the DynAny. duke@1: * The IDL unsigned long long data type is mapped to the Java long data type. duke@1: * duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: */ duke@1: void insert_ulonglong(in unsigned long long value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: // void insert_longdouble(in long double value) duke@1: // raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Inserts a char value into the DynAny. The IDL wchar data type is mapped to the Java char data type. duke@1: * duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: */ duke@1: void insert_wchar(in wchar value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Inserts a string value into the DynAny. duke@1: * Both bounded and unbounded strings are inserted using this method. duke@1: * duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: * @exception InvalidValue if the string inserted is longer than the bound of a bounded string duke@1: */ duke@1: void insert_wstring(in wstring value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Inserts an Any value into the Any represented by this DynAny. duke@1: * duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: */ duke@1: void insert_any(in any value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Inserts the Any value contained in the parameter DynAny into the Any represented by this DynAny. duke@1: * duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: */ duke@1: void insert_dyn_any(in DynAny value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Inserts a reference to a Serializable object into this DynAny. duke@1: * The IDL ValueBase type is mapped to the Java Serializable type. duke@1: * duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: */ duke@1: void insert_val(in ValueBase value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Extracts the boolean value from this DynAny. duke@1: * duke@1: * @exception TypeMismatch if the accessed component in the DynAny is of a type duke@1: * that is not equivalent to the requested type. duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: */ duke@1: boolean get_boolean() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Extracts the byte value from this DynAny. The IDL octet data type is mapped to the Java byte data type. duke@1: * duke@1: * @exception TypeMismatch if the accessed component in the DynAny is of a type duke@1: * that is not equivalent to the requested type. duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: */ duke@1: octet get_octet() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Extracts the char value from this DynAny. duke@1: * duke@1: * @exception TypeMismatch if the accessed component in the DynAny is of a type duke@1: * that is not equivalent to the requested type. duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: */ duke@1: char get_char() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Extracts the short value from this DynAny. duke@1: * duke@1: * @exception TypeMismatch if the accessed component in the DynAny is of a type duke@1: * that is not equivalent to the requested type. duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: */ duke@1: short get_short() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Extracts the short value from this DynAny. The IDL ushort data type is mapped to the Java short data type. duke@1: * duke@1: * @exception TypeMismatch if the accessed component in the DynAny is of a type duke@1: * that is not equivalent to the requested type. duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: */ duke@1: unsigned short get_ushort() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Extracts the integer value from this DynAny. The IDL long data type is mapped to the Java int data type. duke@1: * duke@1: * @exception TypeMismatch if the accessed component in the DynAny is of a type duke@1: * that is not equivalent to the requested type. duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: */ duke@1: long get_long() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Extracts the integer value from this DynAny. The IDL ulong data type is mapped to the Java int data type. duke@1: * duke@1: * @exception TypeMismatch if the accessed component in the DynAny is of a type duke@1: * that is not equivalent to the requested type. duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: */ duke@1: unsigned long get_ulong() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Extracts the float value from this DynAny. duke@1: * duke@1: * @exception TypeMismatch if the accessed component in the DynAny is of a type duke@1: * that is not equivalent to the requested type. duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: */ duke@1: float get_float() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Extracts the double value from this DynAny. duke@1: * duke@1: * @exception TypeMismatch if the accessed component in the DynAny is of a type duke@1: * that is not equivalent to the requested type. duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: */ duke@1: double get_double() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Extracts the string value from this DynAny. duke@1: * Both bounded and unbounded strings are extracted using this method. duke@1: * duke@1: * @exception TypeMismatch if the accessed component in the DynAny is of a type duke@1: * that is not equivalent to the requested type. duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: */ duke@1: string get_string() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Extracts the reference to a CORBA Object from this DynAny. duke@1: * duke@1: * @exception TypeMismatch if the accessed component in the DynAny is of a type duke@1: * that is not equivalent to the requested type. duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: */ duke@1: Object get_reference() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Extracts the TypeCode object from this DynAny. duke@1: * duke@1: * @exception TypeMismatch if the accessed component in the DynAny is of a type duke@1: * that is not equivalent to the requested type. duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: */ duke@1: CORBA::TypeCode get_typecode() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Extracts the long value from this DynAny. The IDL long long data type is mapped to the Java long data type. duke@1: * duke@1: * @exception TypeMismatch if the accessed component in the DynAny is of a type duke@1: * that is not equivalent to the requested type. duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: */ duke@1: long long get_longlong() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Extracts the long value from this DynAny. duke@1: * The IDL unsigned long long data type is mapped to the Java long data type. duke@1: * duke@1: * @exception TypeMismatch if the accessed component in the DynAny is of a type duke@1: * that is not equivalent to the requested type. duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: */ duke@1: unsigned long long get_ulonglong() duke@1: raises(TypeMismatch, InvalidValue); duke@1: // long double get_longdouble() duke@1: // raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Extracts the long value from this DynAny. The IDL wchar data type is mapped to the Java char data type. duke@1: * duke@1: * @exception TypeMismatch if the accessed component in the DynAny is of a type duke@1: * that is not equivalent to the requested type. duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: */ duke@1: wchar get_wchar() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Extracts the string value from this DynAny. duke@1: * Both bounded and unbounded strings are extracted using this method. duke@1: * duke@1: * @exception TypeMismatch if the accessed component in the DynAny is of a type duke@1: * that is not equivalent to the requested type. duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: */ duke@1: wstring get_wstring() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Extracts an Any value contained in the Any represented by this DynAny. duke@1: * duke@1: * @exception TypeMismatch if the accessed component in the DynAny is of a type duke@1: * that is not equivalent to the requested type. duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: */ duke@1: any get_any() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Extracts the Any value contained in the Any represented by this DynAny and returns it wrapped duke@1: * into a new DynAny. duke@1: * duke@1: * @exception TypeMismatch if the accessed component in the DynAny is of a type duke@1: * that is not equivalent to the requested type. duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: */ duke@1: DynAny get_dyn_any() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Extracts a Serializable object from this DynAny. duke@1: * The IDL ValueBase type is mapped to the Java Serializable type. duke@1: * duke@1: * @exception TypeMismatch if the accessed component in the DynAny is of a type duke@1: * that is not equivalent to the requested type. duke@1: * @exception TypeMismatch if called on a DynAny whose current component itself has components duke@1: * @exception InvalidValue if this DynAny has components but has a current position of -1 duke@1: */ duke@1: ValueBase get_val() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Sets the current position to index. The current position is indexed 0 to n-1, that is, duke@1: * index zero corresponds to the first component. The operation returns true if the resulting duke@1: * current position indicates a component of the DynAny and false if index indicates duke@1: * a position that does not correspond to a component. duke@1: * Calling seek with a negative index is legal. It sets the current position to -1 to indicate duke@1: * no component and returns false. Passing a non-negative index value for a DynAny that does not duke@1: * have a component at the corresponding position sets the current position to -1 and returns false. duke@1: */ duke@1: boolean seek(in long index); duke@1: duke@1: /** duke@1: * Is equivalent to seek(0). duke@1: */ duke@1: void rewind(); duke@1: duke@1: /** duke@1: * Advances the current position to the next component. duke@1: * The operation returns true while the resulting current position indicates a component, false otherwise. duke@1: * A false return value leaves the current position at -1. duke@1: * Invoking next on a DynAny without components leaves the current position at -1 and returns false. duke@1: */ duke@1: boolean next(); duke@1: duke@1: /** duke@1: * Returns the number of components of a DynAny. duke@1: * For a DynAny without components, it returns zero. duke@1: * The operation only counts the components at the top level. duke@1: * For example, if component_count is invoked on a DynStruct with a single member, duke@1: * the return value is 1, irrespective of the type of the member. duke@1: *

duke@1: */ duke@1: unsigned long component_count(); duke@1: duke@1: /** duke@1: * Returns the DynAny for the component at the current position. duke@1: * It does not advance the current position, so repeated calls to current_component duke@1: * without an intervening call to rewind, next, or seek return the same component. duke@1: * The returned DynAny object reference can be used to get/set the value of the current component. duke@1: * If the current component represents a complex type, the returned reference can be narrowed duke@1: * based on the TypeCode to get the interface corresponding to the to the complex type. duke@1: * Calling current_component on a DynAny that cannot have components, duke@1: * such as a DynEnum or an empty exception, raises TypeMismatch. duke@1: * Calling current_component on a DynAny whose current position is -1 returns a nil reference. duke@1: * The iteration operations, together with current_component, can be used duke@1: * to dynamically compose an any value. After creating a dynamic any, such as a DynStruct, duke@1: * current_component and next can be used to initialize all the components of the value. duke@1: * Once the dynamic value is completely initialized, to_any creates the corresponding any value. duke@1: * duke@1: * @exception TypeMismatch If called on a DynAny that cannot have components, duke@1: * such as a DynEnum or an empty exception duke@1: */ duke@1: DynAny current_component() duke@1: raises(TypeMismatch); duke@1: }; duke@1: duke@1: /** duke@1: * DynFixed objects support the manipulation of IDL fixed values. duke@1: * Because IDL does not have a generic type that can represent fixed types with arbitrary duke@1: * number of digits and arbitrary scale, the operations use the IDL string type. duke@1: */ duke@1: interface DynFixed : DynAny { duke@1: #pragma sun_localservant DynFixed "" duke@1: duke@1: /** duke@1: * Returns the value of a DynFixed. duke@1: */ duke@1: string get_value(); duke@1: duke@1: /** duke@1: * Sets the value of the DynFixed. duke@1: * The val string must contain a fixed string constant in the same format as used for IDL fixed-point literals. duke@1: * However, the trailing d or D is optional. The return value is true if val can be represented as the DynFixed duke@1: * without loss of precision. If val has more fractional digits than can be represented in the DynFixed, duke@1: * fractional digits are truncated and the return value is false. duke@1: * duke@1: * @exception TypeMismatch If val does not contain a valid fixed-point literal or contains extraneous duke@1: * characters other than leading or trailing white space duke@1: * @exception InvalidValue If val contains a value whose scale exceeds that of the DynFixed duke@1: * or is not initialized duke@1: */ duke@1: boolean set_value(in string val) duke@1: raises(TypeMismatch, InvalidValue); duke@1: }; duke@1: duke@1: /** duke@1: * DynEnum objects support the manipulation of IDL enumerated values. duke@1: * The current position of a DynEnum is always -1. duke@1: */ duke@1: interface DynEnum : DynAny { duke@1: #pragma sun_localservant DynEnum "" duke@1: duke@1: /** duke@1: * Returns the value of the DynEnum as an IDL identifier. duke@1: */ duke@1: string get_as_string(); duke@1: duke@1: /** duke@1: * Sets the value of the DynEnum to the enumerated value whose IDL identifier is passed in the value parameter. duke@1: * duke@1: * @exception InvalidValue If value contains a string that is not a valid IDL identifier duke@1: * for the corresponding enumerated type duke@1: */ duke@1: void set_as_string(in string value) duke@1: raises(InvalidValue); duke@1: duke@1: /** duke@1: * Returns the value of the DynEnum as the enumerated value's ordinal value. duke@1: * Enumerators have ordinal values 0 to n-1, as they appear from left to right duke@1: * in the corresponding IDL definition. duke@1: */ duke@1: unsigned long get_as_ulong(); duke@1: duke@1: /** duke@1: * Sets the value of the DynEnum as the enumerated value's ordinal value. duke@1: * duke@1: * @exception InvalidValue If value contains a value that is outside the range of ordinal values duke@1: * for the corresponding enumerated type duke@1: */ duke@1: void set_as_ulong(in unsigned long value) duke@1: raises(InvalidValue); duke@1: }; duke@1: duke@1: typedef string FieldName; duke@1: duke@1: /** duke@1: * NameValuePairs associate a name with an Any object. duke@1: */ duke@1: struct NameValuePair { duke@1: /** duke@1: * The name associated with the Any. duke@1: */ duke@1: FieldName id; duke@1: /** duke@1: * The Any value associated with the name. duke@1: */ duke@1: any value; duke@1: }; duke@1: typedef sequence NameValuePairSeq; duke@1: duke@1: /** duke@1: * NameDynAnyPairs associate a name with an DynAny object. duke@1: */ duke@1: struct NameDynAnyPair { duke@1: /** duke@1: * The name associated with the DynAny. duke@1: */ duke@1: FieldName id; duke@1: /** duke@1: * The DynAny value associated with the name. duke@1: */ duke@1: DynAny value; duke@1: }; duke@1: typedef sequence NameDynAnyPairSeq; duke@1: duke@1: /** duke@1: * DynStruct objects support the manipulation of IDL struct and exception values. duke@1: * Members of the exceptions are handled in the same way as members of a struct. duke@1: */ duke@1: interface DynStruct : DynAny { duke@1: #pragma sun_localservant DynStruct "" duke@1: duke@1: /** duke@1: * Returns the name of the member at the current position. duke@1: * This operation may return an empty string since the TypeCode of the value being duke@1: * manipulated may not contain the names of members. duke@1: * duke@1: * @exception TypeMismatch if the DynStruct represents an empty exception. duke@1: * @exception InvalidValue if the current position does not indicate a member duke@1: */ duke@1: FieldName current_member_name() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Returns the TCKind associated with the member at the current position. duke@1: * duke@1: * @exception TypeMismatch if the DynStruct represents an empty exception. duke@1: * @exception InvalidValue if the current position does not indicate a member duke@1: */ duke@1: CORBA::TCKind current_member_kind() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Returns a sequence of NameValuePairs describing the name and the value of each member duke@1: * in the struct associated with a DynStruct object. duke@1: * The sequence contains members in the same order as the declaration order of members duke@1: * as indicated by the DynStruct's TypeCode. The current position is not affected. duke@1: * The member names in the returned sequence will be empty strings if the DynStruct's TypeCode duke@1: * does not contain member names. duke@1: */ duke@1: NameValuePairSeq get_members(); duke@1: duke@1: /** duke@1: * Initializes the struct data value associated with a DynStruct object from a sequence of NameValuePairs. duke@1: * The operation sets the current position to zero if the passed sequences has non-zero length. Otherwise, duke@1: * if an empty sequence is passed, the current position is set to -1. duke@1: *

Members must appear in the NameValuePairs in the order in which they appear in the IDL specification duke@1: * of the struct as indicated by the DynStruct's TypeCode or they must be empty strings. duke@1: * The operation makes no attempt to assign member values based on member names. duke@1: * duke@1: * @exception TypeMismatch if the member names supplied in the passed sequence do not match the duke@1: * corresponding member name in the DynStruct's TypeCode and they are not empty strings duke@1: * @exception InvalidValue if the passed sequence has a number of elements that disagrees duke@1: * with the number of members as indicated by the DynStruct's TypeCode duke@1: */ duke@1: void set_members(in NameValuePairSeq value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Returns a sequence of NameDynAnyPairs describing the name and the value of each member duke@1: * in the struct associated with a DynStruct object. duke@1: * The sequence contains members in the same order as the declaration order of members duke@1: * as indicated by the DynStruct's TypeCode. The current position is not affected. duke@1: * The member names in the returned sequence will be empty strings if the DynStruct's TypeCode duke@1: * does not contain member names. duke@1: */ duke@1: NameDynAnyPairSeq get_members_as_dyn_any(); duke@1: duke@1: /** duke@1: * Initializes the struct data value associated with a DynStruct object from a sequence of NameDynAnyPairs. duke@1: * The operation sets the current position to zero if the passed sequences has non-zero length. Otherwise, duke@1: * if an empty sequence is passed, the current position is set to -1. duke@1: *

Members must appear in the NameDynAnyPairs in the order in which they appear in the IDL specification duke@1: * of the struct as indicated by the DynStruct's TypeCode or they must be empty strings. duke@1: * The operation makes no attempt to assign member values based on member names. duke@1: * duke@1: * @exception TypeMismatch if the member names supplied in the passed sequence do not match the duke@1: * corresponding member name in the DynStruct's TypeCode and they are not empty strings duke@1: * @exception InvalidValue if the passed sequence has a number of elements that disagrees duke@1: * with the number of members as indicated by the DynStruct's TypeCode duke@1: */ duke@1: void set_members_as_dyn_any(in NameDynAnyPairSeq value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: }; duke@1: duke@1: /** duke@1: * DynUnion objects support the manipulation of IDL unions. duke@1: * A union can have only two valid current positions: duke@1: *

    duke@1: *
  • zero, which denotes the discriminator duke@1: *
  • one, which denotes the active member duke@1: *
duke@1: * The component_count value for a union depends on the current discriminator: duke@1: * it is 2 for a union whose discriminator indicates a named member, and 1 otherwise. duke@1: */ duke@1: interface DynUnion : DynAny { duke@1: #pragma sun_localservant DynUnion "" duke@1: duke@1: /** duke@1: * Returns the current discriminator value. duke@1: */ duke@1: DynAny get_discriminator(); duke@1: duke@1: /** duke@1: * Sets the discriminator of the DynUnion to the specified value. duke@1: * Setting the discriminator to a value that is consistent with the currently active union member duke@1: * does not affect the currently active member. Setting the discriminator to a value that is inconsistent duke@1: * with the currently active member deactivates the member and activates the member that is consistent duke@1: * with the new discriminator value (if there is a member for that value) by initializing the member duke@1: * to its default value. duke@1: * Setting the discriminator of a union sets the current position to 0 if the discriminator value duke@1: * indicates a non-existent union member (has_no_active_member returns true in this case). duke@1: * Otherwise, if the discriminator value indicates a named union member, the current position is set to 1 duke@1: * (has_no_active_member returns false and component_count returns 2 in this case). duke@1: * duke@1: * @exception TypeMismatch if the TypeCode of the parameter is not equivalent to the TypeCode duke@1: * of the union's discriminator duke@1: */ duke@1: void set_discriminator(in DynAny d) duke@1: raises(TypeMismatch); duke@1: duke@1: /** duke@1: * Sets the discriminator to a value that is consistent with the value of the default case of a union. duke@1: * It sets the current position to zero and causes component_count to return 2. duke@1: * duke@1: * @exception TypeMismatch if the union does not have an explicit default case duke@1: */ duke@1: void set_to_default_member() duke@1: raises(TypeMismatch); duke@1: duke@1: /** duke@1: * Sets the discriminator to a value that does not correspond to any of the unions case labels. duke@1: * It sets the current position to zero and causes component_count to return 1. duke@1: * duke@1: * @exception TypeMismatch if the union has an explicit default case or if it uses the entire range duke@1: * of discriminator values for explicit case labels duke@1: */ duke@1: void set_to_no_active_member() duke@1: raises(TypeMismatch); duke@1: duke@1: /** duke@1: * Returns true if the union has no active member, that is, the unions value consists solely duke@1: * of its discriminator because the discriminator has a value that is not listed as an explicit case label. duke@1: * Calling this operation on a union that has a default case returns false. duke@1: * Calling this operation on a union that uses the entire range of discriminator values duke@1: * for explicit case labels returns false. duke@1: */ duke@1: boolean has_no_active_member(); duke@1: duke@1: /** duke@1: * Returns the TCKind value of the discriminators TypeCode. duke@1: */ duke@1: CORBA::TCKind discriminator_kind(); duke@1: duke@1: /** duke@1: * Returns the TCKind value of the currently active members TypeCode. duke@1: * duke@1: * @exception InvalidValue if the union does not have a currently active member duke@1: */ duke@1: CORBA::TCKind member_kind() duke@1: raises(InvalidValue); duke@1: duke@1: /** duke@1: * Returns the currently active member. Note that the returned reference remains valid only duke@1: * for as long as the currently active member does not change. Using the returned reference duke@1: * beyond the life time of the currently active member raises OBJECT_NOT_EXIST. duke@1: * duke@1: * @exception InvalidValue if the union has no active member duke@1: */ duke@1: DynAny member() duke@1: raises(InvalidValue); duke@1: duke@1: /** duke@1: * Returns the name of the currently active member. If the unions TypeCode does not contain duke@1: * a member name for the currently active member, the operation returns an empty string. duke@1: * duke@1: * @exception InvalidValue if the union has no active member duke@1: */ duke@1: FieldName member_name() duke@1: raises(InvalidValue); duke@1: }; duke@1: duke@1: typedef sequence AnySeq; duke@1: typedef sequence DynAnySeq; duke@1: duke@1: /** duke@1: * DynSequence objects support the manipulation of IDL sequences. duke@1: */ duke@1: interface DynSequence : DynAny { duke@1: #pragma sun_localservant DynSequence "" duke@1: duke@1: /** duke@1: * Returns the current length of the sequence. duke@1: */ duke@1: unsigned long get_length(); duke@1: duke@1: /** duke@1: * Sets the length of the sequence. duke@1: * Increasing the length of a sequence adds new elements at the tail without affecting the values duke@1: * of already existing elements. Newly added elements are default-initialized. duke@1: * Increasing the length of a sequence sets the current position to the first newly-added element duke@1: * if the previous current position was -1. Otherwise, if the previous current position was not -1, duke@1: * the current position is not affected. duke@1: * Decreasing the length of a sequence removes elements from the tail without affecting the value duke@1: * of those elements that remain. The new current position after decreasing the length of a sequence duke@1: * is determined as follows: duke@1: *
    duke@1: *
  • If the length of the sequence is set to zero, the current position is set to -1. duke@1: *
  • If the current position is -1 before decreasing the length, it remains at -1. duke@1: *
  • If the current position indicates a valid element and that element is not removed when the length duke@1: * is decreased, the current position remains unaffected. duke@1: *
  • If the current position indicates a valid element and that element is removed, duke@1: * the current position is set to -1. duke@1: *
duke@1: * duke@1: * @exception InvalidValue if this is a bounded sequence and len is larger than the bound duke@1: */ duke@1: void set_length(in unsigned long len) duke@1: raises(InvalidValue); duke@1: duke@1: /** duke@1: * Returns the elements of the sequence. duke@1: */ duke@1: AnySeq get_elements(); duke@1: duke@1: /** duke@1: * Sets the elements of a sequence. duke@1: * The length of the DynSequence is set to the length of value. The current position is set to zero duke@1: * if value has non-zero length and to -1 if value is a zero-length sequence. duke@1: * duke@1: * @exception TypeMismatch if value contains one or more elements whose TypeCode is not equivalent duke@1: * to the element TypeCode of the DynSequence duke@1: * @exception InvalidValue if the length of value exceeds the bound of a bounded sequence duke@1: */ duke@1: void set_elements(in AnySeq value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Returns the DynAnys representing the elements of the sequence. duke@1: */ duke@1: DynAnySeq get_elements_as_dyn_any(); duke@1: duke@1: /** duke@1: * Sets the elements of a sequence using DynAnys. duke@1: * The length of the DynSequence is set to the length of value. The current position is set to zero duke@1: * if value has non-zero length and to -1 if value is a zero-length sequence. duke@1: * duke@1: * @exception TypeMismatch if value contains one or more elements whose TypeCode is not equivalent duke@1: * to the element TypeCode of the DynSequence duke@1: * @exception InvalidValue if the length of value exceeds the bound of a bounded sequence duke@1: */ duke@1: void set_elements_as_dyn_any(in DynAnySeq value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: }; duke@1: duke@1: /** duke@1: * DynArray objects support the manipulation of IDL arrays. duke@1: * Note that the dimension of the array is contained in the TypeCode which is accessible duke@1: * through the type attribute. It can also be obtained by calling the component_count operation. duke@1: */ duke@1: interface DynArray : DynAny { duke@1: #pragma sun_localservant DynArray "" duke@1: duke@1: /** duke@1: * Returns the elements of the DynArray. duke@1: */ duke@1: AnySeq get_elements(); duke@1: duke@1: /** duke@1: * Sets the DynArray to contain the passed elements. duke@1: * duke@1: * @exception TypeMismatch if one or more elements have a type that is inconsistent with the DynArrays TypeCode duke@1: * @exception InvalidValue if the sequence does not contain the same number of elements as the array dimension duke@1: */ duke@1: void set_elements(in AnySeq value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Returns the elements of the DynArray as DynAnys. duke@1: */ duke@1: DynAnySeq get_elements_as_dyn_any(); duke@1: duke@1: /** duke@1: * Sets the DynArray to contain the passed elements. duke@1: * duke@1: * @exception TypeMismatch if one or more elements have a type that is inconsistent with the DynArrays TypeCode duke@1: * @exception InvalidValue if the sequence does not contain the same number of elements as the array dimension duke@1: */ duke@1: void set_elements_as_dyn_any(in DynAnySeq value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: }; duke@1: duke@1: /** duke@1: * DynValueCommon provides operations supported by both the DynValue and DynValueBox interfaces. duke@1: */ ohair@5: interface DynValueCommon : DynAny { duke@1: /** duke@1: * Returns true if the DynValueCommon represents a null value type. duke@1: */ ohair@5: boolean is_null(); duke@1: duke@1: /** duke@1: * Changes the representation of a DynValueCommon to a null value type. duke@1: */ ohair@5: void set_to_null(); duke@1: duke@1: /** duke@1: * Replaces a null value type with a newly constructed value. Its components are initialized duke@1: * to default values as in DynAnyFactory.create_dyn_any_from_type_code. duke@1: * If the DynValueCommon represents a non-null value type, then this operation has no effect. duke@1: */ ohair@5: void set_to_value(); ohair@5: }; duke@1: duke@1: /** duke@1: * DynValue objects support the manipulation of IDL non-boxed value types. duke@1: * The DynValue interface can represent both null and non-null value types. duke@1: * For a DynValue representing a non-null value type, the DynValue's components comprise duke@1: * the public and private members of the value type, including those inherited from concrete base value types, duke@1: * in the order of definition. A DynValue representing a null value type has no components duke@1: * and a current position of -1. duke@1: *

Warning: Indiscriminantly changing the contents of private value type members can cause the value type duke@1: * implementation to break by violating internal constraints. Access to private members is provided to support duke@1: * such activities as ORB bridging and debugging and should not be used to arbitrarily violate duke@1: * the encapsulation of the value type. duke@1: */ duke@1: interface DynValue : DynValueCommon { duke@1: #pragma sun_localservant DynValue "" duke@1: duke@1: /** duke@1: * Returns the name of the member at the current position. duke@1: * This operation may return an empty string since the TypeCode of the value being duke@1: * manipulated may not contain the names of members. duke@1: * duke@1: * @exception TypeMismatch if the DynValue represents a null value type. duke@1: * @exception InvalidValue if the current position does not indicate a member duke@1: */ duke@1: FieldName current_member_name() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Returns the TCKind associated with the member at the current position. duke@1: * duke@1: * @exception TypeMismatch if the DynValue represents a null value type. duke@1: * @exception InvalidValue if the current position does not indicate a member duke@1: */ duke@1: CORBA::TCKind current_member_kind() duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Returns a sequence of NameValuePairs describing the name and the value of each member duke@1: * in the value type. duke@1: * The sequence contains members in the same order as the declaration order of members duke@1: * as indicated by the DynValue's TypeCode. The current position is not affected. duke@1: * The member names in the returned sequence will be empty strings if the DynValue's TypeCode duke@1: * does not contain member names. duke@1: * duke@1: * @exception InvalidValue if this object represents a null value type duke@1: */ duke@1: NameValuePairSeq get_members() duke@1: raises(InvalidValue); duke@1: duke@1: /** duke@1: * Initializes the value type's members from a sequence of NameValuePairs. duke@1: * The operation sets the current position to zero if the passed sequences has non-zero length. Otherwise, duke@1: * if an empty sequence is passed, the current position is set to -1. duke@1: * A null value type can be initialized to a non-null value type using this method. duke@1: *

Members must appear in the NameValuePairs in the order in which they appear in the IDL specification duke@1: * of the value type as indicated by the DynValue's TypeCode or they must be empty strings. duke@1: * The operation makes no attempt to assign member values based on member names. duke@1: * duke@1: * @exception TypeMismatch if the member names supplied in the passed sequence do not match the duke@1: * corresponding member name in the DynValue's TypeCode and they are not empty strings duke@1: * @exception InvalidValue if the passed sequence has a number of elements that disagrees duke@1: * with the number of members as indicated by the DynValue's TypeCode duke@1: */ duke@1: void set_members(in NameValuePairSeq value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: duke@1: /** duke@1: * Returns a sequence of NameDynAnyPairs describing the name and the value of each member duke@1: * in the value type. duke@1: * The sequence contains members in the same order as the declaration order of members duke@1: * as indicated by the DynValue's TypeCode. The current position is not affected. duke@1: * The member names in the returned sequence will be empty strings if the DynValue's TypeCode duke@1: * does not contain member names. duke@1: * duke@1: * @exception InvalidValue if this object represents a null value type duke@1: */ duke@1: NameDynAnyPairSeq get_members_as_dyn_any() duke@1: raises(InvalidValue); duke@1: duke@1: /** duke@1: * Initializes the value type's members from a sequence of NameDynAnyPairs. duke@1: * The operation sets the current position to zero if the passed sequences has non-zero length. Otherwise, duke@1: * if an empty sequence is passed, the current position is set to -1. duke@1: * A null value type can be initialized to a non-null value type using this method. duke@1: *

Members must appear in the NameDynAnyPairs in the order in which they appear in the IDL specification duke@1: * of the value type as indicated by the DynValue's TypeCode or they must be empty strings. duke@1: * The operation makes no attempt to assign member values based on member names. duke@1: * duke@1: * @exception TypeMismatch if the member names supplied in the passed sequence do not match the duke@1: * corresponding member name in the DynValue's TypeCode and they are not empty strings duke@1: * @exception InvalidValue if the passed sequence has a number of elements that disagrees duke@1: * with the number of members as indicated by the DynValue's TypeCode duke@1: */ duke@1: void set_members_as_dyn_any(in NameDynAnyPairSeq value) duke@1: raises(TypeMismatch, InvalidValue); duke@1: }; duke@1: duke@1: /** duke@1: * DynValueBox objects support the manipulation of IDL boxed value types. duke@1: * The DynValueBox interface can represent both null and non-null value types. duke@1: * For a DynValueBox representing a non-null value type, the DynValueBox has a single component duke@1: * of the boxed type. A DynValueBox representing a null value type has no components duke@1: * and a current position of -1. duke@1: */ ohair@5: interface DynValueBox : DynValueCommon { duke@1: duke@1: /** duke@1: * Returns the boxed value as an Any. duke@1: * duke@1: * @exception InvalidValue if this object represents a null value box type duke@1: */ ohair@5: any get_boxed_value() duke@1: raises(InvalidValue); duke@1: duke@1: /** duke@1: * Replaces the boxed value with the specified value. duke@1: * If the DynBoxedValue represents a null valuetype, it is converted to a non-null value. duke@1: * duke@1: * @exception TypeMismatch if this object represents a non-null value box type and the type duke@1: * of the parameter is not matching the current boxed value type. duke@1: */ duke@1: void set_boxed_value(in any boxed) duke@1: raises(TypeMismatch); duke@1: duke@1: /** duke@1: * Returns the boxed value as a DynAny. duke@1: * duke@1: * @exception InvalidValue if this object represents a null value box type duke@1: */ ohair@5: DynAny get_boxed_value_as_dyn_any() duke@1: raises(InvalidValue); duke@1: duke@1: /** duke@1: * Replaces the boxed value with the value contained in the parameter. duke@1: * If the DynBoxedValue represents a null valuetype, it is converted to a non-null value. duke@1: * duke@1: * @exception TypeMismatch if this object represents a non-null value box type and the type duke@1: * of the parameter is not matching the current boxed value type. duke@1: */ ohair@5: void set_boxed_value_as_dyn_any(in DynAny boxed) duke@1: raises(TypeMismatch); duke@1: }; duke@1: duke@1: /** duke@1: * DynAny objects can be created by invoking operations on the DynAnyFactory object. duke@1: * Generally there are only two ways to create a DynAny object: duke@1: *

    duke@1: *
  • invoking an operation on an existing DynAny object duke@1: *
  • invoking an operation on a DynAnyFactory object duke@1: *
duke@1: * A constructed DynAny object supports operations that enable the creation of new DynAny duke@1: * objects encapsulating access to the value of some constituent. duke@1: * DynAny objects also support the copy operation for creating new DynAny objects. duke@1: * A reference to the DynAnyFactory object is obtained by calling ORB.resolve_initial_references() duke@1: * with the identifier parameter set to the string constant "DynAnyFactory". duke@1: *

Dynamic interpretation of an any usually involves creating a DynAny object using create_dyn_any() duke@1: * as the first step. Depending on the type of the any, the resulting DynAny object reference can be narrowed duke@1: * to a DynFixed, DynStruct, DynSequence, DynArray, DynUnion, DynEnum, or DynValue object reference. duke@1: *

Dynamic creation of an any involves creating a DynAny object using create_dyn_any_from_type_code(), duke@1: * passing the TypeCode associated with the value to be created. The returned reference is narrowed to one of duke@1: * the complex types, such as DynStruct, if appropriate. Then, the value can be initialized by means of duke@1: * invoking operations on the resulting object. Finally, the to_any operation can be invoked duke@1: * to create an any value from the constructed DynAny. duke@1: */ duke@1: interface DynAnyFactory { duke@1: #pragma sun_localservant DynAnyFactory "" duke@1: exception InconsistentTypeCode {}; duke@1: duke@1: /** duke@1: * Creates a new DynAny object from an any value. duke@1: * A copy of the TypeCode associated with the any value is assigned to the resulting DynAny object. duke@1: * The value associated with the DynAny object is a copy of the value in the original any. duke@1: * The current position of the created DynAny is set to zero if the passed value has components, duke@1: * to -1 otherwise duke@1: * duke@1: * @exception InconsistentTypeCode if value has a TypeCode with a TCKind of tk_Principal, duke@1: * tk_native, or tk_abstract_interface duke@1: */ duke@1: DynAny create_dyn_any(in any value) duke@1: raises(InconsistentTypeCode); duke@1: duke@1: /** duke@1: * Creates a DynAny from a TypeCode. Depending on the TypeCode, the created object may be of type DynAny, duke@1: * or one of its derived types, such as DynStruct. The returned reference can be narrowed to the derived type. duke@1: * In all cases, a DynAny constructed from a TypeCode has an initial default value. duke@1: * The default values of basic types are: duke@1: *

    duke@1: *
  • false for boolean duke@1: *
  • zero for numeric types duke@1: *
  • zero for types octet, char, and wchar duke@1: *
  • the empty string for string and wstring duke@1: *
  • null for object references duke@1: *
  • a type code with a TCKind value of tk_null for type codes duke@1: *
  • for any values, an any containing a type code with a TCKind value of tk_null type and no value duke@1: *
duke@1: * For complex types, creation of the corresponding DynAny assigns a default value as follows: duke@1: *
    duke@1: *
  • For DynSequence it sets the current position to -1 and creates an empty sequence. duke@1: *
  • For DynEnum it sets the current position to -1 and sets the value of the enumerator duke@1: * to the first enumerator value indicated by the TypeCode. duke@1: *
  • For DynFixed it sets the current position to -1 and sets the value zero. duke@1: *
  • For DynStruct it sets the current position to -1 for empty exceptions duke@1: * and to zero for all other TypeCodes. The members (if any) are (recursively) initialized duke@1: * to their default values. duke@1: *
  • For DynArray sets the current position to zero and (recursively) initializes elements duke@1: * to their default value. duke@1: *
  • For DynUnion sets the current position to zero. The discriminator value is set duke@1: * to a value consistent with the first named member of the union. That member is activated and (recursively) duke@1: * initialized to its default value. duke@1: *
  • For DynValue and DynValueBox it initializes to a null value. duke@1: *
duke@1: */ duke@1: DynAny create_dyn_any_from_type_code(in CORBA::TypeCode type) duke@1: raises(InconsistentTypeCode); duke@1: }; duke@1: }; // module DynamicAny duke@1: duke@1: #endif // _DYNAMIC_ANY_IDL_