CPP 1.3 NO IDEA Avatar
  1. OMG Issue

CPP13 — Optional parameters for _create_request?

  • Key: CPP13-53
  • Legacy Issue Number: 4150
  • Status: open  
  • Source: Triodia Technologies Pty Ltd ( Michi Henning)
  • Summary:

    On page 1-119, the spec says the following about _create_request() and

    [...] the ORB requires:

    • a target object reference
    • an operation name
    • a list of arguments (optional)
    • a place to put the result (optional)
    • a place to put any returned exceptions
    • a Context (optional)
    • a list of the user-defined exceptions that can be
      thrown (optional)
    • a list of Context strings that must be sent with the
      operation (optional)

    Note all the "optional" remarks.

    It's not clear what "optional" actually means. We have two cases for
    these parameters:

    • Arguments, user exceptions, and IDL contexts are sequences.
    • Result and context are object references.

    Two questions:

    • What does it mean for a sequence parameter to be "optional"?
      That I can pass a null pointer or that I can pass an empty
      sequence? I assume that an empty sequence is meant, but the spec
      doesn't say that.
    • What does it mean for a reference parameter to be "optional"?
      That I can pass a nil reference or that I must pass a reference
      to some dummy object that indicates that the value really isn't

    Where this is particularly annoying is for the return value. (The
    "result" parameter to _create_request()):

    • If I can pass a nil reference, no problem. This could
      be interpreted to mean the same thing as a void
      return type.
    • If I can't pass a nil reference, what should I pass?
      Obviously, it would have to be a reference to a valid
      NamedValue object. But how do I create that NamedValue

    I can call ORB::create_named_value(), but what should
    I do then?

    CORBA::NamedValue_var result;

    At this point, I have a NamedValue containing an Any with
    tk_null (because that's what the Any default constructor
    creates). However, to correctly indicate that the operation
    I want to call has a void return type, I have to make a
    NamedValue that contains an Any with tk_void. But, how do
    I achieve that? I can't use one of the Any inserters to
    turn the TypeCode in the Any into tk_void, and I can't
    use the type() member of the Any because I can't change the
    type of an Any if it isn't consistent with the TypeCode that's
    already there...

    Even worse, the NamedValue doesn't seem to make sense as
    the return value at all. For one, it has a name attribute.

    • What is the value of that name for a return value?
    • How would I set that string after having create the NamedValue
      by calling create_named_value()?
    • What is the value of that string once I have called

    Second, the NamedValue contains a flags attribute.

    • What is the value of that flags attribute for a return value?
      None of ARG_IN, ARG_INOUT, or ARG_OUT make sense. (One could
      argue that ARG_OUT could be used, but I think that sucks...)
    • How would I set that flag on the NamedValue I have just created?
      The mapping for NamedValue only offers accessor but no
      modifiers, so I can't set the value of the flag.
    • What is the value of the flag once I have called

    It seems that the easiest way to fix the problem is to state that, if a
    parameter isn't needed, this is indicated by an empty sequence for lists,
    and by a nil reference for objects.

    However, the problems around create_named_value() and appear to be more
    serious. How should we fix those?

  • Reported: CPP 1.1 — Tue, 16 Jan 2001 05:00 GMT
  • Updated: Fri, 6 Mar 2015 20:58 GMT