Eradicate all uses of std::bind()
Change-Id: I6e1ccf2d87b76142e6d519c1a288d03022e4d167
diff --git a/tools/ping/client/tracer.cpp b/tools/ping/client/tracer.cpp
index 9510af8..7db5085 100644
--- a/tools/ping/client/tracer.cpp
+++ b/tools/ping/client/tracer.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2015-2016, Arizona Board of Regents.
+/*
+ * Copyright (c) 2015-2021, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -16,8 +16,8 @@
* You should have received a copy of the GNU General Public License along with
* ndn-tools, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*
- * @author: Eric Newberry <enewberry@email.arizona.edu>
- * @author: Teng Liang <philoliang@email.arizona.edu>
+ * @author Eric Newberry <enewberry@email.arizona.edu>
+ * @author Teng Liang <philoliang@email.arizona.edu>
*/
#include "tracer.hpp"
@@ -29,9 +29,9 @@
Tracer::Tracer(Ping& ping, const Options& options)
: m_options(options)
{
- ping.afterData.connect(bind(&Tracer::onData, this, _1, _2));
- ping.afterNack.connect(bind(&Tracer::onNack, this, _1, _2, _3));
- ping.afterTimeout.connect(bind(&Tracer::onTimeout, this, _1));
+ ping.afterData.connect(FORWARD_TO_MEM_FN(onData));
+ ping.afterNack.connect(FORWARD_TO_MEM_FN(onNack));
+ ping.afterTimeout.connect(FORWARD_TO_MEM_FN(onTimeout));
}
void
@@ -42,7 +42,7 @@
}
std::cout << "content from " << m_options.prefix << ": seq=" << seq << " time="
- << rtt.count() << " ms" << std::endl;
+ << rtt.count() << " ms\n";
}
void
@@ -53,7 +53,7 @@
}
std::cout << "nack from " << m_options.prefix << ": seq=" << seq << " time="
- << rtt.count() << " ms" << " reason=" << header.getReason() << std::endl;
+ << rtt.count() << " ms" << " reason=" << header.getReason() << "\n";
}
void
@@ -63,13 +63,13 @@
std::cout << time::toIsoString(time::system_clock::now()) << " - ";
}
- std::cout << "timeout from " << m_options.prefix << ": seq=" << seq << std::endl;
+ std::cout << "timeout from " << m_options.prefix << ": seq=" << seq << "\n";
}
void
-Tracer::onError(std::string msg)
+Tracer::onError(const std::string& msg)
{
- std::cerr << "ERROR: " << msg << std::endl;
+ std::cerr << "ERROR: " << msg << "\n";
}
} // namespace client