Hi Rui, Thanks for the changes, I feel happier with this approach as it's more conventional w.r.t usage of local proxy object for scoping purposes. I made one small change though, I removed the usage of osg::Referenced and the use of new + ref_ptr<>, instead changed the code to create the proxy object on the stack rather than the heap. Heap allocation and cleanup is slower than allocation and cleanup on the stack so is preferable.
Changes now merged and submitted to svn/trunk. Robert. On 9 October 2012 14:11, Wang Rui <[email protected]> wrote: > Hi Robert, > > I modified the Serializer header to add a UPDATE_TO_VERSION_SCOPED > macro, which could set version within brackets and reset it after > that. All related serializers are also modified so that the > backward-compatibility bug reported by Farshid can be fixed. > > Cheers, > > Wang Rui > > 2012/10/9 Robert Osfield <[email protected]>: >> Hi Rui, >> >> I understand the motivation - to scope the change to the version >> number, but don't feel it's an appropriate way to do it as it's not >> immediately obvious how the macro works/how it's supposed to be used. >> Instead I think it would be better to use C++ in more conventional way >> w.r.t scoping and move version setting to within the block and use a >> local proxy object, so have it thus: >> >> ADD_USER_SERIALIZER( Descriptions ) >> >> { >> UPDATE_TO_VERSION( 77 ) >> REMOVE_SERIALIZER( Descriptions ) >> } >> >> ADD_OBJECT_SERIALIZER( StateSet, osg::StateSet, NULL ) >> >> Perhaps having a new macro named a bit a proxy such as >> LOCAL_UPDATE_TO_VERSION(77), or perhaps have a >> PUSH_UPDATE_TO_VERSION(77) and corresponding POP_UPDATE_TO_VERSION() >> would be appropriate to help clarify it's usage. >> >> Robert. >> > > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org > _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
