Frames | No Frames |
1: /* TCKind.java -- java to IDL mapping constants. 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.CORBA; 40: 41: 42: /** 43: * The basic constants, used in java to IDL mapping. 44: * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) 45: */ 46: public class TCKind 47: { 48: /** 49: * The integer constant, indicating IDL data type 50: * <code>null</code>. 51: */ 52: public static final int _tk_null = 0; 53: 54: /** 55: * The integer constant, indicating IDL data type 56: * <code>void</code>. 57: */ 58: public static final int _tk_void = 1; 59: 60: /** 61: * The integer constant, indicating IDL data type 62: * <code>short</code>. 63: */ 64: public static final int _tk_short = 2; 65: 66: /** 67: * The integer constant, indicating IDL data type 68: * <code>long</code>. 69: */ 70: public static final int _tk_long = 3; 71: 72: /** 73: * The integer constant, indicating IDL data type 74: * <code>ushort</code>. 75: */ 76: public static final int _tk_ushort = 4; 77: 78: /** 79: * The integer constant, indicating IDL data type 80: * <code>ulong</code>. 81: */ 82: public static final int _tk_ulong = 5; 83: 84: /** 85: * The integer constant, indicating IDL data type 86: * <code>float</code>. 87: */ 88: public static final int _tk_float = 6; 89: 90: /** 91: * The integer constant, indicating IDL data type 92: * <code>double</code>. 93: */ 94: public static final int _tk_double = 7; 95: 96: /** 97: * The integer constant, indicating IDL data type 98: * <code>boolean</code>. 99: */ 100: public static final int _tk_boolean = 8; 101: 102: /** 103: * The integer constant, indicating IDL data type 104: * <code>char</code>. 105: */ 106: public static final int _tk_char = 9; 107: 108: /** 109: * The integer constant, indicating IDL data type 110: * <code>octet</code>. 111: */ 112: public static final int _tk_octet = 10; 113: 114: /** 115: * The integer constant, indicating IDL data type 116: * <code>any</code>. 117: */ 118: public static final int _tk_any = 11; 119: 120: /** 121: * The integer constant, indicating IDL data type 122: * <code>TypeCode</code>. 123: */ 124: public static final int _tk_TypeCode = 12; 125: 126: /** 127: * The integer constant, indicating IDL data type 128: * <code>Principal</code>. 129: */ 130: public static final int _tk_Principal = 13; 131: 132: /** 133: * The integer constant, indicating IDL data type 134: * <code>objref</code>. 135: */ 136: public static final int _tk_objref = 14; 137: 138: /** 139: * The integer constant, indicating IDL data type 140: * <code>struct</code>. 141: */ 142: public static final int _tk_struct = 15; 143: 144: /** 145: * The integer constant, indicating IDL data type 146: * <code>union</code>. 147: */ 148: public static final int _tk_union = 16; 149: 150: /** 151: * The integer constant, indicating IDL data type 152: * <code>enum</code>. 153: */ 154: public static final int _tk_enum = 17; 155: 156: /** 157: * The integer constant, indicating IDL data type 158: * <code>string</code>. 159: */ 160: public static final int _tk_string = 18; 161: 162: /** 163: * The integer constant, indicating IDL data type 164: * <code>sequence</code>. 165: */ 166: public static final int _tk_sequence = 19; 167: 168: /** 169: * The integer constant, indicating IDL data type 170: * <code>array</code>. 171: */ 172: public static final int _tk_array = 20; 173: 174: /** 175: * The integer constant, indicating IDL data type 176: * <code>alias</code>. 177: */ 178: public static final int _tk_alias = 21; 179: 180: /** 181: * The integer constant, indicating IDL data type 182: * <code>except</code>. 183: */ 184: public static final int _tk_except = 22; 185: 186: /** 187: * The integer constant, indicating IDL data type 188: * <code>longlong</code>. 189: */ 190: public static final int _tk_longlong = 23; 191: 192: /** 193: * The integer constant, indicating IDL data type 194: * <code>ulonglong</code>. 195: */ 196: public static final int _tk_ulonglong = 24; 197: 198: /** 199: * The integer constant, indicating IDL data type 200: * <code>longdouble</code>. 201: */ 202: public static final int _tk_longdouble = 25; 203: 204: /** 205: * The integer constant, indicating IDL data type 206: * <code>wchar</code>. 207: */ 208: public static final int _tk_wchar = 26; 209: 210: /** 211: * The integer constant, indicating IDL data type 212: * <code>wstring</code>. 213: */ 214: public static final int _tk_wstring = 27; 215: 216: /** 217: * The integer constant, indicating IDL data type 218: * <code>fixed</code>. 219: */ 220: public static final int _tk_fixed = 28; 221: 222: /** 223: * The integer constant, indicating IDL data type 224: * <code>value</code>. 225: */ 226: public static final int _tk_value = 29; 227: 228: /** 229: * The integer constant, indicating IDL data type 230: * <code>value_box</code>. 231: */ 232: public static final int _tk_value_box = 30; 233: 234: /** 235: * The integer constant, indicating IDL data type 236: * <code>native</code>. 237: */ 238: public static final int _tk_native = 31; 239: 240: /** 241: * The integer constant, indicating IDL data type 242: * <code>abstract_interface</code>. 243: */ 244: public static final int _tk_abstract_interface = 32; 245: 246: /** 247: * The TCKind constant, indicating IDL data type 248: * <code>null</code> 249: */ 250: public static final TCKind tk_null = new TCKind(_tk_null); 251: 252: /** 253: * The TCKind constant, indicating IDL data type 254: * <code>void</code> 255: */ 256: public static final TCKind tk_void = new TCKind(_tk_void); 257: 258: /** 259: * The TCKind constant, indicating IDL data type 260: * <code>short</code> 261: */ 262: public static final TCKind tk_short = new TCKind(_tk_short); 263: 264: /** 265: * The TCKind constant, indicating IDL data type 266: * <code>long</code> 267: */ 268: public static final TCKind tk_long = new TCKind(_tk_long); 269: 270: /** 271: * The TCKind constant, indicating IDL data type 272: * <code>ushort</code> 273: */ 274: public static final TCKind tk_ushort = new TCKind(_tk_ushort); 275: 276: /** 277: * The TCKind constant, indicating IDL data type 278: * <code>ulong</code> 279: */ 280: public static final TCKind tk_ulong = new TCKind(_tk_ulong); 281: 282: /** 283: * The TCKind constant, indicating IDL data type 284: * <code>float</code> 285: */ 286: public static final TCKind tk_float = new TCKind(_tk_float); 287: 288: /** 289: * The TCKind constant, indicating IDL data type 290: * <code>double</code> 291: */ 292: public static final TCKind tk_double = new TCKind(_tk_double); 293: 294: /** 295: * The TCKind constant, indicating IDL data type 296: * <code>boolean</code> 297: */ 298: public static final TCKind tk_boolean = new TCKind(_tk_boolean); 299: 300: /** 301: * The TCKind constant, indicating IDL data type 302: * <code>char</code> 303: */ 304: public static final TCKind tk_char = new TCKind(_tk_char); 305: 306: /** 307: * The TCKind constant, indicating IDL data type 308: * <code>octet</code> 309: */ 310: public static final TCKind tk_octet = new TCKind(_tk_octet); 311: 312: /** 313: * The TCKind constant, indicating IDL data type 314: * <code>any</code> 315: */ 316: public static final TCKind tk_any = new TCKind(_tk_any); 317: 318: /** 319: * The TCKind constant, indicating IDL data type 320: * <code>TypeCode</code> 321: */ 322: public static final TCKind tk_TypeCode = new TCKind(_tk_TypeCode); 323: 324: /** 325: * The TCKind constant, indicating IDL data type 326: * <code>Principal</code> 327: */ 328: public static final TCKind tk_Principal = new TCKind(_tk_Principal); 329: 330: /** 331: * The TCKind constant, indicating IDL data type 332: * <code>objref</code> 333: */ 334: public static final TCKind tk_objref = new TCKind(_tk_objref); 335: 336: /** 337: * The TCKind constant, indicating IDL data type 338: * <code>struct</code> 339: */ 340: public static final TCKind tk_struct = new TCKind(_tk_struct); 341: 342: /** 343: * The TCKind constant, indicating IDL data type 344: * <code>union</code> 345: */ 346: public static final TCKind tk_union = new TCKind(_tk_union); 347: 348: /** 349: * The TCKind constant, indicating IDL data type 350: * <code>enum</code> 351: */ 352: public static final TCKind tk_enum = new TCKind(_tk_enum); 353: 354: /** 355: * The TCKind constant, indicating IDL data type 356: * <code>string</code> 357: */ 358: public static final TCKind tk_string = new TCKind(_tk_string); 359: 360: /** 361: * The TCKind constant, indicating IDL data type 362: * <code>sequence</code> 363: */ 364: public static final TCKind tk_sequence = new TCKind(_tk_sequence); 365: 366: /** 367: * The TCKind constant, indicating IDL data type 368: * <code>array</code> 369: */ 370: public static final TCKind tk_array = new TCKind(_tk_array); 371: 372: /** 373: * The TCKind constant, indicating IDL data type 374: * <code>alias</code> 375: */ 376: public static final TCKind tk_alias = new TCKind(_tk_alias); 377: 378: /** 379: * The TCKind constant, indicating IDL data type 380: * <code>except</code> 381: */ 382: public static final TCKind tk_except = new TCKind(_tk_except); 383: 384: /** 385: * The TCKind constant, indicating IDL data type 386: * <code>longlong</code> 387: */ 388: public static final TCKind tk_longlong = new TCKind(_tk_longlong); 389: 390: /** 391: * The TCKind constant, indicating IDL data type 392: * <code>ulonglong</code> 393: */ 394: public static final TCKind tk_ulonglong = new TCKind(_tk_ulonglong); 395: 396: /** 397: * The TCKind constant, indicating IDL data type 398: * <code>longdouble</code> 399: */ 400: public static final TCKind tk_longdouble = new TCKind(_tk_longdouble); 401: 402: /** 403: * The TCKind constant, indicating IDL data type 404: * <code>wchar</code> 405: */ 406: public static final TCKind tk_wchar = new TCKind(_tk_wchar); 407: 408: /** 409: * The TCKind constant, indicating IDL data type 410: * <code>wstring</code> 411: */ 412: public static final TCKind tk_wstring = new TCKind(_tk_wstring); 413: 414: /** 415: * The TCKind constant, indicating IDL data type 416: * <code>fixed</code> 417: */ 418: public static final TCKind tk_fixed = new TCKind(_tk_fixed); 419: 420: /** 421: * The TCKind constant, indicating IDL data type 422: * <code>value</code> 423: */ 424: public static final TCKind tk_value = new TCKind(_tk_value); 425: 426: /** 427: * The TCKind constant, indicating IDL data type 428: * <code>value_box</code> 429: */ 430: public static final TCKind tk_value_box = new TCKind(_tk_value_box); 431: 432: /** 433: * The TCKind constant, indicating IDL data type 434: * <code>native</code> 435: */ 436: public static final TCKind tk_native = new TCKind(_tk_native); 437: 438: /** 439: * The TCKind constant, indicating IDL data type 440: * <code>abstract_interface</code> 441: */ 442: public static final TCKind tk_abstract_interface = 443: new TCKind(_tk_abstract_interface); 444: 445: /** 446: * The kind value for this instance. 447: */ 448: private final int _value; 449: 450: /** 451: * The array of all tk_... instances, sorted by the kind number. 452: * 453: * As long as the kind numbers make the continuos sequence, starting from 0, 454: * the members can be found just by direct indexing. 455: */ 456: private static final TCKind[] tk = 457: new TCKind[] 458: { 459: tk_null, tk_void, tk_short, tk_long, tk_ushort, tk_ulong, tk_float, 460: tk_double, tk_boolean, tk_char, tk_octet, tk_any, tk_TypeCode, 461: tk_Principal, tk_objref, tk_struct, tk_union, tk_enum, tk_string, 462: tk_sequence, tk_array, tk_alias, tk_except, tk_longlong, tk_ulonglong, 463: tk_longdouble, tk_wchar, tk_wstring, tk_fixed, tk_value, tk_value_box, 464: tk_native, tk_abstract_interface 465: }; 466: 467: /** 468: * Creates a new TCKind instance with the given integer constant value. 469: * @deprecated it is recommended to use {@link #from_int(int)} that 470: * reuses existing TCKind object instead of allocating the new instance. 471: * @param kind one of the <code>_tk_..</code> constants. 472: */ 473: protected TCKind(int kind) 474: { 475: _value = kind; 476: } 477: 478: /** 479: * Returns the integer value, corresponding this instance of TCKind. 480: * @return the <code>_tk_..</code> value, matching this instance. 481: */ 482: public int value() 483: { 484: return _value; 485: } 486: 487: /** 488: * Return a TCKind object, matching the given integer code. 489: * @param _tk_nnn the TCKind code, one of <code>_tk_..</code> constants. 490: * @return the matching instance of TCKind, on of tk_.. constants. 491: * @throws BAD_PARAM if the given integer constant is not one of the 492: * valid <code>_tk_..</code> constants. 493: */ 494: public static TCKind from_int(int _tk_nnn) 495: { 496: try { 497: return tk[_tk_nnn]; 498: } 499: catch (ArrayIndexOutOfBoundsException aex) { 500: throw new BAD_PARAM("Invalid _tk_ code "+_tk_nnn); 501: } 502: } 503: 504: }