[omniORB] Injecting Enum Name/Values into Enum's Namespace

Jeff Pitman symbiont at berlios.de
Wed Sep 21 16:27:23 BST 2005


On Wednesday 21 September 2005 13:24, Luke Deller wrote:
> Hi Jeff,
>
> What you're seeing is correct behaviour according to the Python
> Language mapping (
> http://www.omg.org/technology/documents/formal/python.htm ), section
> 1.3.3, which begins:

Yeah, thanks.  I just read through that section and saw that.

> > Then to get the value, I have to do this:
> > >>> FOO.value()
> >
> > 2
>
> This is a non-standard extension.  Strictly speaking, you shouldn't
> need to convert FOO to a number.

Ok, misunderstanding on my part.

> > I am using the following options for IDL compile:
> >
> > omniidl -Cstubs -nc -nf -bpython -Wbinline *.idl
> >
> > Inline is the only way i can access it in an OO way, it seems. Let
> > me know where I am messed up.
>
> I'm not quite sure what you mean about -Wbinline?

Nevermind.  It's all starting to clear up now.

The use case for the enumeration is to declare an ExceptionType which is 
an enumeration.  In the Java mapping, you can do things like 
MyException(MyExceptionType.TOO_MANY_FOOS, "area1", "You cannot have 
that many foos!").

However, with the Python mapping, I'm limited to:

MyException(TOO_MANY_FOOS, "area1", "You cannot have that many foos!")

Because TOO_MANY_FOOS is in the same ns as MyExceptionType (the 
enumeration).  Although it works properly, it's a bit of a roadblock to 
code portability and API documentation.  Of course, java won't work in 
python; but, similar constructs make it much easier for adoption.

I'll see what I can do to reinject them into the Enumeration ns in a 
top-level wrapper.

thanks,
-- 
-jeff



More information about the omniORB-list mailing list