+
+ // Sort the fields by name.
+ std::stable_sort(Stats.begin(), Stats.end(), NameCompare());
+
+ // Print out the statistics header...
+ OutStream << "===" << std::string(73, '-') << "===\n"
+ << " ... Statistics Collected ...\n"
+ << "===" << std::string(73, '-') << "===\n\n";
+
+ // Print all of the statistics.
+ for (size_t i = 0, e = Stats.size(); i != e; ++i) {
+ std::string CountStr = utostr(Stats[i]->getValue());
+ OutStream << std::string(MaxValLen-CountStr.size(), ' ')
+ << CountStr << " " << Stats[i]->getName()
+ << std::string(MaxNameLen-std::strlen(Stats[i]->getName()), ' ')
+ << " - " << Stats[i]->getDesc() << "\n";
+
+ }
+
+ OutStream << std::endl; // Flush the output stream...
+
+ if (&OutStream != cerr.stream() && &OutStream != cout.stream())
+ delete &OutStream; // Close the file.