[omniORB] CORBA::Any_var

Ken Feuerman kfeuerma@adobe.com
Fri, 11 Jan 2002 08:55:31 -0800


Ah, right, I guess the real question then is:  Is there any (nice? 
official?) way to tell if any of the T_var types has been initialized with 
a corresponding non-NULL T_ptr?  I take it from your previous message that 
the answer is "no", but that one must resort to using operator->() explicitly?

--Ken Feuerman.
Adobe Systems, Inc.

At 04:45 PM 1/11/2002 +0000, Duncan Grisby wrote:
>On Friday 11 January, Ken Feuerman wrote:
>
> > What about making use of the TypeCode somehow?  Something along the 
> lines of
> >
> > CORBA::Any_var a;
> > CORBA::TypeCode_var tc = a->type();  // not sure if "TypeCode_var" is an
> > official mapping?
> > if (tc->kind() == tk_null)
> >      cout << "The Any_var has not been initialized" << endl;
>
>That doesn't work since the Any_var's internal pointer is initialised
>to null. The call to a->type() would segfault. The approach works with
>bare Anys, though:
>
>   CORBA::Any a;
>   CORBA::TypeCode_var tc = a.type();
>   if (tc->kind() == tk_null)
>     cout << "Any has not had anything inserted" << endl;
>
>Cheers,
>
>Duncan.
>
>--
>  -- Duncan Grisby  \  Research Engineer  --
>   -- AT&T Laboratories Cambridge          --
>    -- http://www.uk.research.att.com/~dpg1 --