Discussion:
[omniORB] Issue while extract Array Element from Client Side
Lakshmeeshk
2009-12-03 19:22:45 UTC
Permalink
Hi All,



I am using Any_out as function parameter. Inserting array type of long at
server side and trying to extract the array in client side.

But, while extracting these elements it's only showing the 1st element and
not the second element.



I have sample of source code below for your reference.



Could anyone suggest me what could be the solution.



Server Side:



void abc_i::read ( Long AddId, CORBA::Any_OUT_arg Data)

{



Data = new CORBA::Any();

CORBA::Long tempTag[2]= {40,20};



*Data<<=tempTag[0];

*(Data+1)<<=tempTag[1];



}



Client Side:



CORBA::Any_var Data;



xyz_var -> read ( AddId, Data );



CORBA::Long tagValue[2];



Data.inout() >>= *tagValue;



cout<< "tagValue[0]" << tagValue[0] << endl;

cout<< "tagValue[1]" << tagValue[1] << endl;



Output:

tagValue[0]40

tagValue[1]1 -----> it has to show 20





Regards,

Lakshmeesh







-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20091203/320efc67/attachment.htm
Lakshmeeshk
2009-12-04 11:02:54 UTC
Permalink
Hi,

You are correct; I am allocating memory for only for Any. Since, it's a
CORBA::Any_var;

CORBA::Long tempTag[2];

I am creating temporary "tempTag" array, I tried to pointing to next element
in the array. In server side I am able to retrieve the element of 1st and
2nd from array and it is not giving the 2nd element in client side.

Also, I just tested inserting whole array into *Data in server side and it
is possible to retrieve the entire element in server side.

*Data<<=tempTag;

Data.inout >>= *tagValue;

But not the same as in client side.

If you have any idea to resolve this problem, please let me know.

Regards,
Lakshmeesh

-----Original Message-----
From: Kevin Bailey [mailto:ke-***@retriever.dyndns.org]
Sent: Thursday, December 03, 2009 9:35 PM
To: Lakshmeeshk
Subject: Re: [omniORB] Issue while extract Array Element from Client Side
Post by Lakshmeeshk
Data = new CORBA::Any();
...
*Data<<=tempTag[0];
*(Data+1)<<=tempTag[1];
You only allocated one Any. What is Data+1 pointing at ?

Loading...