table: cs::Policy::getPolicyNames
refs #3148
Change-Id: I06f66e9780b9c5c4820ba18cca5fbc9b1061eae0
diff --git a/daemon/table/cs-policy.cpp b/daemon/table/cs-policy.cpp
index 77101ac..4aab572 100644
--- a/daemon/table/cs-policy.cpp
+++ b/daemon/table/cs-policy.cpp
@@ -26,6 +26,8 @@
#include "cs-policy.hpp"
#include "cs.hpp"
#include "core/logger.hpp"
+#include <boost/range/adaptor/map.hpp>
+#include <boost/range/algorithm/copy.hpp>
NFD_LOG_INIT("CsPolicy");
@@ -40,13 +42,22 @@
}
unique_ptr<Policy>
-Policy::create(const std::string& key)
+Policy::create(const std::string& policyName)
{
Registry& registry = getRegistry();
- auto i = registry.find(key);
+ auto i = registry.find(policyName);
return i == registry.end() ? nullptr : i->second();
}
+std::set<std::string>
+Policy::getPolicyNames()
+{
+ std::set<std::string> policyNames;
+ boost::copy(getRegistry() | boost::adaptors::map_keys,
+ std::inserter(policyNames, policyNames.end()));
+ return policyNames;
+}
+
Policy::Policy(const std::string& policyName)
: m_policyName(policyName)
{