Frames | No Frames |
1: /* DynAnyFactoryOperations.java -- 2: Copyright (C) 2005, 2006 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.TCKind; 43: import org.omg.CORBA.TypeCode; 44: import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode; 45: 46: /** 47: * Defines the operations, applicable for DynAnyFactory. These operations 48: * produce new DynAny's either from Any, serving as a template and value 49: * provider, or from the given typecode. 50: * 51: * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) 52: */ 53: public interface DynAnyFactoryOperations 54: { 55: /** 56: * Create DynAny for holding the data of the given type. The returned DynAny 57: * is initialised to its agreed default value. The agreed default values are: 58: * <table border='1'> 59: * <tr> 60: * <th>Type</th> 61: * <th>Value</th> 62: * <th>Creates</th> 63: * </tr> 64: * 65: * <tr> 66: * <td>boolean</td> 67: * <td>false</td> 68: * <td>{@link DynAny}</td> 69: * </tr> 70: * <tr> 71: * <td>numeric types, octet, fixed</td> 72: * <td>0</td> 73: * <td>{@link DynAny}</td> 74: * </tr> 75: * <tr> 76: * <td>char, wchar</td> 77: * <td>(char) 0</td> 78: * <td>{@link DynAny}</td> 79: * </tr> 80: * <tr> 81: * <td>string, wstring</td> 82: * <td>empty string ("", not <code>null<code>)</td> 83: * <td>{@link DynAny}</td> 84: * </tr> 85: * <tr> 86: * <td>{@link Any}</td> 87: * <td>{@link Any} with no value and typecode of kind {@link TCKind#tk_null}</td> 88: * <td>{@link DynAny}</td> 89: * </tr> 90: * <tr> 91: * <td>Sequence</td> 92: * <td>Empty (zero size) sequence</td> 93: * <td>{@link DynSequence}</td> 94: * </tr> 95: * <tr> 96: * <td>Array</td> 97: * <td>All members of array are recursively initialised to default values.</td> 98: * <td>{@link DynArray}</td> 99: * </tr> 100: * <tr> 101: * <td>Structure, exception</td> 102: * <td>All fields of the structure (if any) are recursively initialised to 103: * default values.</td> 104: * <td>{@link DynStruct}</td> 105: * </tr> 106: * <tr> 107: * <td>Enumeration</td> 108: * <td>Default value, indicated by typecode.</td> 109: * <td>{@link DynEnum}</td> 110: * </tr> 111: * <tr> 112: * <td>Union</td> 113: * <td>Default variant (indicated by typecode), recursively initialised to 114: * its default value.</td> 115: * <td>{@link DynUnion}</td> 116: * </tr> 117: * <tr> 118: * <td>Value, ValueBox</td> 119: * <td>null</td> 120: * <td>{@link DynValue}, {@link DynValueBox}</td> 121: * </tr> 122: * <tr> 123: * <td>TypeCode</td> 124: * <td>Typecode of kind <code>TCKind.tk_null</code></td> 125: * <td>{@link DynValue}, {@link DynValueBox}</td> 126: * </tr> 127: * 128: * </table> 129: * 130: * @param type the type of the data being stored. 131: * 132: * @return the created DynAny, having the passed type. 133: * 134: * @throws InconsistentTypeCode if type.kind() is tk_Principal, tk_native or 135: * tk_abstract_interface. These types cannot be stored in DynAny. 136: */ 137: DynAny create_dyn_any_from_type_code(TypeCode type) 138: throws InconsistentTypeCode; 139: 140: /** 141: * Create DynAny using the given Any as template. 142: * 143: * @param value the Any, providing type and value for the DynAny being 144: * created. 145: * 146: * @return the created DynAny, having the same type and storing the same value 147: * as the passed Any. 148: * 149: * @throws InconsistentTypeCode if value.type().kind() is tk_Principal, 150: * tk_native or tk_abstract_interface. These types cannot be stored in DynAny. 151: */ 152: DynAny create_dyn_any(Any value) 153: throws InconsistentTypeCode; 154: }