Hi Sebastian,

On 5/03/12 20:01 , Sebastian Messerschmidt wrote:
> Now, in order to cache the nodes correctly I've put a reference to the node 
> in to a map
> (std::map<std::string, osg::ref_ptr<Node>>). I need to use the ref_ptr to be 
> sure the node
> is still valid.
> It works well, up to the point where the DataBasePager removes expired 
> PagedLODs, as I
> don't found any way to set a callback to the DataBasePager that tells me, 
> which node is
> going to be removed.

If you only need to detect that nodes have been expired by the DatabasePager 
(and not
necessarily the exact moment) you could use an observer_ptr in your map rather 
than a ref_ptr.

But you would need to 'lock()' every access and run a map cleanup periodically 
to remove
stale nodes.  Still, depending on your needs it might be cleaner than to 
subclass DBP.

Cheers,
/ulrich
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to