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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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