[omniORB] optional values

Gary Duzan gduzan at bbn.com
Tue Oct 7 11:42:43 BST 2003


In Message <20031006190537.GA29152 at thoth.homegain.com> ,
   Geoff Gerrietts <geoff at gerrietts.net> wrote:

=>ILU had a keyword OPTIONAL which was mapped in Python to mean either
=>the value, or None.
=>
=>It looks to me like CORBA's more general Value Types are the
=>equivalent of this mechanism. It also appears to me, based on the
=>documentation, that Value Types are not presently supported under 4.0
=>and 2.2.
=>
=>Am I correct? Anyone have some savvy workarounds?

   Correct. One option is to use a bounded sequence of the given type,
with maximum length 1, where the sequence is empty if the value is
omitted and the first element holds the value if it is specified. For
example:

===========================================================================
#include "Foo.idl"

module Bar {
  typedef sequence<Foo, 1> optional_Foo;

  interface BarInterface {
    void do_something(in long x, in optional_Foo y);
  };
};
===========================================================================

The servant can check the length of y to see if the value is there.

					Gary Duzan
					BBN Technologies
					A Verizon Company





More information about the omniORB-list mailing list