accessing members of object implmentation

Sai-Lai Lo S.Lo@orl.co.uk
Thu, 20 Nov 1997 21:48:22 GMT


>>>>> Michele Bini writes:

> Nope. CORBA doesn't provide a way to convert A_ptr (which is basically a 
> wrapper around an IOR) to its implementation: it would be impossible to
> do so, as there is no guarantee that A_ptr refers to an object in
> B_Factory_i address space (a buggy or mischievous client could pass an
> IOR for an object residing elsewhere or not existing at all).

Agree.

> A possible solution is keeping a map<IORs,A_i*> in A_Factory_i.

For example an open hash table from A_ptr to A_i. Two standard functions
can be used:
   1. CORBA::Object::_hash() to do the hashing
   2. CORBA::Object::_is_equivalent() to test for a match.


Alternately, you may use inheritance:

interface A;

interface B : A {
  void manipulate();
};

interface A_Factory {
   A newA();   // instantiate a B and returns it as A
};

Clients that need to manipulate A can do so by first narrow A to B.

Regards,

Sai-Lai

-- 
E-mail:         S.Lo@orl.co.uk          |       Olivetti & Oracle Research Lab
                                        |       24a Trumpington Street
Tel:            +44 223 343000          |       Cambridge CB2 1QA
Fax:            +44 223 313542          |       ENGLAND