[omniORB] any using replace
4it-software.de
faiss@4it-software.de
Mon, 02 Jul 2001 19:08:09 +0200
Hi,
I have problems using replace with CORBA::Any
I'm porting a Visibroker application to OmniORB, where a server answers
queries by returning a Sequence of Any filled from an internal data
structure. To avoid multiple copying of values we decided to intialize
the Any using replace. While this works fine with
Visibroker we encountered two problems with OmniORB:
(1) this simple programm produces a very confusing output :
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
// initializing the base values
long * larray = new long[5];
for (CORBA::ULong k=0; k< 5; k++)
{
larray[k] = k+70;
}
//converting in anys
for (CORBA::ULong i=0; i< 5; i++)
{
CORBA::Any anAny;
anAny.replace(CORBA::_tc_long, larray + i, false);
cout << " original value : " << larray[i];
CORBA::Long rl;
if ( anAny >>= rl) {
cout << " Any value: " << rl << endl;
}
OUTPUT:
original value : 70 Any value: 70
original value : 71 Any value: 72 !!
original value : 72 Any value: 72
original value : 73 Any value: 74 !!
original value : 74 Any value: 74
I'm not sure, if my usage of replace is correct, but it looks like there
is something wrong in the offset calculation.
(2) Using replace directly on members of the Sequence produces an
incorrect message size when returning the Sequence:
IDL :
typedef sequence <any> AnySeq;
Source:
long * lval = new long (10);
AnySeq* asp = new AnySeq();
asp->length(10);
for (CORBA::ULong i=0; i< 10; i++)
{
(*asp)[i].replace(CORBA::_tc_long, lval, false);
}
In GIOP_S::InitialiseReply Exception is thrown in
if (bodysize > MaxMessageSize())
OMNIORB_THROW(MARSHAL,0,CORBA::COMPLETED_YES);
Again this looks like a miscalculation of the offsets ...
Any Help will be appreciated !
Regards,
Jochen Faiss
4iT Software GmbH