[omniORB] about get _out from _ptr(object reference)

bjorn rohde jensen shamus@tdcadsl.dk
Mon, 22 Apr 2002 14:07:06 +0200


Hi Shifeng,

 I guess, i should have looked at the example code generated
by omniidl before refering to it;) It does look a little ugly.
I believe, the C++ mapping for CORBA object references is
the _ptr types, that is, what i have used so far. The in(),
inout(),out() and _retn() methods are for managing ownerships
for the _var wrapper types. I dont know, why that is sort of
working for you. Maybe some sort of convertion and temporary
objects cause that?

Yours sincerely,

Bjorn

zhang ji wrote:
> 
> Hi Bjorn,
> 
> Thanks for your reply!
> It happened like below situation:
> "
> interface test{
>         double add();
> };
> typedef sequence<test> testseq;
> 
> interface testfactory{
>         test gettest(in double x, in double y, out
> test ret);
> };
> "
> when the function gettest() want to get one interface
> as out parameter.
> 
> The omniidl generated siganature like below:
> "
>  virtual test_ptr gettest(CORBA::Double x,
> CORBA::Double y, _CORBA_ObjRef_OUT_a
> rg< _objref_test, test_Helper > ret) = 0;
> "
> while it also defined:
> "
> typedef _CORBA_ObjRef_OUT_arg<_objref_test,test_Helper
> > test_out;
> "
> That is why I used test_out in the implementaion
> class.
> 
> As the situation in my last email,I have one testseq
> *_ptr[10] which contains 10 test object reference and
> I try to use belwo 3 methods to transfer the object
> reference from the _ptr[i] to the _out:
> 1. *_out = *_ptr[i]
> compiler will complain "
> _CORBA_ObjRef_OUT_arg<_objref_test,
> test_Helper>::T_out
>           &_CORBA_ObjRef_OUT_arg<_objref_test,
>           test_Helper>::operator=(const
>           _CORBA_ObjRef_OUT_arg<_objref_test,
>           test_Helper>::T_element &)" is inaccessible.
> 
>                         *_out = *_ptr[i];
>                                     ^
> 
> 2.*_out = *_ptr[i].out();
> It seemed it still can not work(I got the nil object
> reference in the client side)
> 
> 3.*_out = *_ptr.inout().
> It works!
> 
> So I think there should be some problem inside my code
> or omniORB.
> 
> Thanks,
> Shifeng
> 
> Below is last email:
> 
> Hi Shifeng,
> 
>  The _out types look like internal omniORB types
> to me, i do not think, you should use those. Did
> you find these types in the skeleton/stub code, or
> did omniidl generate example code containing these
> types?
> 
> Yours sincerely,
> 
> bjorn
> 
> zhang ji wrote:
> >
> > Hi,
> >
> > Below is one signature of implementation class
> > function:
> >
> > CORBA::Boolean FeatureArray::next(Feature_out
> > featureout)
> >
> > I have one variant like:
> > Feature_ptr featureptr;
> >
> > My questions is how to get the Feature_out from
> > Feature_ptr?
> >
> > "featureout = (Feature_out) featureptr" seemed
> return
> > one nil object reference.
> >
> > Thanks,
> > Shifeng
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Games - play chess, backgammon, pool and more
> http://games.yahoo.com/