CORBA 2.4 MAILINGLIST Avatar
  1. OMG Issue

CORBA24 — Nested Recursive Structs Legal in 2.3.x?

  • Key: CORBA24-104
  • Legacy Issue Number: 3764
  • Status: closed  
  • Source: Perot Systems ( Bill Binko)
  • Summary:

    Given the IDL below, is the third case (labeled "Nested Recursive
    Case") legal in CORBA 2.3.x? (I understand that the answers to my questions
    may change in 2.4: I am interested in possible flaws in 2.3 at the moment).
    If it is legal, I have some concerns listed after the IDL:

    //IDL
    module recurse
    {
    //Recursive Struct: This is legal
    struct TestStruct1

    { sequence<TestStruct1> list; }

    ;
    // Nested Struct: This is legal
    struct TestStruct2 {
    struct TestStruct3

    { long threeMember; }

    twoMember;
    };
    // Nested Recursive Case: IS THIS LEGAL?
    struct One {
    struct Two

    { sequence<One> twoMember; }

    oneMember;
    };
    };

    1) If this IDL is loaded into an IFR, and the type() method of the StructDef
    for ::recurse::One::Two is called, what should happen? I can think of at
    least three interpretations of the spec (in particular, section 10.5) :

    a) type() should fail since the TypeCode for Two is not valid
    outside of the definition of One. If this is the case, what should it
    throw? (the natural result of many implementations would be MARSHAL, but
    that seems wrong)

    b) type() should succeed and should include a complete, valid
    TypeCode of the form:

    //BEGIN TYPECODE//
    Struct_tc(Two)
    MemberList
    StructMember
    twoMember,
    TypeCode: Struct_tc(One)
    MemberList
    StructMember
    oneMember,
    TypeCode: Recursive_tc("IDL:recurse/One/Two:1.0")
    //END TYPECODE//

    c) type() should succeed and should include a complete, valid
    TypeCode of the form:

    //BEGIN TYPECODE//
    Struct_tc(Two)
    MemberList
    StructMember
    twoMember,
    TypeCode: Struct_tc(One)
    MemberList
    StructMember
    oneMember,
    TypeCode: Struct_tc(Two)
    MemberList
    StructMember
    twoMember,
    TypeCode: Recursive_tc("IDL:recurse/One:1.0")
    //END TYPECODE//

    2) Similarly, what should the behavior be when the type() method on the
    generated structs (or their Helper classes in Java) are called? In
    particular, at what point is the ORB responsible for "embedding" the
    recursive TypeCode in its enclosing TypeCode as specified by section 10.7.3
    "Creating TypeCodes"?

    For example, given the following code (in Java, but applied to other
    languages):

    TypeCode recursiveTC = orb.create_recursive_tc("IDL:recurse/One:1.0");

    org.omg.CORBA.StructMember[] members = new
    org.omg.CORBA.StructMember[1];
    members[0] = new org.omg.CORBA.StructMember("twoMember",
    _orb().create_sequence_tc(0, recursiveTC), null);
    /1/ TypeCode twoType = _orb().create_struct_tc(id(), "Two", members);

    members = new org.omg.CORBA.StructMember[1];
    members[0] = new org.omg.CORBA.StructMember("oneMember", twoType,
    null);
    /2/ TypeCode oneType = _orb().create_struct_tc(id(), "One", members);

    If 1 attempted to resolve the recursive TC, it would fail.
    If 2 attempted to resolve the recursive TC, it would succeed, but would
    have to traverse all of twoType's members to see if there was a recursive TC
    in there.

    Any other thoughts on this issue would be appreciated.

  • Reported: CORBA 2.3.1 — Tue, 25 Jul 2000 04:00 GMT
  • Disposition: Resolved — CORBA 2.4
  • Disposition Summary:

    Close no change with explanation as above.

  • Updated: Fri, 6 Mar 2015 20:58 GMT