Thread: [orbitcpp-list] More questions...
Status: Beta
Brought to you by:
philipd
From: Mike B. <mb...@co...> - 2000-09-15 13:32:10
|
I was noticing in some of your test code that after calling orb->string_to_object() you call obj->_narrow(). If my understanding is correct, this is essentially a cast mechanism. My first question is why is this done in orbitcpp but not in ORBit, is it simply because C++ handles casting differently or is there more to it? Also, the implementation of _narrow() appears to be calling _duplicate(), is it truly allocating a new object and copying as the name suggests, or just doing some refcounting? Also, does one need to call CORBA::release() separately for both the reference returned by string_to_object() as well as the reference returned by _narrow()? -- TTFN MikeB |
From: Phil D. <ph...@us...> - 2000-09-18 09:13:11
|
Hi Mike, Mike Bond writes: > I was noticing in some of your test code that after calling > orb->string_to_object() you call obj->_narrow(). If my understanding > is correct, this is essentially a cast mechanism. > Yep, > My first question is why is this done in orbitcpp but not in ORBit, is > it simply because C++ handles casting differently or is there more to it? Nothing fancy - it's just a difference in the specs. C object refs are typedef'd void ptrs anyway, so you can use them interchangably without the compiler complaining. C++ object refs are statically typechecked by the compiler, and so you need a safe way to do the casts. > Also, the implementation of _narrow() appears to be calling _duplicate(), > is it truly allocating a new object and copying as the name suggests, or > just doing some refcounting? > The duplicate() semantically copies the object *reference*, not the object itself (and CORBA::Object::release() releases the object ref, but doesn't delete the object). Under the hood, reference counting is done by the Orbit C core. > Also, does one need to call CORBA::release() separately for both the > reference returned by string_to_object() as well as the reference > returned by _narrow()? > Yep, because they are 2 seperate refs. (However, if you use _vars, this is done automatically when the ref goes out of scope) Hope this helps, Phil. |
From: Mike B. <mb...@co...> - 2000-09-18 14:15:10
|
On Sun, Sep 17, 2000 at 07:08:24PM +0100, Phil Dawes wrote: > Yep, because they are 2 seperate refs. (However, if you use _vars, > this is done automatically when the ref goes out of scope) Ah! So the basic difference between _ptr and _var is that _var handles the refcounting? I've been using _ptr as _var causes a load of warning messages from gcc-2.96. Also, another question. I've been playing more with orbitcpp and am having a bit of a problem. I tried using oaf with orbitcpp, but liboaf does it's own orb initializion, through oaf_init(), which internally calls CORBA_ORB_init. The problem with this is that CORBA::ORB_init sets ORB_instance, which can't be set outside orbitcpp_orb.cc. This later becomes a problem when you try to call obj->_this(). Also, wouldn't having ORB_instance potentially create threading havoc if someone wanted to have more than one active orb? While at the moment I can't imagine why someone would want to do this, you never know what strange things programmers do. -- TTFN MikeB |
From: Phil D. <ph...@us...> - 2000-09-18 21:10:17
|
Mike Bond writes: > On Sun, Sep 17, 2000 at 07:08:24PM +0100, Phil Dawes wrote: > > Yep, because they are 2 seperate refs. (However, if you use _vars, > > this is done automatically when the ref goes out of scope) > > Ah! So the basic difference between _ptr and _var is that _var handles > the refcounting? I've been using _ptr as _var causes a load of warning > messages from gcc-2.96. > The _var handles the calling of CORBA::release(ref) as the ref goes out of scope. If you are using _ptr then you must do this manually. The _var warning messages are a gcc annoyance. I think I've beaten them now, so they won't be in the 0.29 release. (Hurrah!) > Also, another question. I've been playing more with orbitcpp and am > having a bit of a problem. I tried using oaf with orbitcpp, but > liboaf does it's own orb initializion, through oaf_init(), which > internally calls CORBA_ORB_init. The problem with this is that > CORBA::ORB_init sets ORB_instance, which can't be set outside > orbitcpp_orb.cc. This later becomes a problem when you try to > call obj->_this(). Also, wouldn't having ORB_instance potentially > create threading havoc if someone wanted to have more than one > active orb? While at the moment I can't imagine why someone would > want to do this, you never know what strange things programmers > do. > I completely agree. I've removed the ORB_instance caching stuff (ORBit caches a previously initialised ORB anyway). Cheers, Phil |
From: Mike B. <mb...@co...> - 2000-09-18 23:12:43
|
On Mon, Sep 18, 2000 at 06:00:30PM +0100, Phil Dawes wrote: > I completely agree. I've removed the ORB_instance caching stuff (ORBit > caches a previously initialised ORB anyway). Is the repository at cvs.orbitcpp.sourceforge.net up to date? I'm trying to put a prototype server together by next week sometime and I was hoping to use orbitcpp. -- TTFN MikeB |
From: Phil D. <ph...@us...> - 2000-09-19 10:23:58
|
Should be now. Cheers, Phil Mike Bond writes: > On Mon, Sep 18, 2000 at 06:00:30PM +0100, Phil Dawes wrote: > > I completely agree. I've removed the ORB_instance caching stuff (ORBit > > caches a previously initialised ORB anyway). > > Is the repository at cvs.orbitcpp.sourceforge.net up to date? I'm trying > to put a prototype server together by next week sometime and I was hoping > to use orbitcpp. > > -- > TTFN > MikeB > _______________________________________________ > orbitcpp-list mailing list > orb...@li... > http://lists.sourceforge.net/mailman/listinfo/orbitcpp-list > |