core: drop std::function and ndn::Exclude from common.hpp, add ndn::optional
Change-Id: Ie3983d8b6f9929430efd8ada8d942e3f95755cd4
diff --git a/daemon/face/channel.hpp b/daemon/face/channel.hpp
index cdb7078..5b870fe 100644
--- a/daemon/face/channel.hpp
+++ b/daemon/face/channel.hpp
@@ -37,11 +37,11 @@
/** \brief Prototype for the callback that is invoked when a face is created
* (in response to an incoming connection or after a connection is established)
*/
-using FaceCreatedCallback = function<void(const shared_ptr<Face>& face)>;
+using FaceCreatedCallback = std::function<void(const shared_ptr<Face>& face)>;
/** \brief Prototype for the callback that is invoked when a face fails to be created
*/
-using FaceCreationFailedCallback = function<void(uint32_t status, const std::string& reason)>;
+using FaceCreationFailedCallback = std::function<void(uint32_t status, const std::string& reason)>;
/** \brief represent a channel that communicates on a local endpoint
* \sa FaceSystem
@@ -98,8 +98,8 @@
public:
ndn::nfd::FacePersistency persistency;
- ndn::optional<time::nanoseconds> baseCongestionMarkingInterval;
- ndn::optional<uint64_t> defaultCongestionThreshold;
+ optional<time::nanoseconds> baseCongestionMarkingInterval;
+ optional<uint64_t> defaultCongestionThreshold;
bool wantLocalFields;
bool wantLpReliability;
boost::logic::tribool wantCongestionMarking;
diff --git a/daemon/face/protocol-factory.hpp b/daemon/face/protocol-factory.hpp
index fe3f1f8..74dbde7 100644
--- a/daemon/face/protocol-factory.hpp
+++ b/daemon/face/protocol-factory.hpp
@@ -137,7 +137,7 @@
struct CreateFaceRequest
{
FaceUri remoteUri;
- ndn::optional<FaceUri> localUri;
+ optional<FaceUri> localUri;
FaceParams params;
};
diff --git a/daemon/face/udp-factory.cpp b/daemon/face/udp-factory.cpp
index c392b51..377d3b1 100644
--- a/daemon/face/udp-factory.cpp
+++ b/daemon/face/udp-factory.cpp
@@ -363,7 +363,7 @@
return face;
}
-static ndn::optional<ip::address>
+static optional<ip::address>
pickAddress(const net::NetworkInterface& netif, net::AddressFamily af)
{
for (const auto& na : netif.getNetworkAddresses()) {
@@ -372,7 +372,7 @@
return na.getIp();
}
}
- return ndn::nullopt;
+ return nullopt;
}
std::vector<shared_ptr<Face>>
diff --git a/daemon/fw/forwarder.hpp b/daemon/fw/forwarder.hpp
index 36af43a..bcb3caf 100644
--- a/daemon/fw/forwarder.hpp
+++ b/daemon/fw/forwarder.hpp
@@ -259,7 +259,7 @@
*/
#ifdef WITH_TESTS
virtual void
- dispatchToStrategy(pit::Entry& pitEntry, function<void(fw::Strategy&)> trigger)
+ dispatchToStrategy(pit::Entry& pitEntry, std::function<void(fw::Strategy&)> trigger)
#else
template<class Function>
void
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index ae1b4bd..278e016 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -125,7 +125,7 @@
return {input.getPrefix(i + 1), input[i].toVersion(), input.getSubName(i + 1)};
}
}
- return {input, ndn::nullopt, PartialName()};
+ return {input, nullopt, PartialName()};
}
Name
diff --git a/daemon/fw/strategy.hpp b/daemon/fw/strategy.hpp
index b52c05b..0df65b9 100644
--- a/daemon/fw/strategy.hpp
+++ b/daemon/fw/strategy.hpp
@@ -336,7 +336,7 @@
struct ParsedInstanceName
{
Name strategyName; ///< strategy name without parameters
- ndn::optional<uint64_t> version; ///< whether strategyName contains a version component
+ optional<uint64_t> version; ///< whether strategyName contains a version component
PartialName parameters; ///< parameter components
};
diff --git a/daemon/mgmt/command-authenticator.cpp b/daemon/mgmt/command-authenticator.cpp
index 6f85fc7..04f2476 100644
--- a/daemon/mgmt/command-authenticator.cpp
+++ b/daemon/mgmt/command-authenticator.cpp
@@ -51,12 +51,12 @@
/** \brief obtain signer from SignerTag attached to Interest, if available
*/
-static ndn::optional<std::string>
+static optional<std::string>
getSignerFromTag(const Interest& interest)
{
shared_ptr<SignerTag> signerTag = interest.getTag<SignerTag>();
if (signerTag == nullptr) {
- return ndn::nullopt;
+ return nullopt;
}
else {
return signerTag->get().toUri();
diff --git a/daemon/mgmt/face-manager.cpp b/daemon/mgmt/face-manager.cpp
index 9d68256..76fac1c 100644
--- a/daemon/mgmt/face-manager.cpp
+++ b/daemon/mgmt/face-manager.cpp
@@ -88,7 +88,7 @@
return;
}
- ndn::optional<FaceUri> localUri;
+ optional<FaceUri> localUri;
if (parameters.hasLocalUri()) {
localUri = FaceUri{};
diff --git a/daemon/table/name-tree-iterator.hpp b/daemon/table/name-tree-iterator.hpp
index 6251acd..87a93f7 100644
--- a/daemon/table/name-tree-iterator.hpp
+++ b/daemon/table/name-tree-iterator.hpp
@@ -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,
@@ -35,31 +35,31 @@
/** \brief a predicate to accept or reject an Entry in find operations
*/
-typedef function<bool(const Entry& entry)> EntrySelector;
+using EntrySelector = std::function<bool(const Entry&)>;
/** \brief an EntrySelector that accepts every Entry
*/
struct AnyEntry
{
bool
- operator()(const Entry& entry) const
+ operator()(const Entry&) const
{
return true;
}
};
/** \brief a predicate to accept or reject an Entry and its children
- * \return .first indicates whether entry should be accepted;
- * .second indicates whether entry's children should be visited
+ * \return `.first` indicates whether entry should be accepted;
+ * `.second` indicates whether entry's children should be visited
*/
-typedef function<std::pair<bool,bool>(const Entry& entry)> EntrySubTreeSelector;
+using EntrySubTreeSelector = std::function<std::pair<bool, bool>(const Entry&)>;
/** \brief an EntrySubTreeSelector that accepts every Entry and its children
*/
struct AnyEntrySubTree
{
std::pair<bool, bool>
- operator()(const Entry& entry) const
+ operator()(const Entry&) const
{
return {true, true};
}
@@ -203,7 +203,7 @@
* This type has .begin() and .end() methods which return Iterator.
* This type is usable with range-based for.
*/
-typedef boost::iterator_range<Iterator> Range;
+using Range = boost::iterator_range<Iterator>;
} // namespace name_tree
} // namespace nfd