build: switch to C++17
Change-Id: Ie68020a04b7e20b74778b6d0370544ded55c5e26
diff --git a/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.cpp b/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.cpp
index ca54132..7aff618 100644
--- a/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.cpp
+++ b/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -28,14 +28,14 @@
namespace nfd {
namespace rib {
-optional<ReadvertiseAction>
+std::optional<ReadvertiseAction>
ClientToNlsrReadvertisePolicy::handleNewRoute(const RibRouteRef& ribRoute) const
{
if (ribRoute.route->origin == ndn::nfd::ROUTE_ORIGIN_CLIENT) {
return ReadvertiseAction{ribRoute.entry->getName(), ndn::security::SigningInfo()};
}
else {
- return nullopt;
+ return std::nullopt;
}
}
diff --git a/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.hpp b/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.hpp
index b1c5e29..c0d5837 100644
--- a/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.hpp
+++ b/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -41,7 +41,7 @@
* If the route origin is "client" (typically from auto prefix propagation), readvertise it
* using the default signing identity.
*/
- optional<ReadvertiseAction>
+ std::optional<ReadvertiseAction>
handleNewRoute(const RibRouteRef& ribRoute) const override;
time::milliseconds
diff --git a/daemon/rib/readvertise/host-to-gateway-readvertise-policy.cpp b/daemon/rib/readvertise/host-to-gateway-readvertise-policy.cpp
index 9ee7985..89f11fd 100644
--- a/daemon/rib/readvertise/host-to-gateway-readvertise-policy.cpp
+++ b/daemon/rib/readvertise/host-to-gateway-readvertise-policy.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -44,13 +44,13 @@
m_refreshInterval = interval ? time::seconds(*interval) : DEFAULT_REFRESH_INTERVAL;
}
-optional<ReadvertiseAction>
+std::optional<ReadvertiseAction>
HostToGatewayReadvertisePolicy::handleNewRoute(const RibRouteRef& ribRoute) const
{
auto ribEntryName = ribRoute.entry->getName();
if (scope_prefix::LOCALHOST.isPrefixOf(ribEntryName) ||
ribEntryName == RibManager::LOCALHOP_TOP_PREFIX) {
- return nullopt;
+ return std::nullopt;
}
// find out the shortest identity whose name is a prefix of the RIB entry name
@@ -73,12 +73,10 @@
}
}
- if (isFound) {
- return ReadvertiseAction{prefixToAdvertise, ndn::security::signingByIdentity(signingIdentity)};
+ if (!isFound) {
+ return std::nullopt;
}
- else {
- return nullopt;
- }
+ return ReadvertiseAction{prefixToAdvertise, ndn::security::signingByIdentity(signingIdentity)};
}
time::milliseconds
diff --git a/daemon/rib/readvertise/host-to-gateway-readvertise-policy.hpp b/daemon/rib/readvertise/host-to-gateway-readvertise-policy.hpp
index 325fc80..ac2491d 100644
--- a/daemon/rib/readvertise/host-to-gateway-readvertise-policy.hpp
+++ b/daemon/rib/readvertise/host-to-gateway-readvertise-policy.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -43,7 +43,7 @@
const ConfigSection& section);
public:
- optional<ReadvertiseAction>
+ std::optional<ReadvertiseAction>
handleNewRoute(const RibRouteRef& ribRoute) const override;
time::milliseconds
diff --git a/daemon/rib/readvertise/readvertise-policy.hpp b/daemon/rib/readvertise/readvertise-policy.hpp
index 99deccb..da22139 100644
--- a/daemon/rib/readvertise/readvertise-policy.hpp
+++ b/daemon/rib/readvertise/readvertise-policy.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -51,7 +51,7 @@
/** \brief decide whether to readvertise a route, and what prefix to readvertise
*/
- virtual optional<ReadvertiseAction>
+ virtual std::optional<ReadvertiseAction>
handleNewRoute(const RibRouteRef& ribRoute) const = 0;
/** \return how often readvertisements made by this policy should be refreshed.
diff --git a/daemon/rib/readvertise/readvertise.cpp b/daemon/rib/readvertise/readvertise.cpp
index 2f16795..addad72 100644
--- a/daemon/rib/readvertise/readvertise.cpp
+++ b/daemon/rib/readvertise/readvertise.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -67,7 +67,7 @@
void
Readvertise::afterAddRoute(const RibRouteRef& ribRoute)
{
- optional<ReadvertiseAction> action = m_policy->handleNewRoute(ribRoute);
+ std::optional<ReadvertiseAction> action = m_policy->handleNewRoute(ribRoute);
if (!action) {
NFD_LOG_DEBUG("add-route " << ribRoute.entry->getName() << '(' << ribRoute.route->faceId <<
',' << ribRoute.route->origin << ") not-readvertising");
diff --git a/daemon/rib/route.hpp b/daemon/rib/route.hpp
index 18df250..9b0bead 100644
--- a/daemon/rib/route.hpp
+++ b/daemon/rib/route.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -82,13 +82,13 @@
ndn::nfd::RouteOrigin origin = ndn::nfd::ROUTE_ORIGIN_APP;
uint64_t cost = 0;
std::underlying_type_t<ndn::nfd::RouteFlags> flags = ndn::nfd::ROUTE_FLAGS_NONE;
- optional<time::steady_clock::time_point> expires;
+ std::optional<time::steady_clock::time_point> expires;
/** \brief The prefix announcement that caused the creation of this route.
*
* This is nullopt if this route is not created by a prefix announcement.
*/
- optional<ndn::PrefixAnnouncement> announcement;
+ std::optional<ndn::PrefixAnnouncement> announcement;
/** \brief Expiration time of the prefix announcement.
*