core: drop std::function and ndn::Exclude from common.hpp, add ndn::optional
Change-Id: Ie3983d8b6f9929430efd8ada8d942e3f95755cd4
diff --git a/tools/nfdc/channel-module.cpp b/tools/nfdc/channel-module.cpp
index 15cffb4..81f69d4 100644
--- a/tools/nfdc/channel-module.cpp
+++ b/tools/nfdc/channel-module.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, 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,
@@ -32,7 +32,7 @@
void
ChannelModule::fetchStatus(Controller& controller,
- const function<void()>& onSuccess,
+ const std::function<void()>& onSuccess,
const Controller::DatasetFailCallback& onFailure,
const CommandOptions& options)
{
diff --git a/tools/nfdc/channel-module.hpp b/tools/nfdc/channel-module.hpp
index 6225a27..17989a6 100644
--- a/tools/nfdc/channel-module.hpp
+++ b/tools/nfdc/channel-module.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, 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,
@@ -40,13 +40,13 @@
class ChannelModule : public Module, noncopyable
{
public:
- virtual void
+ void
fetchStatus(Controller& controller,
- const function<void()>& onSuccess,
+ const std::function<void()>& onSuccess,
const Controller::DatasetFailCallback& onFailure,
const CommandOptions& options) override;
- virtual void
+ void
formatStatusXml(std::ostream& os) const override;
/** \brief format a single status item as XML
@@ -56,7 +56,7 @@
void
formatItemXml(std::ostream& os, const ChannelStatus& item) const;
- virtual void
+ void
formatStatusText(std::ostream& os) const override;
/** \brief format a single status item as text
diff --git a/tools/nfdc/command-arguments.hpp b/tools/nfdc/command-arguments.hpp
index 13aef61..a949f99 100644
--- a/tools/nfdc/command-arguments.hpp
+++ b/tools/nfdc/command-arguments.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,
@@ -59,12 +59,12 @@
/** \return the argument value, or nullopt if the argument is omitted on command line
*/
template<typename T>
- ndn::optional<T>
+ optional<T>
getOptional(const std::string& key) const
{
auto i = find(key);
if (i == end()) {
- return ndn::nullopt;
+ return nullopt;
}
return boost::any_cast<T>(i->second);
}
diff --git a/tools/nfdc/cs-module.cpp b/tools/nfdc/cs-module.cpp
index d42b82e..6a3b0b5 100644
--- a/tools/nfdc/cs-module.cpp
+++ b/tools/nfdc/cs-module.cpp
@@ -81,7 +81,7 @@
void
CsModule::fetchStatus(Controller& controller,
- const function<void()>& onSuccess,
+ const std::function<void()>& onSuccess,
const Controller::DatasetFailCallback& onFailure,
const CommandOptions& options)
{
diff --git a/tools/nfdc/cs-module.hpp b/tools/nfdc/cs-module.hpp
index 320ce09..4181290 100644
--- a/tools/nfdc/cs-module.hpp
+++ b/tools/nfdc/cs-module.hpp
@@ -53,7 +53,7 @@
void
fetchStatus(Controller& controller,
- const function<void()>& onSuccess,
+ const std::function<void()>& onSuccess,
const Controller::DatasetFailCallback& onFailure,
const CommandOptions& options) override;
diff --git a/tools/nfdc/face-module.cpp b/tools/nfdc/face-module.cpp
index 888a7b3..23a03db 100644
--- a/tools/nfdc/face-module.cpp
+++ b/tools/nfdc/face-module.cpp
@@ -161,7 +161,7 @@
auto defaultCongestionThreshold = ctx.args.getOptional<uint64_t>("default-congestion-threshold");
FaceUri canonicalRemote;
- ndn::optional<FaceUri> canonicalLocal;
+ optional<FaceUri> canonicalLocal;
auto handleCanonizeError = [&] (const FaceUri& faceUri, const std::string& error) {
ctx.exitCode = 4;
@@ -346,7 +346,7 @@
void
FaceModule::fetchStatus(Controller& controller,
- const function<void()>& onSuccess,
+ const std::function<void()>& onSuccess,
const Controller::DatasetFailCallback& onFailure,
const CommandOptions& options)
{
diff --git a/tools/nfdc/face-module.hpp b/tools/nfdc/face-module.hpp
index 9f0ac2a..8083e74 100644
--- a/tools/nfdc/face-module.hpp
+++ b/tools/nfdc/face-module.hpp
@@ -69,7 +69,7 @@
void
fetchStatus(Controller& controller,
- const function<void()>& onSuccess,
+ const std::function<void()>& onSuccess,
const Controller::DatasetFailCallback& onFailure,
const CommandOptions& options) override;
diff --git a/tools/nfdc/fib-module.cpp b/tools/nfdc/fib-module.cpp
index 3da24ee..ef2841e 100644
--- a/tools/nfdc/fib-module.cpp
+++ b/tools/nfdc/fib-module.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, 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,
@@ -32,7 +32,7 @@
void
FibModule::fetchStatus(Controller& controller,
- const function<void()>& onSuccess,
+ const std::function<void()>& onSuccess,
const Controller::DatasetFailCallback& onFailure,
const CommandOptions& options)
{
diff --git a/tools/nfdc/fib-module.hpp b/tools/nfdc/fib-module.hpp
index 6c33d64..a41c978 100644
--- a/tools/nfdc/fib-module.hpp
+++ b/tools/nfdc/fib-module.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, 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,
@@ -41,13 +41,13 @@
class FibModule : public Module, noncopyable
{
public:
- virtual void
+ void
fetchStatus(Controller& controller,
- const function<void()>& onSuccess,
+ const std::function<void()>& onSuccess,
const Controller::DatasetFailCallback& onFailure,
const CommandOptions& options) override;
- virtual void
+ void
formatStatusXml(std::ostream& os) const override;
/** \brief format a single status item as XML
@@ -57,7 +57,7 @@
void
formatItemXml(std::ostream& os, const FibEntry& item) const;
- virtual void
+ void
formatStatusText(std::ostream& os) const override;
/** \brief format a single status item as text
diff --git a/tools/nfdc/find-face.cpp b/tools/nfdc/find-face.cpp
index 89d8b03..918693f 100644
--- a/tools/nfdc/find-face.cpp
+++ b/tools/nfdc/find-face.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,
@@ -25,6 +25,7 @@
#include "find-face.hpp"
#include "format-helpers.hpp"
+
#include <ndn-cxx/util/logger.hpp>
namespace nfd {
@@ -105,7 +106,7 @@
return m_res;
}
-ndn::optional<FaceUri>
+optional<FaceUri>
FindFace::canonize(const std::string& fieldName, const FaceUri& input)
{
if (!FaceUri::canCanonize(input.getScheme())) {
@@ -113,7 +114,7 @@
return input;
}
- ndn::optional<FaceUri> result;
+ optional<FaceUri> result;
input.canonize(
[&result] (const FaceUri& canonicalUri) { result = canonicalUri; },
[this, fieldName] (const std::string& errorReason) {
diff --git a/tools/nfdc/find-face.hpp b/tools/nfdc/find-face.hpp
index 120718b..68e5f7b 100644
--- a/tools/nfdc/find-face.hpp
+++ b/tools/nfdc/find-face.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,
@@ -125,7 +125,7 @@
* \return canonical FaceUri if canonization succeeds, input if canonization is unsupported
* \retval nullopt canonization fails; m_errorReason describes the failure
*/
- ndn::optional<FaceUri>
+ optional<FaceUri>
canonize(const std::string& fieldName, const FaceUri& input);
/** \brief retrieve FaceStatus from filter
diff --git a/tools/nfdc/forwarder-general-module.cpp b/tools/nfdc/forwarder-general-module.cpp
index 67093ec..e0d6b1b 100644
--- a/tools/nfdc/forwarder-general-module.cpp
+++ b/tools/nfdc/forwarder-general-module.cpp
@@ -34,7 +34,7 @@
void
ForwarderGeneralModule::fetchStatus(Controller& controller,
- const function<void()>& onSuccess,
+ const std::function<void()>& onSuccess,
const Controller::DatasetFailCallback& onFailure,
const CommandOptions& options)
{
diff --git a/tools/nfdc/forwarder-general-module.hpp b/tools/nfdc/forwarder-general-module.hpp
index 4619cfa..10d5cf3 100644
--- a/tools/nfdc/forwarder-general-module.hpp
+++ b/tools/nfdc/forwarder-general-module.hpp
@@ -42,7 +42,7 @@
public:
void
fetchStatus(Controller& controller,
- const function<void()>& onSuccess,
+ const std::function<void()>& onSuccess,
const Controller::DatasetFailCallback& onFailure,
const CommandOptions& options) override;
diff --git a/tools/nfdc/module.hpp b/tools/nfdc/module.hpp
index 765e39b..b8ede30 100644
--- a/tools/nfdc/module.hpp
+++ b/tools/nfdc/module.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,
@@ -55,7 +55,7 @@
*/
virtual void
fetchStatus(Controller& controller,
- const function<void()>& onSuccess,
+ const std::function<void()>& onSuccess,
const Controller::DatasetFailCallback& onFailure,
const CommandOptions& options) = 0;
diff --git a/tools/nfdc/rib-module.cpp b/tools/nfdc/rib-module.cpp
index a5a2454..47acd0c 100644
--- a/tools/nfdc/rib-module.cpp
+++ b/tools/nfdc/rib-module.cpp
@@ -258,7 +258,7 @@
void
RibModule::fetchStatus(Controller& controller,
- const function<void()>& onSuccess,
+ const std::function<void()>& onSuccess,
const Controller::DatasetFailCallback& onFailure,
const CommandOptions& options)
{
diff --git a/tools/nfdc/rib-module.hpp b/tools/nfdc/rib-module.hpp
index ae53928..6c64cd2 100644
--- a/tools/nfdc/rib-module.hpp
+++ b/tools/nfdc/rib-module.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,
@@ -69,7 +69,7 @@
void
fetchStatus(Controller& controller,
- const function<void()>& onSuccess,
+ const std::function<void()>& onSuccess,
const Controller::DatasetFailCallback& onFailure,
const CommandOptions& options) override;
@@ -80,7 +80,7 @@
formatStatusText(std::ostream& os) const override;
private:
- using RoutePredicate = function<bool(const RibEntry&, const Route&)>;
+ using RoutePredicate = std::function<bool(const RibEntry&, const Route&)>;
static void
listRoutesImpl(ExecuteContext& ctx, const RoutePredicate& filter);
diff --git a/tools/nfdc/strategy-choice-module.cpp b/tools/nfdc/strategy-choice-module.cpp
index 5f81f7a..004f368 100644
--- a/tools/nfdc/strategy-choice-module.cpp
+++ b/tools/nfdc/strategy-choice-module.cpp
@@ -151,7 +151,7 @@
void
StrategyChoiceModule::fetchStatus(Controller& controller,
- const function<void()>& onSuccess,
+ const std::function<void()>& onSuccess,
const Controller::DatasetFailCallback& onFailure,
const CommandOptions& options)
{
diff --git a/tools/nfdc/strategy-choice-module.hpp b/tools/nfdc/strategy-choice-module.hpp
index 71fa9a2..7c403a9 100644
--- a/tools/nfdc/strategy-choice-module.hpp
+++ b/tools/nfdc/strategy-choice-module.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,
@@ -68,7 +68,7 @@
void
fetchStatus(Controller& controller,
- const function<void()>& onSuccess,
+ const std::function<void()>& onSuccess,
const Controller::DatasetFailCallback& onFailure,
const CommandOptions& options) override;