Martin Beckett wrote on Friday, September 04, 2009 5:20 PM:

> Hi,
> I have a class derived from PositionAttitudeTransform. It's simply an
Adapter
> it contains no new variables but fixes up some methods for osg::PAT to
be
> used in an existing design for some navigation routines.  
> 
> The existing navigation library is fixed I can't change it to
understand
> osg::ref_ptr,=. Objects of the Adapter class need to be created on the
stack
> in the library.  
> 
> Is there any way to define such a class so that it can be used as a
regular
> class with objects on the stack in my library but still be reference
counted
> in OSG?  

It's really not a good idea to mix stack-created objects with reference
counting (when the reference count hits zero and the stack-created
object is deleted, bad things happen), but if you're *REALLY SURE* that
you can be careful about it, *still don't do it*, because eventually
someone else will modify your code (it might even be a future you) who
won't be as careful.

HTH :)
-- 
Bryan Thrall
FlightSafety International
bryan.thr...@flightsafety.com

P.S. You must be *REALLY REALLY SURE* to read this far, and if you are,
I'll tell you the secret: all you have to do is declare a public
destructor for your Adapter class to allow it to be created on the
stack. See http://visualcpp.net/index.php?qID=65 for example.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to