| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| 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(); |
|
#2
| |||
| |||
| 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 |
|
#3
| |||
| |||
| 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. |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.