Hi,
On Thursday 25 January 2007 09:01, Ignacio García wrote:
> I have been thinking the same, using ref_ptr in non-OSG code, with the same
> drawbacks you are seeing. You say that ref_ptr depends on OpenThreads, and
> Producer has a Producer::ref_ptr similar or equal to osg::ref_ptr.
>
> After all this, what about moving osg::Referenced, osg::ref_ptr and
> osg::observer_ptr to OpenThreads? It wouldn't add an additional library to
> OSG, Producer could reuse OpenThreads::ref_ptr instead of declaring its
> own, and user code could use ref_ptr's just linking OpenThreads lib (what
> must be done if you want to use ref_ptr).
>
> The main drawback is that I suppose it requires a lot of changes in OSG to
> use OpenThreads::ref_ptr instead of ref_ptr (in the OSG namespace).
>
> Thoughts?
Just my 2 cents:
Implementing reference counting is *not* a compicated task.
Also, there are many variants of implementing refcounts that fit different
needs. I for myself would never accept having a virtual table for some
applications of refcounting where for other applications of refcounting
having a virtual destructor is desired.
There is also an other interresting concept of weak pointers in the boost
implementation (and probably the upcomming stdc++ standard) that I would miss
here and that I would favour over the observer in *some* cases ...
IMO: If you need refcounting, think about your needs and implement that
variant that you need ...
Greetings
Mathias
--
Dr. Mathias Fröhlich, science + computing ag, Software Solutions
Hagellocher Weg 71-75, D-72070 Tuebingen, Germany
Phone: +49 7071 9457-268, Fax: +49 7071 9457-511
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/