[omniORB] Beginner's question on IOR and multiple interfaces

Duncan Grisby duncan@grisby.org
Tue Sep 10 16:54:00 2002


On Tuesday 10 September, Jens Nissen wrote:

> I want to implement a server object, which exposes two or more interfaces to
> its internal representation.

If you mean you want a single servant class to implement more than one
IDL interface, then you cannot do that, unless you declare an IDL
interface derived from the two (or more) interfaces.

i.e., given

  interface I {
    void one();
  };
  interface J {
    void two();
  };

You cannot implement them both in C++ with something like

  class MyServant : public virtual POA_I, public virtual POA_J {...};

Instead, you must first declare

  interface K : I, J {};

then implement

  class MyServant : public virtual POA_K {...};


[...]
> (a) Does each interface have to have its own IOR?

No. When you activate your servant, the object reference for it
contains information about the most derived interface, which is K in
my example above. Clients receiving the reference will either know
that K is derived from I and J, or they will query the object to
check.

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan@grisby.org     --
   -- http://www.grisby.org --