[gme-users] BON Visitor Question

Zoltan Molnar zolmol at isis.vanderbilt.edu
Mon Nov 20 16:18:29 CST 2006

The default implementation of accept is Depth-First: 
 void ModelImpl::accept( Visitor* pVisitor )
  FCOSet children = getChildFCOsI();
  for ( FCOSet::iterator it = children.begin() ; it != children.end() ;
it++ )
   (*it)->accept( pVisitor );
  pVisitor->visitModel( Model( this ) );

Children are visited first, then parent.
If you'd like another way of traversal: you can override accept.
(I have heard opinions that making assumptions about the traversal order
is superfluous or bad, however your custom visitor could be speeded up
by introducing some order. )

-----Original Message-----
From: gme-users-bounces at list.isis.vanderbilt.edu
[mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf Of Joe
Sent: Monday, November 20, 2006 4:03 PM
To: gme-users
Subject: [gme-users] BON Visitor Question

In BON2, when I implement a Visitor class and pass it to a model, can I
make any assumptions about the order of traversal of the sub-parts (i.e.
depth-first vs. breadth-first), or is it generally a bad idea to make
any assumptions about that interface? 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20061120/fdcc4cfd/attachment.htm

More information about the gme-users mailing list