[omniORB] Implementing multiple interfaces in one servant

Chris Newbold chris.newbold@laurelnetworks.com
Tue, 19 Sep 2000 18:29:09 -0400


Duncan Grisby wrote:

> You cannot do this with the inheritance approach. The C++ mapping
> specification specifically prohibits it. You might be able to use ties
> to do what you want, but I suspect that what you really want is Gary's
> suggestion of declaring an interface which derived from the two
> interfaces.

Actually, ties work just fine for me (aside from being somewhat messy
in the implementation). The two IDL interfaces really have no relation
to each other, so at no time will a client ever expect to be able to
narrow "across" from one type to the other.

What I'm trying to do is implement an adaptor between two similar but
unlrelated interfaces: a client can get a reference to interface A
and actually talk to an object of interface B, and vice-versa. It's
very convenient to implement this with a servant which supports both
interfaces.

I don't need, or want, to declare a new interface which combines A and
B since no client should ever see the composition.

-Chris Newbold
Laurel Networks