Frames | No Frames |
1: /* DynAnyFactoryOperations.java -- 2: Copyright (C) 2005 Free Software Foundation, Inc. 3: 4: This file is part of GNU Classpath. 5: 6: GNU Classpath is free software; you can redistribute it and/or modify 7: it under the terms of the GNU General Public License as published by 8: the Free Software Foundation; either version 2, or (at your option) 9: any later version. 10: 11: GNU Classpath is distributed in the hope that it will be useful, but 12: WITHOUT ANY WARRANTY; without even the implied warranty of 13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14: General Public License for more details. 15: 16: You should have received a copy of the GNU General Public License 17: along with GNU Classpath; see the file COPYING. If not, write to the 18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19: 02110-1301 USA. 20: 21: Linking this library statically or dynamically with other modules is 22: making a combined work based on this library. Thus, the terms and 23: conditions of the GNU General Public License cover the whole 24: combination. 25: 26: As a special exception, the copyright holders of this library give you 27: permission to link this library with independent modules to produce an 28: executable, regardless of the license terms of these independent 29: modules, and to copy and distribute the resulting executable under 30: terms of your choice, provided that you also meet, for each linked 31: independent module, the terms and conditions of the license of that 32: module. An independent module is a module which is not derived from 33: or based on this library. If you modify this library, you may extend 34: this exception to your version of the library, but you are not 35: obligated to do so. If you do not wish to do so, delete this 36: exception statement from your version. */ 37: 38: 39: package org.omg.DynamicAny; 40: 41: import org.omg.CORBA.Any; 42: import org.omg.CORBA.TypeCode; 43: import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode; 44: 45: /** 46: * Defines the operations, applicable for DynAnyFactory. These operations 47: * produce new DynAny's either from Any, serving as a template and value 48: * provider, or from the given typecode. 49: * 50: * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) 51: */ 52: public interface DynAnyFactoryOperations 53: { 54: /** 55: * Create DynAny for holding the data of the given type. The returned DynAny 56: * is initialised to its agreed default value. The agreed default values are: 57: * <table border='1'> 58: * <tr> 59: * <th>Type</th> 60: * <th>Value</th> 61: * <th>Creates</th> 62: * </tr> 63: * 64: * <tr> 65: * <td>boolean</td> 66: * <td>false</td> 67: * <td>{@link DynAny}</td> 68: * </tr> 69: * <tr> 70: * <td>numeric types, octet, fixed</td> 71: * <td>0</td> 72: * <td>{@link DynAny}</td> 73: * </tr> 74: * <tr> 75: * <td>char, wchar</td> 76: * <td>(char) 0</td> 77: * <td>{@link DynAny}</td> 78: * </tr> 79: * <tr> 80: * <td>string, wstring</td> 81: * <td>empty string ("", not <code>null<code>)</td> 82: * <td>{@link DynAny}</td> 83: * </tr> 84: * <tr> 85: * <td>{@link Any}</td> 86: * <td>{@link Any} with no value and typecode of kind {@link TCKind.tk_null}</td> 87: * <td>{@link DynAny}</td> 88: * </tr> 89: * <tr> 90: * <td>Sequence</td> 91: * <td>Empty (zero size) sequence</td> 92: * <td>{@link DynSequence}</td> 93: * </tr> 94: * <tr> 95: * <td>Array</td> 96: * <td>All members of array are recursively initialised to default values.</td> 97: * <td>{@link DynArray}</td> 98: * </tr> 99: * <tr> 100: * <td>Structure, exception</td> 101: * <td>All fields of the structure (if any) are recursively initialised to 102: * default values.</td> 103: * <td>{@link DynStruct}</td> 104: * </tr> 105: * <tr> 106: * <td>Enumeration</td> 107: * <td>Default value, indicated by typecode.</td> 108: * <td>{@link DynEnum}</td> 109: * </tr> 110: * <tr> 111: * <td>Union</td> 112: * <td>Default variant (indicated by typecode), recursively initialised to 113: * its default value.</td> 114: * <td>{@link DynUnion}</td> 115: * </tr> 116: * <tr> 117: * <td>Value, ValueBox</td> 118: * <td>null</td> 119: * <td>{@link DynValue}, {@link DynValueBox}</td> 120: * </tr> 121: * <tr> 122: * <td>TypeCode</td> 123: * <td>Typecode of kind <code>TCKind.tk_null</code></td> 124: * <td>{@link DynValue}, {@link DynValueBox}</td> 125: * </tr> 126: * 127: * </table> 128: * 129: * @param type the type of the data being stored. 130: * 131: * @return the created DynAny, having the passed type. 132: * 133: * @throws InconsistentTypeCode if type.kind() is tk_Principal, tk_native or 134: * tk_abstract_interface. These types cannot be stored in DynAny. 135: */ 136: DynAny create_dyn_any_from_type_code(TypeCode type) 137: throws InconsistentTypeCode; 138: 139: /** 140: * Create DynAny using the given Any as template. 141: * 142: * @param value the Any, providing type and value for the DynAny being 143: * created. 144: * 145: * @return the created DynAny, having the same type and storing the same value 146: * as the passed Any. 147: * 148: * @throws InconsistentTypeCode if value.type().kind() is tk_Principal, 149: * tk_native or tk_abstract_interface. These types cannot be stored in DynAny. 150: */ 151: DynAny create_dyn_any(Any value) 152: throws InconsistentTypeCode; 153: }