Hi Sukender,

I have just completed a first pass review of the meta data
submissions.  I'm still digesting it, and it'll probably take a little
while to get totally comfortable with it.   I'll through out my first
observerations.

The backwards compatibility support for UserData looks like it'll
introduce a memory leak any time UserData is assigned as it'll create
a Value<Referenced*> which holds a C pointer to the Referenced object
passed into UserData.  A Value< osg::ref_ptr<Referenced> > would
probably be more appropriate.

The idea of having a ValueBase class which only provides the
Referenced class and a local clone() seems rather too minimal. Object
has clone functionality built into it and hooks into the OSG's
serializers so I do wonder if one might just be able to use Object as
the base class, it'd mean you could use existing OSG objects as well.
Alternatively perhaps the clone() method could be pushed down into
Referenced.  Perhaps the Value template itself could subclass from
osg::Object rather than Value/Referenced, if the meta data system can
work with just Reference then subclassing from Object would provide
the compatibility needed, and one wouldn't even need to adapt the
UserData type as it would work directly within ValueContainer.

I also wonder if perhaps ValueContainer and ValueContainerMap might
just become oen class ValueMap as I'm not sure how much extra value
you get with making it possible to derive your own ValueContainer for
the top level container assigned to Object's.  I would also be
inclined to make it possible for the ValueContainer/ValueMap to be a
Value in it's own right so that you can create a graph of Value.   If
ValueContainer was subclassed from osg::Object, and it held a map of
osg::Referenced then it would be possible to automatically have such a
graph.

Given that the getDescription() methods in osg::Node can now be
implementated as part of ValueContainer and osg::Object has the
interface for managing the ValueContainer it would be easy to move the
getDescription() methods to sit alongside the getUserData methods in
osg::Object and then we'd have the ability to conviniently add
description strings to osg::StateAttribute/osg::Drawable/osg::StateSet
etc for free.  The only negative to this would be that if are
deprecating getDescription() and getUserData() then we don't really
want to be making them even more widely available.

I do wonder about whether we could skip the clone() method and just be
defult provide a shallow copy - i.e. share the same instance.

I will keep pondering the issue, let me know your reactions to my
rabblings above.

Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to