Replace remaining uses of BOOST_THROW_EXCEPTION with NDN_THROW
Change-Id: I0c149acbe5607d928cdf9e8d73813d5e74ca45d0
diff --git a/src/update/manager-base.hpp b/src/update/manager-base.hpp
index 4d279c7..f9fa17c 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-2019, The University of Memphis,
+/*
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -17,7 +17,7 @@
*
* 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/>.
- **/
+ */
#ifndef NLSR_MANAGER_BASE_HPP
#define NLSR_MANAGER_BASE_HPP
@@ -37,6 +37,7 @@
#include <ndn-cxx/mgmt/nfd/control-response.hpp>
#include <boost/noncopyable.hpp>
+#include <iostream>
namespace nlsr {
@@ -52,16 +53,10 @@
class Error : public std::runtime_error
{
public:
- explicit
- Error(const std::string& what)
- : std::runtime_error(what)
- {
- }
+ using std::runtime_error::runtime_error;
};
-public:
- ManagerBase(ndn::mgmt::Dispatcher& m_dispatcher,
- const std::string& module);
+ ManagerBase(ndn::mgmt::Dispatcher& m_dispatcher, const std::string& module);
protected:
/*! \brief generate the relative prefix for a handler by appending the verb name to the module name
@@ -76,16 +71,15 @@
bool
validateParameters(const ndn::mgmt::ControlParameters& parameters)
{
- const ndn::nfd::ControlParameters* castParams =
- dynamic_cast<const ndn::nfd::ControlParameters*>(¶meters);
-
+ const auto* castParams = dynamic_cast<const ndn::nfd::ControlParameters*>(¶meters);
BOOST_ASSERT(castParams != nullptr);
+
T command;
try {
command.validateRequest(*castParams);
}
- catch (const ndn::nfd::ControlCommand::ArgumentError& ae) {
- throw ae;
+ catch (const ndn::nfd::ControlCommand::ArgumentError&) {
+ throw;
}
catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
diff --git a/src/update/nfd-rib-command-processor.cpp b/src/update/nfd-rib-command-processor.cpp
index 331a3ca..2570797 100644
--- a/src/update/nfd-rib-command-processor.cpp
+++ b/src/update/nfd-rib-command-processor.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2018, The University of Memphis,
+/*
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -17,7 +17,7 @@
*
* 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 "nfd-rib-command-processor.hpp"
@@ -32,12 +32,12 @@
m_dispatcher.addControlCommand<ndn::nfd::ControlParameters>(makeRelPrefix("register"),
ndn::mgmt::makeAcceptAllAuthorization(),
std::bind(&NfdRibCommandProcessor::validateParameters<NfdRibRegisterCommand>, this, _1),
- bind(&NfdRibCommandProcessor::advertiseAndInsertPrefix, this, _1, _2, _3, _4));
+ std::bind(&NfdRibCommandProcessor::advertiseAndInsertPrefix, this, _1, _2, _3, _4));
m_dispatcher.addControlCommand<ndn::nfd::ControlParameters>(makeRelPrefix("unregister"),
ndn::mgmt::makeAcceptAllAuthorization(),
std::bind(&NfdRibCommandProcessor::validateParameters<NfdRibUnregisterCommand>, this, _1),
- bind(&NfdRibCommandProcessor::withdrawAndRemovePrefix, this, _1, _2, _3, _4));
+ std::bind(&NfdRibCommandProcessor::withdrawAndRemovePrefix, this, _1, _2, _3, _4));
}
} // namespace update
diff --git a/src/update/prefix-update-processor.cpp b/src/update/prefix-update-processor.cpp
index 956fc7b..99cd76b 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-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -22,8 +22,10 @@
#include "prefix-update-processor.hpp"
#include "lsdb.hpp"
#include "nlsr.hpp"
-#include <ndn-cxx/mgmt/nfd/control-response.hpp>
+
#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/mgmt/nfd/control-response.hpp>
+
#include <boost/algorithm/string.hpp>
#include <algorithm>
@@ -41,7 +43,7 @@
static ndn::optional<std::string>
getSignerFromTag(const ndn::Interest& interest)
{
- shared_ptr<SignerTag> signerTag = interest.getTag<SignerTag>();
+ auto signerTag = interest.getTag<SignerTag>();
if (signerTag == nullptr) {
return ndn::nullopt;
}