class CountConsVisitor:public visitor { private: long intCount, realCount, stringCount, complexCount, ptrmemCount; public: //! The initialization operation void initialize (void) { intCount = 0; realCount = 0; stringCount = 0; complexCount = 0; ptrmemCount = 0; } //************************************ // Used to visit constant nodes //************************************ void visit_integer_TreeConst (integer_TreeConst * tnp) { intCount++; } void visit_real_TreeConst (real_TreeConst * tnp) { realCount++; } void visit_string_TreeConst (string_TreeConst * tnp) { stringCount++; } void visit_complex_TreeConst (complex_TreeConst * tnp) { complexCount++; } void visit_ptrmem_TreeConst (ptrmem_TreeConst * tnp) { ptrmemCount++; } }; int main (int argC, char *argV[]) { XAstReader *reader = new XAstReader; list < TreeNode * >*TreeNodeList; TreeNodeList = reader->readlist (GxlInputFile); list < TreeNode * >::iterator TNLIter; CountConsVisitor counter; counter.initialize (); // Visit one node for time for (TNLIter = TreeNodeList->begin (); TNLIter != TreeNodeList->end (); TNLIter++) { (*TNLIter).accept (counter); } return EXIT_SUCCESS; }