accessing members of object implmentation

Michele Bini mbini@dada.it
Thu, 20 Nov 1997 11:46:38 +0100


On Wed, 19 Nov 1997 13:09:30 +0100  "Bernd Daum" <daum@dik.maschinenbau.tu-darm
stadt.de> wrote:

> Example:
>
> **** IDL  ***
>
> interface A;
>
> interface A_Factory {
> 	A newA();
> 	manipulate(in A aref);
> }
>
>
> **** C++ ***
>
> class A_i: public virtual _sk_A {
> public:
> 	Flout added_data;        //added member
>
> }
>
>
> class B_Factory: public virtual _sk_B_Factory {
// I assume you meant A_Factory_i and _sk_A_Factory here
>            .
>            .
> manipulate(A_ptr aref) {
>   aref->added_data++;     // making  something with added_data:
>     			  // this doesn't work, because 'added_data'
>                           // is no visible member of A.
 
> Is there anybody, who know a (CORBA-like) solution.

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).

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

-- 
                                   Michele Bini: mbini@dada.it