1 20 21 package org.jacorb.ir; 22 23 import org.omg.CORBA.TCKind ; 24 import org.omg.CORBA.PrimitiveKind ; 25 import org.omg.CORBA.INTF_REPOS ; 26 27 public final class PrimitiveDef 28 extends IRObject 29 implements org.omg.CORBA.PrimitiveDefOperations 30 { 31 protected org.omg.CORBA.PrimitiveKind kind; 32 protected org.omg.CORBA.TypeCode type; 33 34 public PrimitiveDef( org.omg.CORBA.TypeCode tc ) 35 { 36 type = tc; 37 def_kind = org.omg.CORBA.DefinitionKind.dk_Primitive; 38 int _kind = tc.kind().value(); 39 switch ( _kind ) 40 { 41 case TCKind._tk_null: 42 { 43 kind = PrimitiveKind.pk_null; 44 break; 45 } 46 case TCKind._tk_void: 47 { 48 kind = PrimitiveKind.pk_void; 49 break; 50 } 51 case TCKind._tk_short: 52 { 53 kind = PrimitiveKind.pk_short; 54 break; 55 } 56 case TCKind._tk_long: 57 { 58 kind = PrimitiveKind.pk_long; 59 break; 60 } 61 case TCKind._tk_ushort: 62 { 63 kind = PrimitiveKind.pk_ushort; 64 break; 65 } 66 case TCKind._tk_ulong: 67 { 68 kind = PrimitiveKind.pk_ulong; 69 break; 70 } 71 case TCKind._tk_float: 72 { 73 kind = PrimitiveKind.pk_float; 74 break; 75 } 76 case TCKind._tk_double: 77 { 78 kind = PrimitiveKind.pk_double; 79 break; 80 } 81 case TCKind._tk_boolean: 82 { 83 kind = PrimitiveKind.pk_boolean; 84 break; 85 } 86 case TCKind._tk_char: 87 { 88 kind = PrimitiveKind.pk_char; 89 break; 90 } 91 case TCKind._tk_longlong: 92 { 93 kind = PrimitiveKind.pk_longlong; 94 break; 95 } 96 case TCKind._tk_ulonglong: 97 { 98 kind = PrimitiveKind.pk_ulonglong; 99 break; 100 } 101 case TCKind._tk_longdouble: 102 { 103 kind = PrimitiveKind.pk_longdouble; 104 break; 105 } 106 case TCKind._tk_wchar: 107 { 108 kind = PrimitiveKind.pk_wchar; 109 break; 110 } 111 case TCKind._tk_wstring: 112 { 113 kind = PrimitiveKind.pk_wstring; 114 break; 115 } 116 case TCKind._tk_octet: 117 { 118 kind = PrimitiveKind.pk_octet; 119 break; 120 } 121 case TCKind._tk_any: 122 { 123 kind = PrimitiveKind.pk_any; 124 break; 125 } 126 case TCKind._tk_TypeCode: 127 { 128 kind = PrimitiveKind.pk_TypeCode; 129 break; 130 } 131 case TCKind._tk_Principal: 132 { 133 kind = PrimitiveKind.pk_Principal; 134 break; 135 } 136 case TCKind._tk_string: 137 { 138 kind = PrimitiveKind.pk_string; 139 break; 140 } 141 case TCKind._tk_objref: 142 { 143 kind = PrimitiveKind.pk_objref; 144 break; 145 } 146 default: 147 { 148 throw new INTF_REPOS ("Unrecognized kind: " + kind ); 149 } 150 } 151 } 152 153 public PrimitiveDef( int _kind ) 154 { 155 def_kind = org.omg.CORBA.DefinitionKind.dk_Primitive; 156 kind = PrimitiveKind.from_int(_kind); 157 switch ( _kind ) 158 { 159 case org.omg.CORBA.PrimitiveKind._pk_null: 160 { 161 type = org.omg.CORBA.ORB.init().get_primitive_tc( org.omg.CORBA.TCKind.tk_null ); 162 break; 163 } 164 case org.omg.CORBA.PrimitiveKind._pk_void: 165 { 166 type = org.omg.CORBA.ORB.init().get_primitive_tc( org.omg.CORBA.TCKind.tk_void ); 167 break; 168 } 169 case org.omg.CORBA.PrimitiveKind._pk_short: 170 { 171 type = org.omg.CORBA.ORB.init().get_primitive_tc( org.omg.CORBA.TCKind.tk_short ); 172 break; 173 } 174 case org.omg.CORBA.PrimitiveKind._pk_long: 175 { 176 type = org.omg.CORBA.ORB.init().get_primitive_tc( org.omg.CORBA.TCKind.tk_long ); 177 break; 178 } 179 case org.omg.CORBA.PrimitiveKind._pk_float: 180 { 181 type = org.omg.CORBA.ORB.init().get_primitive_tc( org.omg.CORBA.TCKind.tk_float ); 182 break; 183 } 184 case org.omg.CORBA.PrimitiveKind._pk_double: 185 { 186 type = org.omg.CORBA.ORB.init().get_primitive_tc( org.omg.CORBA.TCKind.tk_double ); 187 break; 188 } 189 case org.omg.CORBA.PrimitiveKind._pk_boolean: 190 { 191 type = org.omg.CORBA.ORB.init().get_primitive_tc( org.omg.CORBA.TCKind.tk_boolean ); 192 break; 193 } 194 case org.omg.CORBA.PrimitiveKind._pk_char: 195 { 196 type = org.omg.CORBA.ORB.init().get_primitive_tc( org.omg.CORBA.TCKind.tk_char ); 197 break; 198 } 199 case org.omg.CORBA.PrimitiveKind._pk_octet: 200 { 201 type = org.omg.CORBA.ORB.init().get_primitive_tc( org.omg.CORBA.TCKind.tk_octet ); 202 break; 203 } 204 case org.omg.CORBA.PrimitiveKind._pk_any: 205 { 206 type = org.omg.CORBA.ORB.init().get_primitive_tc( org.omg.CORBA.TCKind.tk_any ); 207 break; 208 } 209 case org.omg.CORBA.PrimitiveKind._pk_TypeCode: 210 { 211 type = org.omg.CORBA.ORB.init().get_primitive_tc( org.omg.CORBA.TCKind.tk_TypeCode ); 212 break; 213 } 214 case org.omg.CORBA.PrimitiveKind._pk_Principal: 215 { 216 type = org.omg.CORBA.ORB.init().get_primitive_tc( org.omg.CORBA.TCKind.tk_Principal ); 217 break; 218 } 219 case org.omg.CORBA.PrimitiveKind._pk_string: 220 { 221 type = org.omg.CORBA.ORB.init().get_primitive_tc( org.omg.CORBA.TCKind.tk_string ); 222 break; 223 } 224 case org.omg.CORBA.PrimitiveKind._pk_objref: 225 { 226 type = org.omg.CORBA.ORB.init().get_primitive_tc( org.omg.CORBA.TCKind.tk_objref ); 227 break; 228 } 229 default: 230 { 231 throw new INTF_REPOS ("Unrecognized kind: " + kind ); 232 } 233 } 234 } 235 236 public org.omg.CORBA.TypeCode type() 237 { 238 return type; 239 } 240 241 public org.omg.CORBA.PrimitiveKind kind() 242 { 243 return kind; 244 } 245 246 public void destroy() 247 { 248 } 249 250 void define() 251 { 252 } 254 } 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | Popular Tags |