Hello, I am attempting to send a structure (which has no null values
within it) that I created in my IDL, from my Java code, to a C++
configure function via CORBA calls. I insert the structure into a CORBA
Any using the helper class created by the IDL before I send it to my
C++ function. The psuedo code is below for Java:
______________________________________
properties[0].id = new String( "SELECT" );
TheStructure selected = new TheStructure();
selected.name = "NAME"; // type string
selected.number = 1234; //type int
Any strAny = mOrb.create_any();
TheStructureHelper.insert( strAny, selected );
properties[0].value = strAny;
try
{
toCPlusPlus.configure(properties);
}
_________________________________
Once in my C++ code I am not able to extract the structure from the
CORBA Any. The psuedo code is below in my C++ function:
_________________________________
TheStructure * extractInto;
if( incomingProperty >>= extractInto ) //* incomingProperty is my
CORBA Any with the structure in it *//
{
mName = CORBA::string_dup(extractInto->name);
mNumber = extractInto->number;
return true;
}
else
{
return false;
}
_________________________________
I have done this successfully with other data types such as floats,
ints, etc. but it will not work with a structure. I always get the
function returning false.
Any help or suggestion would be greatly appreciated! Thanks!
Mike - 07 Dec 2005 19:32 GMT
Why are you using the Any? You should be able to return the Struct
itself, i.e.
TheStructure_var theStruct= corbareference.getTheStruct();