[omniORB] Data relaying

Wernke zur Borg wernke.zur.borg at vega.de
Fri Jul 20 17:40:42 BST 2007


Imagine an application that plays the role of a relay between a number
of data providers and a number of data consumers. Data providers call
methods of the relay to deliver data. Data consumers call methods on the
relay to fetch data. The relay has a queue for buffering the data. The
data structures are the same for both sides, say:

// IDL
struct Data {
...
}; 

The relay interface for the data providers is something like:

// IDL
interface DataRelay {
	void putData( in Data d );	// queues the data
};

The relay interface for the data consumers is something like:

// IDL
interface DataRelay {
	Data getData();	// delivers first item from queue
};

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.

Any ideas?

Regards, Wernke




More information about the omniORB-list mailing list