[omniORB] &operator[] problem

Makay Geza makay@adixo.hu
Fri, 20 Jul 2001 07:48:34 +0200 (CEST)


Hi,

I am new to Corba, this might be a dumb question, but I simply cannot
resolve it.

I have a problem using an array of objects. I use operator[] for indexing
which is fine for using it in a one-machine non-Corba environment. I have
the operator[] return a reference to my class, since I want to use the
returned value on the left hand side of an assignment. On the other hand,
if I have the array object on the server side referenced from the client
side, and would like to use one element of the array on the client side on
the left hand side of an assignment, then operator[] must return a
reference. On the other hand, if it is a reference, then it will not be
released (deleted) after using it. Say the following code:

...
Array_var arref = Array::_narrow(obj);
arref[1] = (some new array element value);
...

Then arref[1] must be of type Array_var& in this setup, which is not on
the client side before using operator[], but after that it will not be
freed, since it is only a reference.

Sorry if this is a trivial question, but again: I am new to Corba. Could
someone point me in the right direction? Say: an example using this setup?

Thanks in advance.

Geza