[omniORB] Is this possible?
Sang-Hoon,Lee
noohgnas at gmail.com
Thu Jun 2 20:41:23 BST 2005
hi all.
I'm a newbie about CORBA progamming.
I have a question. Is this possible not using idl definition on
omniORB? please, see the follow (Pseudo )code.
struct Something_s {
unsigned int index;
char * data;
};
Something_s myStruct;
myStruct.index = 100;
myStruct.data = "Blah Blah";
mySend(&myStruct, sizeof(myStruct));
This code is wrapped upon CORBA code. Main propose of it is structure
sending through ORB. But end devepolper does not inner logics because
of wrapping.
I'd tried for solving it like below which was refered from the book of
Steve Vinoski.
<message.idl>---------------
typedef sequence<octet> Data_BinSeq;
struct NumberedMsg_s
{
unsigned short msgNum;
Data_BinSeq msg;
};
------------------------------------
<lib.cc>--------------------- // client side
...
NumberedMsg_s NumMsg;
CORBA::Octet * buf;
char * temp;
temp = (char *)szmsg;
buf = new CORBA::Octet[size];
Data_BinSeq dataBinSeq(size);
dataBinSeq.length(size);
for (CORBA::ULong i=0; i < size; i++)
{
dataBinSeq[i] = temp[i];
}
...
<lib2.cc>---------------// server side
...
NumberedMsg_s * pszMsg = NULL;
CORBA::Octet * buf;
char * recvedData;
if( data >>= pszMsg )
{
buf = pszMsg->msg.get_buffer();
recvedData = (char *)malloc(pszMsg->msg.length());
for (CORBA::ULong i=0; i < pszMsg->msg.length(); i++)
{
recvedData[i] = pszMsg->msg[i];
}
...
The result that it does not match what I wanted. It's broken sting.
btw 'unsigned int index' value is right. I don't know why... I don't
know why and problem.
thank you your help.
More information about the omniORB-list
mailing list