void NxsTreesBlock::setValidationCallbacks ( ProcessedTreeValidationFunction  func,
void *  blob 
) [inline]

This function allows you to register a callback function that is called after each tree is parsed.

The signature of your function should be:

                bool someFunctionName(NxsFullTreeDescription &treeDesc, void * blob, NxsTreesBlock * treesB);

where:

  • treeDesc is the NxsFullTreeDescription for the tree that was just read.
  • blob is pointer to any object or 0L. You supply this blob of data as an argument in setValidationCallbacks and the NxsTreesBlock passes it every time that it calls the callback. By passing in your own object, you can do bookkeeping between calls without using global variables (though you will have to cast the pointer to the blob of data, of course).
  • treesB is a pointer to the block that is conducting the parse.

If your function returns false, then the trees block will not store. If your callback function returns true, then the tree will be stored. In either case the NxsTreesBlock will continue parsing after your function returns.

This Callback hook is convenient for rejecting unwanted trees to save on memory, but it can also be used as an optimization.

See the example executable in example/splitsinfile. This NCL client, uses this callback to store the splits from a trees as the TREES block is being parsed. It returns false in each case, so that the trees are not stored after they are used.

Parameters:
func your pointer to your callback function
blob pointer to any object that you would like to access during parse

Definition at line 791 of file nxstreesblock.h.

 All Classes Functions Variables Enumerations Enumerator Friends
Generated on Mon Mar 29 16:37:13 2010 for NCL by  doxygen 1.6.3