[omniORB] optional values

Bruno Marconi bmarconi at cisco.com
Wed Oct 8 10:29:59 BST 2003


You can also use a union with a boolean discriminant:

union optional_Foo switch(boolean) {
   case TRUE: Foo value;
};

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

I like this style better than a sequence because it makes it more 
explicit that it is an optional type. 

-
Bruno


> -----Original Message-----
> From: omniorb-list-bounces at omniorb-support.com
> [mailto:omniorb-list-bounces at omniorb-support.com]On Behalf Of Geoff
> Gerrietts
> Sent: Tuesday, October 07, 2003 12:00 PM
> To: Gary Duzan
> Cc: omniorb-list at omniorb-support.com
> Subject: Re: [omniORB] optional values
> 
> 
> Quoting Gary Duzan (gduzan at bbn.com):
> > 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.
> 
> Elegant and clean. Thank you very much for the insight; this list has
> been very helpful in getting me past these little speedbumps in the
> best way possible. As I've said to many: my experience moving from
> ILU to omniORB has gone much better than I could have expected,
> largely because the community has been so supportive.
> 
> Thanks again!
> --G.
> 
> -- 
> Geoff Gerrietts             "Whenever people agree with me I always 
> <geoff at gerrietts net>     feel I must be wrong." --Oscar Wilde
> 
> _______________________________________________
> omniORB-list mailing list
> omniORB-list at omniorb-support.com
> http://www.omniorb-support.com/mailman/listinfo/omniorb-list



More information about the omniORB-list mailing list