[omniORB] Returning None Where Structs Are Required

Gary D. Duzan gdd0@gte.com
Tue, 29 May 2001 08:32:39 -0400


In Message <3B12D9E0.547080AD@isogen.com> ,
   "W. Eliot Kimber" <eliot@isogen.com> wrote:

=>I notice that OmniORBpy does not allow None where the IDL requires a
=>struct. Is this a CORBA restriction or an OmniORB implementation choice?
=>Have I missed some obvious way to get the equivalent of passing in or
=>returning None for structs? I didn't see anything about this one way or
=>the other in the language mapping, but I didn't read it that closely.
=>
=>For example, I have an iterator that returns a struct on each next()
=>call. It would be most convenient if I could return None when the
=>iterator is at the end of the list. I am using structs instead of
=>objects to take advantage of the efficiency of structs.

   The CORBA/IDL model doesn't allow for null structs. The two
alternatives that sprint to mind would be to throw an exception
when you hit the end of the iteration, or always return a sequence
of structs, leaving it empty if there is no more data.

=>Also, WRT some of our earlier questions about sequences of structs: I
=>did determine that the variable was whether or not the struct class
=>instance was an instance of the generated Python class or an arbitrary
=>class that happens to have the correct member variables. OmniORB appears
=>to be happy to pass around single instances of arbitrary classes but
=>when you use the same object in a sequence, it complains. I can see the
=>justification for this--the ORB has to do type checking on the members
=>of the sequence--but the fact that it also allows arbitrary classes in
=>the non-sequence case does lead to the confusion that threw me for a
=>while today. I guess the solution if you want to have you own
=>convenience struct objects (e.g., to provide more convenient
=>constructors) would be to simply subclass from the generated struct
=>classes. I seem to have difficulty remembering that struct classes are
=>not transmitted as object references and therefore can be used anywhere.

   This I don't know anything about.

					Gary Duzan
					Verizon IT