mgmt: mark StatusDatasetContext as noncopyable
This commit also changes function-by-value to function-by-const-reference
in Dispatcher.
refs #2107
Change-Id: If7859579ea9cdd953476642c05104355acdf1620
diff --git a/src/mgmt/dispatcher.cpp b/src/mgmt/dispatcher.cpp
index b43334b..78217a9 100644
--- a/src/mgmt/dispatcher.cpp
+++ b/src/mgmt/dispatcher.cpp
@@ -38,8 +38,8 @@
return [] (const Name& prefix,
const Interest& interest,
const ControlParameters* params,
- AcceptContinuation accept,
- RejectContinuation reject) {
+ const AcceptContinuation& accept,
+ const RejectContinuation& reject) {
accept("");
};
}
@@ -226,8 +226,8 @@
void
Dispatcher::addStatusDataset(const PartialName& relPrefix,
- Authorization authorization,
- StatusDatasetHandler handler)
+ const Authorization& authorization,
+ const StatusDatasetHandler& handler)
{
if (!m_topLevelPrefixes.empty()) {
BOOST_THROW_EXCEPTION(std::domain_error("one or more top-level prefix has been added"));
diff --git a/src/mgmt/dispatcher.hpp b/src/mgmt/dispatcher.hpp
index 922722f..7e521c8 100644
--- a/src/mgmt/dispatcher.hpp
+++ b/src/mgmt/dispatcher.hpp
@@ -76,8 +76,8 @@
*/
typedef std::function<void(const Name& prefix, const Interest& interest,
const ControlParameters* params,
- AcceptContinuation accept,
- RejectContinuation reject)> Authorization;
+ const AcceptContinuation& accept,
+ const RejectContinuation& reject)> Authorization;
/** \return an Authorization that accepts all Interests, with empty string as requester
*/
@@ -106,7 +106,7 @@
*/
typedef std::function<void(const Name& prefix, const Interest& interest,
const ControlParameters& params,
- CommandContinuation done)> ControlCommandHandler;
+ const CommandContinuation& done)> ControlCommandHandler;
/** \brief a function to handle a StatusDataset request
@@ -217,9 +217,9 @@
template<typename CP>
void
addControlCommand(const PartialName& relPrefix,
- Authorization authorization,
- ValidateParameters validateParams,
- ControlCommandHandler handler);
+ const Authorization& authorization,
+ const ValidateParameters& validateParams,
+ const ControlCommandHandler& handler);
public: // StatusDataset
/** \brief register a StatusDataset or a prefix under which StatusDatasets can be requested
@@ -254,8 +254,8 @@
*/
void
addStatusDataset(const PartialName& relPrefix,
- Authorization authorization,
- StatusDatasetHandler handler);
+ const Authorization& authorization,
+ const StatusDatasetHandler& handler);
public: // NotificationStream
/** \brief register a NotificationStream
@@ -418,9 +418,9 @@
template<typename CP>
void
Dispatcher::addControlCommand(const PartialName& relPrefix,
- Authorization authorization,
- ValidateParameters validateParams,
- ControlCommandHandler handler)
+ const Authorization& authorization,
+ const ValidateParameters& validateParams,
+ const ControlCommandHandler& handler)
{
if (!m_topLevelPrefixes.empty()) {
throw std::domain_error("one or more top-level prefix has been added");
diff --git a/src/mgmt/status-dataset-context.hpp b/src/mgmt/status-dataset-context.hpp
index 196a296..6a2d02a 100644
--- a/src/mgmt/status-dataset-context.hpp
+++ b/src/mgmt/status-dataset-context.hpp
@@ -35,7 +35,9 @@
namespace ndn {
namespace mgmt {
-class StatusDatasetContext
+/** \brief provides a context for generating response to a StatusDataset request
+ */
+class StatusDatasetContext : noncopyable
{
public:
/** \return prefix of Data packets, with version component but without segment component