[osg-users] osg::Referenced - reference count notification

Robert Osfield robert.osfield at gmail.com
Thu Jul 17 09:12:45 PDT 2008


Hi Sherman,

There isn't any mechanism for tracking Referenced::ref()/unref()
calls.  One could add a observer/callback mechanism to do this, but
it'd add an extra if() {} block to all ref()/unref() calls which would
be penalize all objects with the overhead, when only a tiny proportion
of OSG users might need to this on a small number of their objects.

For this type of functionality I would normally build a proxy object
mechanism, where the proxy manages access to the objects data.  The
other way would be to manage the compress/uncompress functionality at
a higher level in your app.

Robert.

On Thu, Jul 17, 2008 at 5:01 PM, sherman wilcox
<wilcox.sherman at gmail.com> wrote:
> I have a class that derives from osg::Referenced. This class contains
> a pointer to a block of compressed data. What I'd like to do is
> "automatically" decompress the block of data when the reference count
> exceeds a threshold (in this case anything higher than 1). Also, when
> the reference count is <= a given threshold (again, anything <= 1) I'd
> like this class to compress the data. What I'm not seeing is any way
> to hook into the reference counting system to receive notifications
> when the count changes. I see that there is a mechanism to notify
> "observers" when the object is delete, but this isn't quite what I'm
> after. Suggestions?
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



More information about the osg-users mailing list