build: switch to C++17
Change-Id: Id6217b5c993f3e4726e89773128b565e5f136bb6
diff --git a/tools/chunks/catchunks/consumer.cpp b/tools/chunks/catchunks/consumer.cpp
index ac83227..a1c2edf 100644
--- a/tools/chunks/catchunks/consumer.cpp
+++ b/tools/chunks/catchunks/consumer.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2021, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -27,8 +27,7 @@
#include "consumer.hpp"
-namespace ndn {
-namespace chunks {
+namespace ndn::chunks {
Consumer::Consumer(security::Validator& validator, std::ostream& os)
: m_validator(validator)
@@ -86,5 +85,4 @@
}
}
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
diff --git a/tools/chunks/catchunks/consumer.hpp b/tools/chunks/catchunks/consumer.hpp
index a2151a9..8423ace 100644
--- a/tools/chunks/catchunks/consumer.hpp
+++ b/tools/chunks/catchunks/consumer.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2021, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -36,8 +36,7 @@
#include <map>
-namespace ndn {
-namespace chunks {
+namespace ndn::chunks {
/**
* @brief Segmented version consumer
@@ -100,7 +99,6 @@
std::map<uint64_t, shared_ptr<const Data>> m_bufferedData;
};
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
#endif // NDN_TOOLS_CHUNKS_CATCHUNKS_CONSUMER_HPP
diff --git a/tools/chunks/catchunks/data-fetcher.cpp b/tools/chunks/catchunks/data-fetcher.cpp
index baed34f..2e5fc9e 100644
--- a/tools/chunks/catchunks/data-fetcher.cpp
+++ b/tools/chunks/catchunks/data-fetcher.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2021, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -28,11 +28,7 @@
#include <cmath>
-namespace ndn {
-namespace chunks {
-
-const int DataFetcher::MAX_RETRIES_INFINITE = -1;
-const time::milliseconds DataFetcher::MAX_CONGESTION_BACKOFF_TIME = time::seconds(10);
+namespace ndn::chunks {
shared_ptr<DataFetcher>
DataFetcher::fetch(Face& face, const Interest& interest, int maxNackRetries, int maxTimeoutRetries,
@@ -60,12 +56,7 @@
, m_onTimeout(std::move(onTimeout))
, m_maxNackRetries(maxNackRetries)
, m_maxTimeoutRetries(maxTimeoutRetries)
- , m_nNacks(0)
- , m_nTimeouts(0)
- , m_nCongestionRetries(0)
, m_isVerbose(isVerbose)
- , m_isStopped(false)
- , m_hasError(false)
{
BOOST_ASSERT(m_onData != nullptr);
}
@@ -177,5 +168,4 @@
}
}
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
diff --git a/tools/chunks/catchunks/data-fetcher.hpp b/tools/chunks/catchunks/data-fetcher.hpp
index 53e32c0..c51d577 100644
--- a/tools/chunks/catchunks/data-fetcher.hpp
+++ b/tools/chunks/catchunks/data-fetcher.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2019, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -29,11 +29,10 @@
#include "core/common.hpp"
-namespace ndn {
-namespace chunks {
+namespace ndn::chunks {
/**
- * @brief fetch data for a given interest and handle timeout or nack error with retries
+ * @brief Fetch data for a given interest and handle timeout or nack error with retries.
*
* To instantiate a DataFetcher you need to use the static method fetch, this will also express the
* interest. After a timeout or nack is received, the same interest with a different nonce will be
@@ -53,12 +52,12 @@
* @brief means that there is no maximum number of retries,
* i.e. fetching must be retried indefinitely
*/
- static const int MAX_RETRIES_INFINITE;
+ static constexpr int MAX_RETRIES_INFINITE = -1;
/**
* @brief ceiling value for backoff time used in congestion handling
*/
- static const time::milliseconds MAX_CONGESTION_BACKOFF_TIME;
+ static constexpr time::milliseconds MAX_CONGESTION_BACKOFF_TIME = 10_s;
using FailureCallback = std::function<void(const Interest& interest, const std::string& reason)>;
@@ -117,16 +116,15 @@
int m_maxNackRetries;
int m_maxTimeoutRetries;
- int m_nNacks;
- int m_nTimeouts;
- uint32_t m_nCongestionRetries;
+ int m_nNacks = 0;
+ int m_nTimeouts = 0;
+ uint32_t m_nCongestionRetries = 0;
- bool m_isVerbose;
- bool m_isStopped;
- bool m_hasError;
+ bool m_isVerbose = false;
+ bool m_isStopped = false;
+ bool m_hasError = false;
};
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
#endif // NDN_TOOLS_CHUNKS_CATCHUNKS_DATA_FETCHER_HPP
diff --git a/tools/chunks/catchunks/discover-version.cpp b/tools/chunks/catchunks/discover-version.cpp
index e35fc21..5eae250 100644
--- a/tools/chunks/catchunks/discover-version.cpp
+++ b/tools/chunks/catchunks/discover-version.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2021, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -31,8 +31,7 @@
#include <ndn-cxx/metadata-object.hpp>
-namespace ndn {
-namespace chunks {
+namespace ndn::chunks {
DiscoverVersion::DiscoverVersion(Face& face, const Name& prefix, const Options& options)
: m_face(face)
@@ -93,5 +92,4 @@
onDiscoverySuccess(mobject.getVersionedName());
}
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
diff --git a/tools/chunks/catchunks/discover-version.hpp b/tools/chunks/catchunks/discover-version.hpp
index 62a5e42..6a05727 100644
--- a/tools/chunks/catchunks/discover-version.hpp
+++ b/tools/chunks/catchunks/discover-version.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2021, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -33,8 +33,7 @@
#include <ndn-cxx/util/signal.hpp>
-namespace ndn {
-namespace chunks {
+namespace ndn::chunks {
class DataFetcher;
@@ -73,7 +72,6 @@
shared_ptr<DataFetcher> m_fetcher;
};
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
#endif // NDN_TOOLS_CHUNKS_CATCHUNKS_DISCOVER_VERSION_HPP
diff --git a/tools/chunks/catchunks/main.cpp b/tools/chunks/catchunks/main.cpp
index 59ea8d8..e89d904 100644
--- a/tools/chunks/catchunks/main.cpp
+++ b/tools/chunks/catchunks/main.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2021, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -45,8 +45,7 @@
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
-namespace ndn {
-namespace chunks {
+namespace ndn::chunks {
namespace po = boost::program_options;
@@ -309,8 +308,7 @@
return 0;
}
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
int
main(int argc, char* argv[])
diff --git a/tools/chunks/catchunks/options.hpp b/tools/chunks/catchunks/options.hpp
index fbca964..c93e9c2 100644
--- a/tools/chunks/catchunks/options.hpp
+++ b/tools/chunks/catchunks/options.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2019, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -29,8 +29,7 @@
#include "core/common.hpp"
-namespace ndn {
-namespace chunks {
+namespace ndn::chunks {
struct Options : noncopyable
{
@@ -62,7 +61,6 @@
bool enableFastConv = false; ///< use cubic fast convergence
};
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
#endif // NDN_TOOLS_CHUNKS_CATCHUNKS_OPTIONS_HPP
diff --git a/tools/chunks/catchunks/pipeline-interests-adaptive.cpp b/tools/chunks/catchunks/pipeline-interests-adaptive.cpp
index 595dcdc..3b3e0cd 100644
--- a/tools/chunks/catchunks/pipeline-interests-adaptive.cpp
+++ b/tools/chunks/catchunks/pipeline-interests-adaptive.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2021, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -32,8 +32,7 @@
#include <cmath>
#include <iomanip>
-namespace ndn {
-namespace chunks {
+namespace ndn::chunks {
constexpr double PipelineInterestsAdaptive::MIN_SSTHRESH;
@@ -45,19 +44,6 @@
, m_ssthresh(m_options.initSsthresh)
, m_rttEstimator(rttEstimator)
, m_scheduler(m_face.getIoService())
- , m_highData(0)
- , m_highInterest(0)
- , m_recPoint(0)
- , m_nInFlight(0)
- , m_nLossDecr(0)
- , m_nMarkDecr(0)
- , m_nTimeouts(0)
- , m_nSkippedRetx(0)
- , m_nRetransmitted(0)
- , m_nCongMarks(0)
- , m_nSent(0)
- , m_hasFailure(false)
- , m_failedSegNo(0)
{
}
@@ -139,7 +125,7 @@
if (isRetransmission) {
// keep track of retx count for this segment
auto ret = m_retxCount.emplace(segNo, 1);
- if (ret.second == false) { // not the first retransmission
+ if (!ret.second) { // not the first retransmission
m_retxCount[segNo] += 1;
if (m_options.maxRetriesOnTimeoutOrNack != DataFetcher::MAX_RETRIES_INFINITE &&
m_retxCount[segNo] > m_options.maxRetriesOnTimeoutOrNack) {
@@ -157,7 +143,6 @@
auto interest = Interest()
.setName(Name(m_prefix).appendSegment(segNo))
- .setCanBePrefix(false)
.setMustBeFresh(m_options.mustBeFresh)
.setInterestLifetime(m_options.interestLifetime);
@@ -471,5 +456,4 @@
return os;
}
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
diff --git a/tools/chunks/catchunks/pipeline-interests-adaptive.hpp b/tools/chunks/catchunks/pipeline-interests-adaptive.hpp
index 596c70e..15e4dcf 100644
--- a/tools/chunks/catchunks/pipeline-interests-adaptive.hpp
+++ b/tools/chunks/catchunks/pipeline-interests-adaptive.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2021, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -37,8 +37,7 @@
#include <queue>
#include <unordered_map>
-namespace ndn {
-namespace chunks {
+namespace ndn::chunks {
using util::RttEstimatorWithStats;
@@ -199,20 +198,20 @@
Scheduler m_scheduler;
scheduler::ScopedEventId m_checkRtoEvent;
- uint64_t m_highData; ///< the highest segment number of the Data packet the consumer has received so far
- uint64_t m_highInterest; ///< the highest segment number of the Interests the consumer has sent so far
- uint64_t m_recPoint; ///< the value of m_highInterest when a packet loss event occurred,
- ///< it remains fixed until the next packet loss event happens
+ uint64_t m_highData = 0; ///< the highest segment number of the Data packet the consumer has received so far
+ uint64_t m_highInterest = 0; ///< the highest segment number of the Interests the consumer has sent so far
+ uint64_t m_recPoint = 0; ///< the value of m_highInterest when a packet loss event occurred,
+ ///< it remains fixed until the next packet loss event happens
- int64_t m_nInFlight; ///< # of segments in flight
- int64_t m_nLossDecr; ///< # of window decreases caused by packet loss
- int64_t m_nMarkDecr; ///< # of window decreases caused by congestion marks
- int64_t m_nTimeouts; ///< # of timed out segments
- int64_t m_nSkippedRetx; ///< # of segments queued for retransmission but received before the
- ///< retransmission occurred
- int64_t m_nRetransmitted; ///< # of retransmitted segments
- int64_t m_nCongMarks; ///< # of data packets with congestion mark
- int64_t m_nSent; ///< # of interest packets sent out (including retransmissions)
+ int64_t m_nInFlight = 0; ///< # of segments in flight
+ int64_t m_nLossDecr = 0; ///< # of window decreases caused by packet loss
+ int64_t m_nMarkDecr = 0; ///< # of window decreases caused by congestion marks
+ int64_t m_nTimeouts = 0; ///< # of timed out segments
+ int64_t m_nSkippedRetx = 0; ///< # of segments queued for retransmission but received before the
+ ///< retransmission occurred
+ int64_t m_nRetransmitted = 0; ///< # of retransmitted segments
+ int64_t m_nCongMarks = 0; ///< # of data packets with congestion mark
+ int64_t m_nSent = 0; ///< # of interest packets sent out (including retransmissions)
std::unordered_map<uint64_t, SegmentInfo> m_segmentInfo; ///< keeps all the internal information
///< on sent but not acked segments
@@ -221,12 +220,11 @@
///< timeout/nack retries, the pipeline will be aborted
std::queue<uint64_t> m_retxQueue;
- bool m_hasFailure;
- uint64_t m_failedSegNo;
+ bool m_hasFailure = false;
+ uint64_t m_failedSegNo = 0;
std::string m_failureReason;
};
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
#endif // NDN_TOOLS_CHUNKS_CATCHUNKS_PIPELINE_INTERESTS_ADAPTIVE_HPP
diff --git a/tools/chunks/catchunks/pipeline-interests-aimd.cpp b/tools/chunks/catchunks/pipeline-interests-aimd.cpp
index 667bd9e..4d84fdd 100644
--- a/tools/chunks/catchunks/pipeline-interests-aimd.cpp
+++ b/tools/chunks/catchunks/pipeline-interests-aimd.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2019, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -30,8 +30,7 @@
#include <cmath>
-namespace ndn {
-namespace chunks {
+namespace ndn::chunks {
PipelineInterestsAimd::PipelineInterestsAimd(Face& face, RttEstimatorWithStats& rttEstimator,
const Options& opts)
@@ -65,5 +64,4 @@
emitSignal(afterCwndChange, time::steady_clock::now() - getStartTime(), m_cwnd);
}
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
diff --git a/tools/chunks/catchunks/pipeline-interests-aimd.hpp b/tools/chunks/catchunks/pipeline-interests-aimd.hpp
index f76163e..1792f95 100644
--- a/tools/chunks/catchunks/pipeline-interests-aimd.hpp
+++ b/tools/chunks/catchunks/pipeline-interests-aimd.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2019, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -31,8 +31,7 @@
#include "pipeline-interests-adaptive.hpp"
-namespace ndn {
-namespace chunks {
+namespace ndn::chunks {
/**
* @brief Implements AIMD window increase and decrease.
@@ -50,7 +49,6 @@
decreaseWindow() final;
};
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
#endif // NDN_TOOLS_CHUNKS_CATCHUNKS_PIPELINE_INTERESTS_AIMD_HPP
diff --git a/tools/chunks/catchunks/pipeline-interests-cubic.cpp b/tools/chunks/catchunks/pipeline-interests-cubic.cpp
index 74aab0c..5eaf411 100644
--- a/tools/chunks/catchunks/pipeline-interests-cubic.cpp
+++ b/tools/chunks/catchunks/pipeline-interests-cubic.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2019, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -27,8 +27,7 @@
#include <cmath>
-namespace ndn {
-namespace chunks {
+namespace ndn::chunks {
constexpr double CUBIC_C = 0.4;
@@ -111,5 +110,4 @@
emitSignal(afterCwndChange, time::steady_clock::now() - getStartTime(), m_cwnd);
}
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
diff --git a/tools/chunks/catchunks/pipeline-interests-cubic.hpp b/tools/chunks/catchunks/pipeline-interests-cubic.hpp
index daa59eb..87b4824 100644
--- a/tools/chunks/catchunks/pipeline-interests-cubic.hpp
+++ b/tools/chunks/catchunks/pipeline-interests-cubic.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2021, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -28,8 +28,7 @@
#include "pipeline-interests-adaptive.hpp"
-namespace ndn {
-namespace chunks {
+namespace ndn::chunks {
/**
* @brief Implements Cubic window increase and decrease.
@@ -55,7 +54,6 @@
time::steady_clock::time_point m_lastDecrease; ///< time of last window decrease
};
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
#endif // NDN_TOOLS_CHUNKS_CATCHUNKS_PIPELINE_INTERESTS_CUBIC_HPP
diff --git a/tools/chunks/catchunks/pipeline-interests-fixed.cpp b/tools/chunks/catchunks/pipeline-interests-fixed.cpp
index 7fab8e3..a80ca5e 100644
--- a/tools/chunks/catchunks/pipeline-interests-fixed.cpp
+++ b/tools/chunks/catchunks/pipeline-interests-fixed.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2021, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -30,8 +30,7 @@
#include "pipeline-interests-fixed.hpp"
#include "data-fetcher.hpp"
-namespace ndn {
-namespace chunks {
+namespace ndn::chunks {
PipelineInterestsFixed::PipelineInterestsFixed(Face& face, const Options& opts)
: PipelineInterests(face, opts)
@@ -83,7 +82,6 @@
auto interest = Interest()
.setName(Name(m_prefix).appendSegment(nextSegmentNo))
- .setCanBePrefix(false)
.setMustBeFresh(m_options.mustBeFresh)
.setInterestLifetime(m_options.interestLifetime);
@@ -194,5 +192,4 @@
}
}
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
diff --git a/tools/chunks/catchunks/pipeline-interests-fixed.hpp b/tools/chunks/catchunks/pipeline-interests-fixed.hpp
index b21575e..a317ad2 100644
--- a/tools/chunks/catchunks/pipeline-interests-fixed.hpp
+++ b/tools/chunks/catchunks/pipeline-interests-fixed.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2019, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -32,8 +32,7 @@
#include "pipeline-interests.hpp"
-namespace ndn {
-namespace chunks {
+namespace ndn::chunks {
class DataFetcher;
@@ -91,7 +90,6 @@
bool m_hasFailure = false;
};
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
#endif // NDN_TOOLS_CHUNKS_CATCHUNKS_PIPELINE_INTERESTS_FIXED_HPP
diff --git a/tools/chunks/catchunks/pipeline-interests.cpp b/tools/chunks/catchunks/pipeline-interests.cpp
index 9f2e3b5..218df28 100644
--- a/tools/chunks/catchunks/pipeline-interests.cpp
+++ b/tools/chunks/catchunks/pipeline-interests.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2021, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -33,18 +33,11 @@
#include <boost/asio/io_service.hpp>
-namespace ndn {
-namespace chunks {
+namespace ndn::chunks {
PipelineInterests::PipelineInterests(Face& face, const Options& opts)
: m_options(opts)
, m_face(face)
- , m_hasFinalBlockId(false)
- , m_lastSegmentNo(0)
- , m_nReceived(0)
- , m_receivedSize(0)
- , m_nextSegmentNo(0)
- , m_isStopping(false)
{
}
@@ -160,5 +153,4 @@
return "";
}
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
diff --git a/tools/chunks/catchunks/pipeline-interests.hpp b/tools/chunks/catchunks/pipeline-interests.hpp
index 9fc3389..ea52d2f 100644
--- a/tools/chunks/catchunks/pipeline-interests.hpp
+++ b/tools/chunks/catchunks/pipeline-interests.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2021, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -33,8 +33,7 @@
#include "options.hpp"
-namespace ndn {
-namespace chunks {
+namespace ndn::chunks {
/**
* @brief Service for retrieving Data via an Interest pipeline
@@ -46,7 +45,7 @@
* No guarantees are made as to the order in which segments are fetched or callbacks are invoked,
* i.e. out-of-order delivery is possible.
*/
-class PipelineInterests
+class PipelineInterests : noncopyable
{
public:
/**
@@ -96,7 +95,7 @@
* @brief check if the transfer is complete
* @return true if all segments have been received, false otherwise
*/
- bool
+ [[nodiscard]] bool
allSegmentsReceived() const;
/**
@@ -157,17 +156,17 @@
Name m_prefix;
PUBLIC_WITH_TESTS_ELSE_PROTECTED:
- bool m_hasFinalBlockId; ///< true if the last segment number is known
- uint64_t m_lastSegmentNo; ///< valid only if m_hasFinalBlockId == true
- int64_t m_nReceived; ///< number of segments received
- size_t m_receivedSize; ///< size of received data in bytes
+ bool m_hasFinalBlockId = false; ///< true if the last segment number is known
+ uint64_t m_lastSegmentNo = 0; ///< valid only if m_hasFinalBlockId == true
+ int64_t m_nReceived = 0; ///< number of segments received
+ size_t m_receivedSize = 0; ///< size of received data in bytes
private:
DataCallback m_onData;
FailureCallback m_onFailure;
- uint64_t m_nextSegmentNo;
+ uint64_t m_nextSegmentNo = 0;
time::steady_clock::time_point m_startTime;
- bool m_isStopping;
+ bool m_isStopping = false;
};
template<typename Packet>
@@ -177,7 +176,6 @@
return packet.getName().at(-1).toSegment();
}
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
#endif // NDN_TOOLS_CHUNKS_CATCHUNKS_PIPELINE_INTERESTS_HPP
diff --git a/tools/chunks/catchunks/statistics-collector.cpp b/tools/chunks/catchunks/statistics-collector.cpp
index 91af79d..2e303c9 100644
--- a/tools/chunks/catchunks/statistics-collector.cpp
+++ b/tools/chunks/catchunks/statistics-collector.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2019, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -24,8 +24,7 @@
#include "statistics-collector.hpp"
-namespace ndn {
-namespace chunks {
+namespace ndn::chunks {
StatisticsCollector::StatisticsCollector(PipelineInterestsAdaptive& pipeline,
std::ostream& osCwnd, std::ostream& osRtt)
@@ -48,5 +47,4 @@
});
}
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
diff --git a/tools/chunks/catchunks/statistics-collector.hpp b/tools/chunks/catchunks/statistics-collector.hpp
index bc57f00..95abbae 100644
--- a/tools/chunks/catchunks/statistics-collector.hpp
+++ b/tools/chunks/catchunks/statistics-collector.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2019, Regents of the University of California,
+ * Copyright (c) 2016-2022, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -27,8 +27,7 @@
#include "pipeline-interests-adaptive.hpp"
-namespace ndn {
-namespace chunks {
+namespace ndn::chunks {
/**
* @brief Statistics collector for Adaptive pipelines
@@ -44,7 +43,6 @@
std::ostream& m_osRtt;
};
-} // namespace chunks
-} // namespace ndn
+} // namespace ndn::chunks
#endif // NDN_TOOLS_CHUNKS_CATCHUNKS_STATISTICS_COLLECTOR_HPP