| 
             
  | 
             
  | 
             
  | |||
| 
             
  | 
             
  | 
             
  | |||
| 
             
  | 
            
  | ||||
| 
             
  | |||||
| 
                     
 #include "pf.h"          // Required for the standard Performer classes 
 
 void getpfNodeCountsInSubtree( pfNode *node ) { // ######################################################## // # // # Public Function // # // # Example funcion to show how to get the number of // # of different pfNode types // # // ######################################################## 
 // // Sanity check we need an node // if( node == NULL ) return; 
 int numNodes = 0; numNodes = getNumberPfNodeTypes( node, pfGetNodeClassType(), numNodes ); 
 int numGeodes = 0; numGeodes = getNumberPfNodeTypes( node, pfGetGeodeClassType(), numGeodes ); 
 int numGroups = 0; numGroups = getNumberPfNodeTypes( node, pfGetGroupClassType(), numGroups ); 
 int numDCS = 0; numDCS = getNumberPfNodeTypes( node, pfGetDCSClassType(), numDCS ); 
 int numSCS = 0; numSCS = getNumberPfNodeTypes( node, pfGetSCSClassType(), numSCS ); 
 int numSeq = 0; numSeq = getNumberPfNodeTypes( node, pfGetSeqClassType(), numSeq ); 
 int numLods = 0; numLods = getNumberPfNodeTypes( node, pfGetLODClassType(), numLods ); 
 int numBboard = 0; numBboard = getNumberPfNodeTypes( node, pfGetBboardClassType(), numBboard ); 
 
 } // getpfNodeCountsInSubtree 
 int getNumberPfNodeTypes( pfNode *node, pfType *nodeType, int nodeTotal ) { // ################################################################## // # // # Public Function // # // # A simple Recursive function that will traverse the given // # nodes tree and count all the pfNodeTypes requested // # // # Note this does not supported pfGeoSet see specic example // # counting pfGeoSets // # // ################################################################## 
 
 // // Sanity check we need a Node // if( node == NULL ) return nodeTotal; 
 // // // if( pfIsOfType( node, nodeType )) { nodeTotal++; } 
 // // Cycle through the children for this node // int numChildren = 0; 
 
 // // Need to catch pfGeodes as they have no children and // will cause a crash if pfGetNumChildren is called // if( !pfIsOfType( node, pfGetGeodeClassType()) ) numChildren = pfGetNumChildren ( node ); 
 
 for ( int idx = 0; idx < numChildren; idx++ ) { 
 // // Get the child node and recurse in to them // pfNode* childNode = pfGetChild( node, idx ); 
 nodeTotal = getNumberPfNodeTypes( childNode,nodeType, nodeTotal ); 
 } } 
 return nodeTotal; 
 } // getNumberPfNodeType 
 
 
  | ||
| 
              
 
 © Copyright 2004 Gordon Tomlinson All Rights Reserved. All logos, trademarks and copyrights in this site are property of their respective owner.  | ||