pointer to char* with seize 480000

This is a discussion on pointer to char* with seize 480000 within the Object forums in Theory and Concepts category; Hello, it is a simple problem. And it worked some months ago. Now after some new compilations I do not get it running. Was it acoincidence ???? The purpose of the code below is to send single 8 Bit images, which I receive by a char* pointer whith allocated memory of [480000]. The method work proper locally without any CORBA stuff but if I try to sent it via CORBA (in this case Mico), I only receive a char * of length 1 with the actual value of the first pixel. How do I get the other 479 999. It ...

Go Back   Application Development Forum > Theory and Concepts > Object

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 10-07-2003, 07:26 AM
Bernd Hillers
Guest
 
Default pointer to char* with seize 480000

Hello,
it is a simple problem. And it worked some months ago. Now after some
new compilations I do not get it running. Was it acoincidence ????
The purpose of the code below is to send single 8 Bit images, which I
receive by a char* pointer whith allocated memory of [480000]. The
method work proper locally without any CORBA stuff but if I try to
sent it via CORBA (in this case Mico), I only receive a char * of
length 1 with the actual value of the first pixel. How do I get the
other 479 999. It would be nice to get some hints, tricks, pitfalls.

Thanks Bernd H.



//IDL
interface VHFS_Fuga1000_inter
{
string GetDataPointer ( );
}


//header
class VHFS_Fuga1000_impl : virtual public POA_VHFS_Fuga1000_inter
{
public:
char* GetDataPointer();
}



//source
//Method to be published via MICO
char* VHFS_Fuga1000_impl::GetDataPointer()
{
// VHFS_local->GetDataPointer return a char* of seize 480000
// which contains an image
return CORBA::string_dup( ( char * ) VHFS_local->GetDataPointer()
);
}



//-------------------------------------------------------
// Call by server
char* pcharpointer = VHFS_Server->GetDataPointer();
Reply With Quote
  #2  
Old 10-07-2003, 12:27 PM
Gary D. Duzan
Guest
 
Default Re: pointer to char* with seize 480000

In article <953bd944.0310070326.5a3cd2d0@posting.google.com >,
Bernd Hillers <hillers@iat.uni-bremen.de> wrote:
>Hello,
>it is a simple problem. And it worked some months ago. Now after some
>new compilations I do not get it running. Was it acoincidence ????
>The purpose of the code below is to send single 8 Bit images, which I
>receive by a char* pointer whith allocated memory of [480000]. The
>method work proper locally without any CORBA stuff but if I try to
>sent it via CORBA (in this case Mico), I only receive a char * of
>length 1 with the actual value of the first pixel. How do I get the
>other 479 999. It would be nice to get some hints, tricks, pitfalls.


You can't pass binary data in strings in CORBA; instead you'll
want to use a sequence of octet. The sequence class has replace()
and get_buffer() methods to help you avoid excess copying. You
should be able to find examples of how to do this in most CORBA
reference books.

Gary Duzan
BBN Technologies
A Verizon Company


Reply With Quote
  #3  
Old 10-07-2003, 01:41 PM
Ciaran McHale
Guest
 
Default Re: pointer to char*&#12288;with&#12288;seize 480000

hillers@iat.uni-bremen.de (Bernd Hillers) wrote in message news:<953bd944.0310070326.5a3cd2d0@posting.google. com>...
> Hello,
> it is a simple problem. And it worked some months ago. Now after some
> new compilations I do not get it running. Was it acoincidence ????
> The purpose of the code below is to send single 8 Bit images, which I
> receive by a char* pointer whith allocated memory of [480000]. The
> method work proper locally without any CORBA stuff but if I try to
> sent it via CORBA (in this case Mico), I only receive a char * of
> length 1 with the actual value of the first pixel. How do I get the
> other 479 999. It would be nice to get some hints, tricks, pitfalls.


The problem is that you are trying to send binary data (which might
contain null bytes) as a (printable) string. CORBA/C++ uses a null byte
to terminate a string so CORBA thinks that the first null byte in the
data is the end of the string. What you should do is transmit the data
as a sequence<octet>. A sample of appropriate IDL is:

typedef sequence<octet> octetSeq;
interface Foo {
octetSeq get_ binary_data();
};

Look in your CORBA product's manual (or the CORBA IDL-to-C++ specification)
for details on how to efficiently put a sequence<octet> wrapper around
binary data.


Regards,
Ciaran.
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 07:58 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.