build: migrate to C++17
Change-Id: Ic9f09efd20b608bfcb713fd319834b2666cf6242
diff --git a/src/update/manager-base.cpp b/src/update/manager-base.cpp
index 6ca1c4a..238a88f 100644
--- a/src/update/manager-base.cpp
+++ b/src/update/manager-base.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2020, The University of Memphis,
+/*
+ * Copyright (c) 2014-2022, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -17,9 +17,10 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
#include "manager-base.hpp"
+#include "logger.hpp"
namespace nlsr {
namespace update {
diff --git a/src/update/manager-base.hpp b/src/update/manager-base.hpp
index f9fa17c..557a015 100644
--- a/src/update/manager-base.hpp
+++ b/src/update/manager-base.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, The University of Memphis,
+ * Copyright (c) 2014-2022, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -27,7 +27,6 @@
#include "lsdb.hpp"
#include "nfd-rib-commands.hpp"
#include "prefix-update-commands.hpp"
-#include "logger.hpp"
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/interest.hpp>
@@ -38,6 +37,7 @@
#include <boost/noncopyable.hpp>
#include <iostream>
+#include <optional>
namespace nlsr {
@@ -95,7 +95,7 @@
std::string m_module;
};
-class CommandManagerBase: public ManagerBase
+class CommandManagerBase : public ManagerBase
{
public:
CommandManagerBase(ndn::mgmt::Dispatcher& m_dispatcher,
@@ -103,7 +103,8 @@
Lsdb& lsdb,
const std::string& module);
- virtual ~CommandManagerBase() {}
+ virtual
+ ~CommandManagerBase() = default;
/*! \brief add desired name prefix to the advertised name prefix list
* or insert a prefix into the FIB if parameters is valid.
@@ -126,14 +127,20 @@
/*! \brief save an advertised prefix to the nlsr configuration file
* returns bool from the overridden function while nullopt here
*/
- virtual ndn::optional<bool>
- afterAdvertise(const ndn::Name& prefix) { return ndn::nullopt; }
+ virtual std::optional<bool>
+ afterAdvertise(const ndn::Name& prefix)
+ {
+ return std::nullopt;
+ }
/*! \brief save an advertised prefix to the nlsr configuration file
* returns bool from the overridden function while nullopt here
*/
- virtual ndn::optional<bool>
- afterWithdraw(const ndn::Name& prefix) { return ndn::nullopt; }
+ virtual std::optional<bool>
+ afterWithdraw(const ndn::Name& prefix)
+ {
+ return std::nullopt;
+ }
protected:
NamePrefixList& m_namePrefixList;
diff --git a/src/update/prefix-update-processor.cpp b/src/update/prefix-update-processor.cpp
index d8302d4..c36b408 100644
--- a/src/update/prefix-update-processor.cpp
+++ b/src/update/prefix-update-processor.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, The University of Memphis,
+ * Copyright (c) 2014-2022, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -20,6 +20,7 @@
*/
#include "prefix-update-processor.hpp"
+#include "logger.hpp"
#include "lsdb.hpp"
#include "nlsr.hpp"
@@ -41,12 +42,12 @@
/** \brief obtain signer from SignerTag attached to Interest, if available
*/
-static ndn::optional<std::string>
+static std::optional<std::string>
getSignerFromTag(const ndn::Interest& interest)
{
auto signerTag = interest.getTag<SignerTag>();
if (signerTag == nullptr) {
- return ndn::nullopt;
+ return std::nullopt;
}
else {
return signerTag->get().toUri();
@@ -180,13 +181,13 @@
return true;
}
-ndn::optional<bool>
+std::optional<bool>
PrefixUpdateProcessor::afterAdvertise(const ndn::Name& prefix)
{
return addOrDeletePrefix(prefix, true);
}
-ndn::optional<bool>
+std::optional<bool>
PrefixUpdateProcessor::afterWithdraw(const ndn::Name& prefix)
{
return addOrDeletePrefix(prefix, false);
diff --git a/src/update/prefix-update-processor.hpp b/src/update/prefix-update-processor.hpp
index 80f6564..1864d0f 100644
--- a/src/update/prefix-update-processor.hpp
+++ b/src/update/prefix-update-processor.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, The University of Memphis,
+ * Copyright (c) 2014-2022, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -32,7 +32,7 @@
namespace nlsr {
namespace update {
-typedef boost::property_tree::ptree ConfigSection;
+using ConfigSection = boost::property_tree::ptree;
class PrefixUpdateProcessor : public CommandManagerBase
{
@@ -62,11 +62,11 @@
bool
addOrDeletePrefix(const ndn::Name& prefix, bool addPrefix);
- ndn::optional<bool>
- afterAdvertise(const ndn::Name& prefix);
+ std::optional<bool>
+ afterAdvertise(const ndn::Name& prefix) override;
- ndn::optional<bool>
- afterWithdraw(const ndn::Name& prefix);
+ std::optional<bool>
+ afterWithdraw(const ndn::Name& prefix) override;
/*! \brief Check if a prefix exists in the nlsr configuration file */
bool