|
|
|
|||||
|
Hi,
In CORBA C++, I'm used to dealing with sequence<octet>. This maps to a CORBA::Octet buffer (which basically is a char buffer), which you can manipulate quite easily with get_buffer() and replace(). In Ice, a sequence<byte> maps to a vector<Ice::Byte>. Is there a way to do the CORBA C++ equivalent of get_buffer() and replace()? To try thiings out in Ice, I made an interface:: sequence<byte> FrameData; interface FrameOps { void sendFrame(FrameData f); }; My client code looks like (eliminating all the Ice boilerplate to get an object reference to a FrameOps object: std::ifstream f; f.open(argv[1], std::ios_base::binary); if( f.fail() ) { std::cout << "Failed" << std::endl; return -1; } f.seekg(0, std::ios_base::end); long len = f.tellg(); std::cout << "Pos: " << len << std::endl; f.seekg(0, std::ios_base::beg); Ice::Byte *buf = new Ice::Byte[len]; f.read(buf, len); FrameData v(&buf[0], &buf[len]); frame_ops->sendFrame(v); Using this technique, I have to create a separate Ice::Byte buffer, and then copy that into a vector<Ice::Byte> before calling the remote method. Is there a more optimal way for me to do this, or is this the best way? Thanks.
__________________
-- Craig Rodrigues |
|
|||||
|
Hi,
OK, I simplified myt code and it works great! I changed it to: ================================================== ======== std::ifstream f; f.open(argv[1], std::ios_base::binary); if( f.fail() ) { std::cout << "Failed" << std::endl; return -1; } f.seekg(0, std::ios_base::end); long len = f.tellg(); f.seekg(0, std::ios_base::beg); FrameData v(len); f.read(&v[0], len); frame_manip->sendFrame(v); frame_ops->sendFrame(v); ================================================== ======== Thanks!
__________________
-- Craig Rodrigues |
|
||||||
|
Quote:
![]() Cheers, Michi. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Patch #6 for Ice 3.1.0: byte sequences in dictionaries | dwayne | Patches | 1 | 07-31-2006 10:35 AM |
| UnmarshalOutOfBoundsException when sending byte sequences | csammis | Help Center | 3 | 08-03-2005 04:37 PM |
| Questions about sanity-check of sequence sizes during sequence unmarshaling | rc_hz | Help Center | 4 | 06-22-2005 10:33 PM |
| Ice::Byte question.. | yserge | Help Center | 1 | 08-19-2004 06:54 PM |
| Chars to Ice::Byte | catalin | Help Center | 6 | 12-14-2003 10:03 AM |