[omniORB] Data relaying
Duncan Grisby
duncan at grisby.org
Tue Jul 31 17:51:13 BST 2007
On Friday 20 July, "Wernke zur Borg" wrote:
[...]
> The C++ equivalent for this interface is
>
> // C++
> void DataRelay::putData( const Data& d );
> Data* DataRelay::getData();
>
> The problem with this is that each data item must be copied at least
> once during putData(). Since performance is an issue in my case I am
> looking for a way to minimise copying the data. However with the const
> argument& I do not see a way to avoid it.
You can't avoid it if you stick with the standard C++ mapping. This is
one of the many issues that makes the C++ mapping far from ideal.
If you're willing to get your hands dirty and make your code omniORB
specific, you can get in at a level below the C++ mapping and avoid the
unnecessary copying. If you look at the code generated by omniidl, in
the SK.cc file, you'll find definitions of call descriptor classes for
each of the IDL operations. Those are the things responsible for
marshalling and unmarshalling arguments, and calling the servant
methods. What you can do is write your own versions of those classes
that do different memory management -- in your case, passing the in
struct argument by pointer instead of const reference.
Then you can override the _dispatch() method of the _impl_ class, which
is the thing responsible for creating the call descriptor and performing
the call.
Hopefully you'll be able to follow the logic through all the generated
code and see how to change it. I wouldn't recommend this path unless
you've definitely established that the data copying is a significant
performance issue, though.
Cheers,
Duncan.
--
-- Duncan Grisby --
-- duncan at grisby.org --
-- http://www.grisby.org --
More information about the omniORB-list
mailing list