Discussion:
[omniORB] trouble in extracting a struct from any
Amit Kumar
2009-09-30 18:45:58 UTC
Permalink
Hello All,



I am passing a structure as "any" argument in a function. Also, I am trying
to extract the same within the function body. But I am getting error at the
compilation time itself. Details as follows:



//Function Body

void myFunction(CORBA::Any& data)

{

Information * localInfo; // "Information" is a structure defined in the
IDL . "ID" and "name" are the two members of this structure.

list<CORBA::Any*> myList;

myList.push_back(new CORBA::Any(data)); //I am storing the data in a list
for some other use

myList.front() >>= localInfo;

}





I am getting following compilation error for the function.



error: invalid operands of types `CORBA::Any*' and `Information*' to binary
`operator>>'

in evaluation of `operator>>=(class CORBA::Any*, struct Information*)'





I am using the structure and function call as below:



long ID_No = 10;

CORBA::Any myName;

myName <<= "Amit" ;

Information * myInfo; // "Information" is a structure defined in the IDL .
"ID" and "name" are the two members of this structure.

myInfo->ID = (CORBA::ULong) ID_No;

myInfo->raw_data = myName;

CORBA::Any myAny;

myAny <<= myInfo;

myFunction(myAny); //Function call



Please help me to resolve this issue.



Thanks and Regards,

Amit







-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20090930/6c7a7221/attachment.htm
Loading...