Improve and simplify code with modern C++ features
Change-Id: I83bf5513c2a1f90ba5a59e93c473306864b27d94
diff --git a/tests/daemon/fw/topology-tester.cpp b/tests/daemon/fw/topology-tester.cpp
index fef3080..41d5d8c 100644
--- a/tests/daemon/fw/topology-tester.cpp
+++ b/tests/daemon/fw/topology-tester.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -24,9 +24,10 @@
*/
#include "topology-tester.hpp"
-#include <ndn-cxx/encoding/encoding-buffer-fwd.hpp>
#include "face/generic-link-service.hpp"
+#include <ndn-cxx/encoding/encoding-buffer-fwd.hpp>
+
namespace nfd {
namespace fw {
namespace tests {
@@ -247,8 +248,8 @@
TopologyTester::addEchoProducer(ndn::Face& face, const Name& prefix)
{
face.setInterestFilter(prefix,
- [&face] (const ndn::InterestFilter&, const Interest& interest) {
- shared_ptr<Data> data = makeData(interest.getName());
+ [&face] (const auto&, const Interest& interest) {
+ auto data = makeData(interest.getName());
face.put(*data);
});
}
@@ -266,12 +267,12 @@
name.appendTimestamp();
}
- shared_ptr<Interest> interest = makeInterest(name);
+ auto interest = makeInterest(name);
face.expressInterest(*interest, nullptr, nullptr, nullptr);
if (n > 1) {
- scheduler::schedule(interval, bind(&TopologyTester::addIntervalConsumer, this,
- ref(face), prefix, interval, n - 1, seq));
+ scheduler::schedule(interval,
+ [=, &face] { addIntervalConsumer(face, prefix, interval, n - 1, seq); });
}
}