result = orb.create_recursive_tc(recursiveId);
break;
}
catch(org.omg.CORBA.SystemException e)
{
throw new MARSHAL(
"Failed to create recursive typecode: " +
e);
}
}
//if we end up here, we didn't find an entry in either
//repeatedTCMap and recursiveTCMap
throw new MARSHAL(
"Found indirection marker, but no corresponding "+
"original typecode (pos: " + origTCStartPos + ")" );
}
case TCKind._tk_null: // 0
case TCKind._tk_void: // 1
case TCKind._tk_short: // 2
case TCKind._tk_long: // 3
case TCKind._tk_ushort: // 4
case TCKind._tk_ulong: // 5
case TCKind._tk_float: // 6
case TCKind._tk_double: // 7
case TCKind._tk_boolean: // 8
case TCKind._tk_char: // 9
case TCKind._tk_octet: // 10
case TCKind._tk_any: // 11
case TCKind._tk_TypeCode: // 12
case TCKind._tk_Principal: // 13
{
result = orb.get_primitive_tc(org.omg.CORBA.TCKind.from_int (kind));
break;
}
case TCKind._tk_objref: // 14
{
size = openEncapsulation();
id = validateID (read_string());
cachedObject = getCachedTypecode( id );
if (cachedObject == null)
{
name = validateName (read_string ());
result = orb.create_interface_tc (id, name);
putCachedTypecode (id, new Pair( result, startPosition ));
}
else
{
final int skipAmount = calcSkipAmount(size, start_pos);
skip(skipAmount);
result = cachedObject.typeCode;
}
closeEncapsulation();
break;
}
case TCKind._tk_struct: // 15
{
size = openEncapsulation();
id = validateID (read_string());
cachedObject = getCachedTypecode( id );
if (cachedObject == null)
{
name = validateName (read_string());
member_count = read_long();
recursiveTCMap.put( startPosition, id );
StructMember[] struct_members = new StructMember[member_count];
for( int i = 0; i < member_count; i++)
{
struct_members[i] = new StructMember
(
read_string(),
read_TypeCode (recursiveTCMap, repeatedTCMap),
null
);
}
result = ((ORBSingleton) orb).create_struct_tc(id, name, struct_members, false);
putCachedTypecode (id, new Pair( result, startPosition ));
}
else
{
final int skipAmount = calcSkipAmount(size, start_pos);
updateTcMap( recursiveTCMap, start_pos, skipAmount, cachedObject.position );
skip (skipAmount);
recursiveTCMap.put( startPosition, id );
result = cachedObject.typeCode;
}
closeEncapsulation();
break;
}
case TCKind._tk_union: // 16
{
size = openEncapsulation();
id = validateID (read_string());
cachedObject = getCachedTypecode( id );
if (cachedObject == null)
{
name = validateName (read_string());
recursiveTCMap.put(startPosition, id );
org.omg.CORBA.TypeCode discriminator_type = read_TypeCode(recursiveTCMap, repeatedTCMap);
// Use the dealiased discriminator type for the label types.
// This works because the JacORB IDL compiler ignores any aliasing
// of label types and only the discriminator type is passed on the
// wire.
org.omg.CORBA.TypeCode orig_disc_type =
TypeCode.originalType(discriminator_type);
int default_index = read_long();
member_count = read_long();
UnionMember[] union_members = new UnionMember[member_count];
for( int i = 0; i < member_count; i++)
{
org.omg.CORBA.Any label = orb.create_any();
if( i == default_index )
{
// Default discriminator
label.insert_octet( read_octet());
}
else
{
// use the dealiased discriminator type to construct labels
label.read_value( this, orig_disc_type );
}
union_members[i] = new UnionMember
(
read_string(),
label,
read_TypeCode(recursiveTCMap, repeatedTCMap),
null
);
}
result = ((ORBSingleton)orb).create_union_tc(id, name, discriminator_type, union_members, false);
putCachedTypecode (id, new Pair( result, startPosition ));
}
else
{
final int skipAmount = calcSkipAmount(size, start_pos);
updateTcMap(recursiveTCMap, start_pos, skipAmount, cachedObject.position );
skip (skipAmount);
recursiveTCMap.put( startPosition, id );
result = cachedObject.typeCode;
}
closeEncapsulation();
break;
}
case TCKind._tk_enum: // 17
{
size = openEncapsulation();
id = validateID (read_string());
cachedObject = getCachedTypecode( id );
if (cachedObject == null)
{
name = validateName (read_string());
member_count = read_long();
member_names = new String[member_count];
for( int i = 0; i < member_count; i++)
{
member_names[i] = read_string();
}
result = ((ORBSingleton)orb).create_enum_tc (id, name, member_names, false);
putCachedTypecode (id, new Pair( result, startPosition ));
}
else
{
final int skipAmount = calcSkipAmount(size, start_pos);
skip (skipAmount);
result = cachedObject.typeCode;
}
closeEncapsulation();
break;
}
case TCKind._tk_string: // 18
{
result = orb.create_string_tc(read_long());
break;
}
case TCKind._tk_sequence: // 19
{
size = openEncapsulation();
content_type = read_TypeCode(recursiveTCMap, repeatedTCMap);
cachedObject = getCachedTypecode(content_type);
if (cachedObject == null)
{
length = read_long();
result = orb.create_sequence_tc(length, content_type);
putCachedTypecode(result, new Pair(result, startPosition));
}
else
{
final int skipAmount = calcSkipAmount(size, start_pos);
skip (skipAmount);
result = cachedObject.typeCode;
}
closeEncapsulation();
break;
}
case TCKind._tk_array: // 20
{
size = openEncapsulation();
content_type = read_TypeCode(recursiveTCMap, repeatedTCMap);
cachedObject = getCachedTypecode(content_type);
if (cachedObject == null)
{
result = orb.create_array_tc(read_long(), content_type );
// Store in cache
putCachedTypecode (result, new Pair( result, startPosition ));
}
else
{
int skipAmount = calcSkipAmount(size, start_pos);
skip (skipAmount);
result = cachedObject.typeCode;
}
closeEncapsulation();
break;
}
case TCKind._tk_alias: // 21
{
size = openEncapsulation();
id = validateID (read_string());
cachedObject = getCachedTypecode( id );
if (cachedObject == null)
{
name = validateName (read_string());
recursiveTCMap.put(startPosition, id );
content_type = read_TypeCode( recursiveTCMap, repeatedTCMap);
result = orb.create_alias_tc (id, name, content_type );
putCachedTypecode (id, new Pair( result, startPosition ));
}
else
{
final int skipAmount = calcSkipAmount(size, start_pos);
updateTcMap(recursiveTCMap, start_pos, skipAmount, cachedObject.position );
skip (skipAmount);
recursiveTCMap.put( startPosition, id );
result = cachedObject.typeCode;
}
closeEncapsulation();
break;
}
case TCKind._tk_except: // 22
{
size = openEncapsulation();
id = validateID (read_string());
cachedObject = getCachedTypecode( id );
if (cachedObject == null)
{
name = validateName (read_string());
member_count = read_long();
recursiveTCMap.put(startPosition, id );
StructMember[] members = new StructMember[member_count];
for( int i = 0; i < member_count; i++)
{
members[i] = new StructMember
(
read_string(),
read_TypeCode(recursiveTCMap, repeatedTCMap),
null
);
}
result = ((ORBSingleton)orb).create_exception_tc (id, name, members, false);
// Store in cache
putCachedTypecode (id, new Pair( result, startPosition ));
}
else
{
final int skipAmount = calcSkipAmount(size, start_pos);
updateTcMap(recursiveTCMap, start_pos, skipAmount, cachedObject.position );
skip (skipAmount);
recursiveTCMap.put( startPosition, id );
result = cachedObject.typeCode;
}
closeEncapsulation();
break;
}
case TCKind._tk_longlong: // 23
case TCKind._tk_ulonglong: // 24
{
result = orb.get_primitive_tc
(org.omg.CORBA.TCKind.from_int (kind));
break;
}
case TCKind._tk_longdouble: //25
{
throw new MARSHAL("Cannot handle TypeCode with kind " + kind);
}
case TCKind._tk_wchar: // 26
{
result = orb.get_primitive_tc
(org.omg.CORBA.TCKind.from_int (kind));
break;
}
case TCKind._tk_wstring: // 27
{
result = orb.create_wstring_tc(read_long());
break;
}
case TCKind._tk_fixed: // 28
{
result = orb.create_fixed_tc(read_ushort(), read_short() );
break;
}
case TCKind._tk_value: // 29
{
size = openEncapsulation();
id = validateID (read_string());
cachedObject = getCachedTypecode( id );
if (cachedObject == null)
{
name = validateName (read_string());
recursiveTCMap.put(startPosition, id);
short type_modifier = read_short();
org.omg.CORBA.TypeCode concrete_base_type = read_TypeCode( recursiveTCMap, repeatedTCMap);
member_count = read_long();
ValueMember[] vMembers = new ValueMember[member_count];
for( int i = 0; i < member_count; i++)
{
vMembers[i] = new ValueMember
(
read_string(),
null, // id
null, // defined_in
null, // version
read_TypeCode (recursiveTCMap, repeatedTCMap),
null, // type_def
read_short()
);
}
result = orb.create_value_tc
(id, name, type_modifier, concrete_base_type, vMembers);
putCachedTypecode (id, new Pair( result, startPosition ));
}
else
{
final int skipAmount = calcSkipAmount(size, start_pos);
updateTcMap(recursiveTCMap, start_pos, skipAmount, cachedObject.position );
skip (skipAmount);
recursiveTCMap.put( startPosition, id );
result = cachedObject.typeCode;
}
closeEncapsulation();
break;
}
case TCKind._tk_value_box: // 30
{
size = openEncapsulation();
id = validateID (read_string());
cachedObject = getCachedTypecode( id );
if (cachedObject == null)
{
name = validateName (read_string());
recursiveTCMap.put(startPosition, id);
content_type = read_TypeCode( recursiveTCMap, repeatedTCMap);
result = orb.create_value_box_tc (id, name, content_type);
putCachedTypecode (id, new Pair( result, startPosition ));
}
else
{
final int skipAmount = calcSkipAmount(size, start_pos);
updateTcMap(recursiveTCMap, start_pos, skipAmount, cachedObject.position );
skip (skipAmount);
recursiveTCMap.put( startPosition, id );
result = cachedObject.typeCode;
}
closeEncapsulation();
break;
}
case TCKind._tk_native: //31
{
throw new MARSHAL("Cannot handle TypeCode with kind " + kind);
}
case TCKind._tk_abstract_interface: // 32
{
size = openEncapsulation();
id = validateID (read_string());
cachedObject = getCachedTypecode( id );
if (cachedObject == null)
{
name = validateName (read_string());
recursiveTCMap.put(startPosition, id);
result = orb.create_abstract_interface_tc (id, name);
putCachedTypecode (id, new Pair( result, startPosition ));
}
else
{
final int skipAmount = calcSkipAmount(size, start_pos);
updateTcMap (recursiveTCMap, start_pos, skipAmount, cachedObject.position);
skip (skipAmount);
recursiveTCMap.put (startPosition, id);
result = cachedObject.typeCode;
}
closeEncapsulation();
break;
}
default:
{
// error, dump buffer contents for diagnosis
throw new MARSHAL("Cannot handle TypeCode with kind " + kind);
}
}
repeatedTCMap.put(startPosition, result);
return result;