On 1/25/2011 1:36 PM, Sam Warns wrote:
Hi,
that is exactly the point. My RemoveXVisitor SHOULD remove nodes but since it is not
possible to do that in apply and there is no "finalize" method that gets
automatically called after accept has finished, it is only possible to remove nodes by
providing a custom member which the user must call manually.
Well, I sort of disagree with that. If you're always going to invoke the visitor
with:
node->accept(visitor);
then you can track the depth internally, and when you get back up to the
top-most node, you can automatically perform your finalize operation. However,
that won't work if you invoke the visitor with:
visitor->traverse(node);
That is what I am talking about, it is not possible for a Visitor to do certain
things without having the user explicitly call members of it after the accept
call.
Right: A visitor "visits".
I did not demand a finalize method and I understand Robert's statement that
flexibility is achieved by relying on the user. Never the less would a finalize
method decrease any flexibility and power of it.
(Btw: I have never experienced that handing over responsibility to the user
(which is the developer at this point) produced any good results, but this is
only my experience)
Some developers prefer tools, other developers prefer canned solutions.
-Paul
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org