[omniORB] sequence<interface>

oleg_machulski@geocities.com oleg_machulski@geocities.com
Fri, 18 Dec 1998 20:55:31 +0300 (MSK)


On 18-Dec-98 David Riddoch wrote:
> 
> That sounds roughly correct, but I'm not sure what you mean by
> seq_of_A::duplicate().
> 
You used _this() in your example, but in omniidl2
generated .hh file it is just a substitute for _duplicate:
--------------
  Hello_ptr _this() { return Hello::_duplicate(this); }
--------------

> Here's an outline of how I think it should be coded ...
Thank You very much, it worked.

> Server side:
> ============
> seq_of_A* B::getAseq()
> {
>   seq_of_A* s = new seq_of_A;
>   seq_of_A& seq = *s;
^^^^^^^^^^^^^^^^^^^^^^^^^^^
It was our fault.
> 
>   seq.length(2);
> 
>   A_impl* a = new A_impl(whatever ...);
>   a->_obj_is_ready(boa);
^^^^^^^^^^^^^^^^^^^^^^^^^^
boa->obj_is_ready(a); is better :)

>   seq[0] = a->_this();
> 
>   a = new A_impl(another one ...);
>   a->_obj_is_ready(boa);
>   seq[1] = a->_this();
> 
>   return s;
> }
> 
> Client side:
> ============
> void f(B_ptr b)
> {
>   seq_of_A* s = b->getAseq();
>   seq_of_A& seq = *s;
> 
>   s[0]->do_something();
> 
>   ...
> 
>   delete s;
> }

Maybe it could be useful to include this example into src/examples/
directory in omniORB distribution to avoid such questions as mine. I
asked it here just because I could not find by Altavista any example
which illustrates sequence<interface> usage.

Thank You once more.

---
Oleg Machulski
http://www.geocities.com/SiliconValley/Network/7671/
mailto:oleg_machulski@geocities.com
mailto:olegmachulski@usa.net