ping: use a member function rather than `operator<<` for stats

Change-Id: I8e2d469d80d9b5d5e82d14e9f3039a464a7eeae5
diff --git a/tools/ping/client/statistics-collector.cpp b/tools/ping/client/statistics-collector.cpp
index cc8842c..dcb8ae9 100644
--- a/tools/ping/client/statistics-collector.cpp
+++ b/tools/ping/client/statistics-collector.cpp
@@ -100,7 +100,7 @@
   return statistics;
 }
 
-std::ostream&
+void
 Statistics::printSummary(std::ostream& os) const
 {
   os << nReceived << "/" << nSent << " packets";
@@ -110,39 +110,33 @@
   }
 
   if (nReceived > 0) {
-    os << ", min/avg/max/mdev = " << minRtt << "/" << avgRtt << "/" << maxRtt << "/" << stdDevRtt
-       << " ms";
+    os << ", min/avg/max/mdev = " << minRtt << "/" << avgRtt << "/" << maxRtt
+       << "/" << stdDevRtt << " ms";
   }
 
-  return os << "\n";
+  os << "\n";
 }
 
-std::ostream&
-operator<<(std::ostream& os, const Statistics& statistics)
+void
+Statistics::printFull(std::ostream& os) const
 {
+  os << "\n--- " << prefix << " ping statistics ---\n"
+     << nSent << " packets transmitted"
+     << ", " << nReceived << " received"
+     << ", " << nNacked << " nacked";
+
+  if (nSent > 0) {
+    os << ", " << packetLossRate * 100.0 << "% lost, " << packetNackedRate * 100.0 << "% nacked";
+  }
+
+  os << ", time " << sumRtt << " ms";
+
+  if (nReceived > 0) {
+    os << "\nrtt min/avg/max/mdev = " << minRtt << "/" << avgRtt << "/" << maxRtt
+       << "/" << stdDevRtt << " ms";
+  }
+
   os << "\n";
-  os << "--- " << statistics.prefix << " ping statistics ---\n";
-  os << statistics.nSent << " packets transmitted";
-  os << ", " << statistics.nReceived << " received";
-  os << ", " << statistics.nNacked << " nacked";
-
-  if (statistics.nSent > 0) {
-    os << ", " << statistics.packetLossRate * 100.0 << "% lost";
-    os << ", " << statistics.packetNackedRate * 100.0 << "% nacked";
-  }
-
-  os << ", time " << statistics.sumRtt << " ms";
-
-  if (statistics.nReceived > 0) {
-    os << "\n";
-    os << "rtt min/avg/max/mdev = ";
-    os << statistics.minRtt << "/";
-    os << statistics.avgRtt << "/";
-    os << statistics.maxRtt << "/";
-    os << statistics.stdDevRtt << " ms";
-  }
-
-  return os;
 }
 
 } // namespace ndn::ping::client