public String member_name() throws org.omg.DynamicAny.DynAnyPackage.InvalidValue { if (m_destroyed) throw new org.omg.CORBA.OBJECT_NOT_EXIST("DynAny destroyed."); if (m_component_count == 1) throw new InvalidValue("No active member"); try { return m_base_type.member_name(m_active_member_index); } catch (BadKind bk) { throw new BAD_TYPECODE(bk.toString()); } catch (Bounds bd) { throw new INTERNAL(bd.toString()); } }
public org.omg.CORBA.TCKind member_kind() throws org.omg.DynamicAny.DynAnyPackage.InvalidValue { if (m_destroyed) throw new org.omg.CORBA.OBJECT_NOT_EXIST("DynAny destroyed."); if (m_active_member_index < 1) throw new InvalidValue("No member selected."); try { return m_base_type.member_type(m_active_member_index).kind(); } catch (BadKind bk) { /* unreachable */ return null; } catch (Bounds bd) { /* unreachable */ return null; } }
public String current_member_name() throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue { if (m_destroyed) throw new OBJECT_NOT_EXIST("DynAny destroyed."); if (m_current_index == -1) throw new InvalidValue("No member (current = -1)"); // at this point alwais curremt_member is valid try { return m_base_type.member_name(m_current_index); } catch (BadKind bk) { /* unreachable */ throw new BAD_TYPECODE(); } catch (Bounds bd) { /* unreachable */ throw new INTERNAL(bd.toString()); } }
public org.omg.CORBA.TCKind current_member_kind() throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue { if (m_destroyed) throw new OBJECT_NOT_EXIST("DynAny destroyed."); if (m_current_index == -1) throw new InvalidValue("No member (current = -1)"); try { return m_base_type.member_type(m_current_index).kind(); } catch (BadKind bk) { /* unreachable */ throw new TypeMismatch(bk.toString()); } catch (Bounds bd) { /* unreachable */ throw new TypeMismatch(bd.toString()); } }
public void set_as_string(String value) throws org.omg.DynamicAny.DynAnyPackage.InvalidValue { if (m_destroyed) throw new org.omg.CORBA.OBJECT_NOT_EXIST("DynAny destroyed."); try { int num_values = m_base_type.member_count(); for (int i = 0; i < num_values; i++) { if (value.equals(type().member_name(i))) { m_enum_value = i; return; } } throw new InvalidValue("No member named " + value + "."); } catch (Bounds bd) { /* unreachable */ } catch (BadKind bk) { /* unreachable */ } }
public static boolean skipValue(TypeCode type, CDRInputStream input) { try { int member_length = type.member_count(); for (int i = 0; i < member_length; i++) { if (!TypeCodeMarshaler.skipValue(type.member_type(i), input)) return false; } } catch (BadKind bk) { throw new BAD_TYPECODE("Fault in value operations:" + bk.toString()); } catch (Bounds bds) { throw new BAD_TYPECODE("Fault in value operations:" + bds.toString()); } return true; }
/** * Copies and remarshals the given typecode value marshaled in an * InputStream to a <code>es.tid.TIDorbj.core.CDRInputStream</code>. This * method will alwais be invoked by this stream. * * @param type * the value <code>TypeCode</code> * @param input * the <code>InputStream</code> where the value is marshaled * @param output * the <code>es.tid.TIDorbj.core.CDRInputStream</code> * @pre the <code>TypeCode</code> must be an alias type */ public static void remarshalValue(org.omg.CORBA.TypeCode type, InputStream input, CDROutputStream output) { try { int member_length = type.member_count(); for (int i = 0; i < member_length; i++) TypeCodeMarshaler.remarshalValue(type.member_type(i), input, output); } catch (BadKind bk) { throw new BAD_TYPECODE("Fault in value operations:" + bk.toString()); } catch (Bounds bds) { throw new BAD_TYPECODE("Fault in value operations:" + bds.toString()); } }
/** * Compares two InputStream marshaled values of a given TypeCode to a * <code>es.tid.TIDorbj.core.CDRInputStream</code>. This method will * alwais be invoked by this stream. * * @param type * the value <code>TypeCode</code> * @param input_a * the <code>InputStream</code> where one value is marshaled * @param input_b * the <code>InputStream</code> where the value value is * marshaled * @pre <code>type</code> must be a value type. */ public static boolean valuesEqual(org.omg.CORBA.TypeCode type, InputStream input_a, InputStream input_b) { try { int member_length = type.member_count(); for (int i = 0; i < member_length; i++) if (!TypeCodeMarshaler.valuesEqual(type.member_type(i), input_a, input_b)) return false; } catch (BadKind bk) { throw new BAD_TYPECODE("Fault in struct operations:" + bk.toString()); } catch (Bounds bds) { throw new BAD_TYPECODE("Fault in struct operations:" + bds.toString()); } return true; }
/** * Skips the value asociated to the TypeCode. This operation is used by the * TIDorb's Any implementation an the subclass <code>skip_value()</code> * operations. * * @param input * must be alwais a reference to a CDRInputStream object. */ public static boolean skipValue(TypeCode type, CDRInputStream input) { try { int member_length = type.member_count(); for (int i = 0; i < member_length; i++) { if (!TypeCodeMarshaler.skipValue(type.member_type(i), input)) return false; } } catch (BadKind bk) { throw new BAD_TYPECODE("Fault in struct operations:" + bk.toString()); } catch (Bounds bds) { throw new BAD_TYPECODE("Fault in struct operations:" + bds.toString()); } return true; }
/** * Marshal the given typecode params in a * <code>es.tid.TIDorbj.core.CDRInputStream</code>. This method will * alwais be invoked by this stream. * * @param type * the <code>TypeCode</code> * @param output * the <code>es.tid.TIDorbj.core.CDRInputStream</code> * @pre the the <code>TypeCode</code> must be a struct type */ public static void writeParams(TypeCode type, CDROutputStream output) { ComplexTypeCode.writeParams(type, output); try { int member_length = type.member_count(); output.write_ulong(member_length); for (int i = 0; i < member_length; i++) { output.write_string(type.member_name(i)); output.write_TypeCode(type.member_type(i)); } } catch (BadKind bk) { throw new BAD_TYPECODE("Fault in struct operations:" + bk.toString()); } catch (Bounds bds) { throw new BAD_TYPECODE("Fault in struct operations:" + bds.toString()); } }
/** * Copies and remarshals the given typecode value marshaled in an * InputStream to a <code>es.tid.TIDorbj.core.CDRInputStream</code>. This * method will alwais be invoked by this stream. * * @param type * the value <code>TypeCode</code> * @param input * the <code>InputStream</code> where the value is marshaled * @param output * the <code>es.tid.TIDorbj.core.CDRInputStream</code> * @pre the <code>TypeCode</code> must be a struct type */ public static void remarshalValue(TypeCode type, InputStream input, OutputStream output) { try { int member_length = type.member_count(); for (int i = 0; i < member_length; i++) TypeCodeMarshaler.remarshalValue(type.member_type(i), input, output); } catch (BadKind bk) { throw new BAD_TYPECODE("Fault in struct operations:" + bk.toString()); } catch (Bounds bds) { throw new BAD_TYPECODE("Fault in struct operations:" + bds.toString()); } }
/** * Compares two InputStream marshaled values of a given TypeCode to a * <code>es.tid.TIDorbj.core.CDRInputStream</code>. This method will * alwais be invoked by this stream. * * @param type * the value <code>TypeCode</code> * @param input_a * the <code>InputStream</code> where one value is marshaled * @param input_b * the <code>InputStream</code> where the value value is * marshaled * @pre <code>type</code> must be a struct type. */ public static boolean valuesEqual(org.omg.CORBA.TypeCode type, InputStream input_a, InputStream input_b) { try { int member_length = type.member_count(); for (int i = 0; i < member_length; i++) if (!TypeCodeMarshaler.valuesEqual(type.member_type(i), input_a, input_b)) return false; } catch (BadKind bk) { throw new BAD_TYPECODE("Fault in struct operations:" + bk.toString()); } catch (Bounds bds) { throw new BAD_TYPECODE("Fault in struct operations:" + bds.toString()); } return true; }
public static int searchMemberIndex(TypeCode type, org.omg.CORBA.Any discriminator) { try { int length = type.member_count(); for (int i = 0; i < length; i++) if (discriminator.equal(type.member_label(i))) return i; return type.default_index(); } catch (BadKind bk) { throw new BAD_TYPECODE("Fault in union operations:" + bk.toString()); } catch (Bounds bds) { throw new BAD_TYPECODE("Fault in union operations:" + bds.toString()); } }
/** * Marshal the given typecode params in a * <code>es.tid.TIDorbj.core.CDRInputStream</code>. This method will * alwais be invoked by this stream. * * @param type * the <code>TypeCode</code> * @param output * the <code>es.tid.TIDorbj.core.CDRInputStream</code> * @pre the the <code>TypeCode</code> must be an enum type */ public static void writeParams(TypeCode type, CDROutputStream output) { ComplexTypeCode.writeParams(type, output); try { int length = type.member_count(); output.write_ulong(length); for (int i = 0; i < length; i++) output.write_string(type.member_name(i)); } catch (BadKind bk) { throw new BAD_TYPECODE("Fault in enum operations:" + bk.toString()); } catch (Bounds bds) { throw new BAD_TYPECODE("Fault in enum operations:" + bds.toString()); } }
/** {@inheritDoc} */ public Any member_label(int index) throws BadKind, Bounds { Field f = getField(index); if (f.label != null) { return f.label; } else throw new BadKind(); }
/** {@inheritDoc} */ public TypeCode member_type(int index) throws BadKind, Bounds { Field f = getField(index); if (f.type != null) { return f.type; } else throw new BadKind(); }
/** {@inheritDoc} */ public short member_visibility(int index) throws BadKind, Bounds { Field f = getField(index); if (f.visibility != UNSET) { return (short) f.visibility; } else throw new BadKind(); }
protected void setIndex(int index, DynAny discriminator) { if (m_active_member_index == index) { if ((m_dyn_discriminator == null) && (discriminator != null)) m_dyn_discriminator = (DynAnyBase) discriminator.copy(); return; } if (m_dyn_discriminator != null) { m_dyn_discriminator.destroy(); m_dyn_discriminator = null; } if (discriminator != null) m_dyn_discriminator = (DynAnyBase) discriminator.copy(); m_current_index = 0; m_component_count = 2; m_active_member_index = index; try { if ((m_active_member != null) && (!m_active_member.type() .equivalent(m_base_type.member_type(m_active_member_index)))) { m_active_member.destroy(); m_active_member = null; } } catch (BadKind bk) { throw new BAD_TYPECODE(bk.toString()); } catch (Bounds bd) { throw new INTERNAL(bd.toString()); } }
public void member_name(String arg) throws org.omg.DynamicAny.DynAnyPackage.InvalidValue { if (m_destroyed) throw new org.omg.CORBA.OBJECT_NOT_EXIST("DynAny destroyed."); if (m_component_count == 1) throw new InvalidValue("No active member"); try { int member_count = m_base_type.member_count(); for (int i = 0; i < member_count; i++) { if (arg.equals(m_base_type.member_name(i))) { DynAnyBase dyn_disc = (DynAnyBase) m_factory.create_dyn_any(m_base_type.member_label(i)); setIndex(i, dyn_disc); return; } } } catch (BadKind bk) { throw new BAD_TYPECODE(bk.toString()); } catch (Bounds bd) { throw new INTERNAL(bd.toString()); } catch (InconsistentTypeCode itc) {/* unreachable */ return; } throw new InvalidValue("Union has not any member named: " + arg); }
public org.omg.DynamicAny.NameValuePair[] get_members() { if (m_destroyed) throw new OBJECT_NOT_EXIST("DynAny destroyed."); try { Any[] any_members = super.get_elements(); NameValuePair[] members = new NameValuePair[m_component_count]; for (int i = 0; i < m_component_count; i++) { members[i] = new NameValuePair(m_base_type.member_name(i), any_members[i]); } return members; } catch (BadKind bk) { /* unreachable */ throw new BAD_TYPECODE(bk.toString()); } catch (Bounds bd) { /* unreachable */ throw new INTERNAL(bd.toString()); } }
public void set_members(org.omg.DynamicAny.NameValuePair[] value) throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue { try { if (m_destroyed) throw new OBJECT_NOT_EXIST("DynAny destroyed."); reset(); if (value.length != m_component_count) throw new TypeMismatch("Invalid number of members: " + m_component_count + " expected, not " + value.length); Any[] members_values = new Any[m_component_count]; for (int i = 0; i < m_component_count; i++) { members_values[i] = value[i].value; if (!m_base_type.member_name(i).equals(value[i].id)) throw new InvalidValue("Invalid member name, " + m_base_type.member_name(i) + "expected, not " + value[i].id); } set_elements(members_values); } catch (BadKind bk) { /* unreachable */ throw new BAD_TYPECODE(bk.toString()); } catch (Bounds bd) { /* unreachable */ throw new INTERNAL(bd.toString()); } }
public org.omg.DynamicAny.NameDynAnyPair[] get_members_as_dyn_any() { if (m_destroyed) throw new OBJECT_NOT_EXIST("DynAny destroyed."); try { DynAny[] dyns = super.get_elements_as_dyn_any(); NameDynAnyPair[] members = new NameDynAnyPair[m_component_count]; for (int i = 0; i < m_component_count; i++) members[i] = new NameDynAnyPair(m_base_type.member_name(i), dyns[i]); return members; } catch (BadKind bk) { /* unreachable */ throw new BAD_TYPECODE(bk.toString()); } catch (Bounds bd) { /* unreachable */ throw new INTERNAL(bd.toString()); } }
public void set_members_as_dyn_any(org.omg.DynamicAny.NameDynAnyPair[] value) throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue { if (m_destroyed) throw new OBJECT_NOT_EXIST("DynAny destroyed."); if (value.length != m_component_count) throw new TypeMismatch("Invalid number of members: " + m_component_count + " expected, not " + value.length); DynAny[] members_values = new DynAny[m_component_count]; try { for (int i = 0; i < m_component_count; i++) { members_values[i] = value[i].value; if (!m_base_type.member_name(i).equals(value[i].id)) throw new InvalidValue("Invalid member name, " + m_base_type.member_name(i) + "expected, not " + value[i].id); } } catch (BadKind bk) { /* unreachable */ throw new BAD_TYPECODE(bk.toString()); } catch (Bounds bd) { /* unreachable */ throw new INTERNAL(bd.toString()); } set_elements_as_dyn_any(members_values); }
protected TypeCode getComponentType(int position) { try { return m_base_type.member_type(position); } catch (BadKind bk) { /* unreachable */ throw new BAD_TYPECODE(bk.toString()); } catch (Bounds bd) { /* unreachable */ throw new INTERNAL(bd.toString()); } }
public String get_as_string() { if (m_destroyed) throw new org.omg.CORBA.OBJECT_NOT_EXIST("DynAny destroyed."); try { return m_base_type.member_name(m_enum_value); } catch (Bounds bd) { return null; } catch (BadKind bk) { return null; } }
public java.lang.String member_name(int index) throws org.omg.CORBA.TypeCodePackage.BadKind, org.omg.CORBA.TypeCodePackage.Bounds { if (index < m_members.length) return m_members[index].name; else throw new org.omg.CORBA.TypeCodePackage.Bounds(); }
public org.omg.CORBA.TypeCode member_type(int index) throws org.omg.CORBA.TypeCodePackage.BadKind, org.omg.CORBA.TypeCodePackage.Bounds { if (index < m_members.length) return m_members[index].type; else throw new org.omg.CORBA.TypeCodePackage.Bounds(); }
public short member_visibility(int index) throws org.omg.CORBA.TypeCodePackage.BadKind, org.omg.CORBA.TypeCodePackage.Bounds { if (index < m_members.length) return m_members[index].access; else throw new org.omg.CORBA.TypeCodePackage.Bounds(); }
/** * Marshal the given typecode params in a * <code>es.tid.TIDorbj.core.CDRInputStream</code>. This method will * alwais be invoked by this stream. * * @param type * the <code>TypeCode</code> * @param output * the <code>es.tid.TIDorbj.core.CDRInputStream</code> * @pre the the <code>TypeCode</code> must be a value type */ public static void writeParams(TypeCode type, CDROutputStream output) { try { ComplexTypeCode.writeParams(type, output); output.write_short(type.type_modifier()); output.write_TypeCode(type.concrete_base_type()); int length = type.member_count(); output.write_ulong(length); for (int i = 0; i < length; i++) { output.write_string(type.member_name(i)); output.write_TypeCode(type.member_type(i)); output.write_short(type.member_visibility(i)); } } catch (BadKind bk) { throw new BAD_TYPECODE("Fault in value type operations:" + bk.toString()); } catch (Bounds bds) { throw new BAD_TYPECODE("Fault in value type operations:" + bds.toString()); } }
/** * Dumps the description of a given TypeCode. * * @param type * the <code>TypeCode</code> * @param output * the output stream where the TypeCode will be dumped * @pre <code>type</code> must be an enum type. */ public static void dump(TypeCode type, java.io.PrintWriter output) throws java.io.IOException { try { output.print("[TYPECODE]{value "); ComplexTypeCode.dumpParams(type, output); output.print(", visibility= "); output.print(type.type_modifier()); output.print(", concrete base= "); TypeCodeDumper.dump(type.concrete_base_type(), output); output.print(" {"); int length = type.member_count(); for (int i = 0; i < length; i++) { output.print(type.member_visibility(i)); output.print(' '); output.print(type.member_name(i)); output.print(": "); TypeCodeDumper.dump(type.member_type(i), output); } output.print('}'); } catch (BadKind bk) { throw new BAD_TYPECODE("Fault in value operations:" + bk.toString()); } catch (Bounds bds) { throw new BAD_TYPECODE("Fault in value operations:" + bds.toString()); } }