[omniORB] CORBA::Any_var

Duncan Grisby dgrisby@uk.research.att.com
Fri, 11 Jan 2002 16:45:09 +0000


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 --