I am having trouble with a program for my Computer Science class. We are supposed to make a binary tree that supports program profiling.. My professor provided some code but here are the 3 functions that I cannot figure out. I don't really understand trees or the concept of profiling so can someone help me with this?
/////////////////////////////////////////////////////////////////////
// Adds in the report to the main.
// Assumes only one return at end of main body.
//
void ASTree::mainReport(std::vector<std::string>& profileNames) {
//NEED TO IMPLEMENT
//Find the main - function with name of "main"
//Then start from the end() of this function and iterate
// backwards until you find a return stmt. You'll want
// to insert the report statements before this return.
// You can assume there is only one return for the main.
}
/////////////////////////////////////////////////////////////////////
// Adds in a line to count the number of times each function is executed.
// Assumes no nested functions.
//
void ASTree::funcCount(const std::string& profileNames) {
//NEED TO IMPLEMENT
// Check for function, constructor, destructor.
// Find the function name and insert the count.
}
/////////////////////////////////////////////////////////////////////
// Adds in a line to count the number of times each statement is executed.
// No breaks, returns, throw etc.
// Assumes all construts (for, while, if) have { }.
//
void ASTree::lineCount(const std::string& profileNames) {
//NEED TO IMPLEMENT
// Check for expr_stmt and call, insert a count.
}