CR fix 2
Change-Id: Ib5b7d7ff17f6ae31e9b6d905ef53d015a7389ccc
diff --git a/src/name-assignment/assignment-func.cpp b/src/name-assignment/assignment-func.cpp
index 6a55cc2..22eb35e 100644
--- a/src/name-assignment/assignment-func.cpp
+++ b/src/name-assignment/assignment-func.cpp
@@ -43,15 +43,15 @@
unique_ptr<NameAssignmentFunc>
NameAssignmentFunc::createNameAssignmentFunc(const std::string& challengeType, const std::string& format)
{
- FuncFactoryFactory& factory = getFactory();
+ CurriedFuncFactory& factory = getFactory();
auto i = factory.find(challengeType);
return i == factory.end() ? nullptr : i->second(format);
}
-NameAssignmentFunc::FuncFactoryFactory&
+NameAssignmentFunc::CurriedFuncFactory&
NameAssignmentFunc::getFactory()
{
- static NameAssignmentFunc::FuncFactoryFactory factory;
+ static NameAssignmentFunc::CurriedFuncFactory factory;
return factory;
}
diff --git a/src/name-assignment/assignment-func.hpp b/src/name-assignment/assignment-func.hpp
index a574d05..e122ed2 100644
--- a/src/name-assignment/assignment-func.hpp
+++ b/src/name-assignment/assignment-func.hpp
@@ -28,9 +28,10 @@
class NameAssignmentFunc : noncopyable
{
-public:
+protected:
explicit NameAssignmentFunc(const std::string& factoryType, const std::string& format = "");
+public:
virtual ~NameAssignmentFunc() = default;
/**
@@ -47,26 +48,28 @@
assignName(const std::vector<std::tuple<std::string, std::string>>& params) = 0;
const std::string FACTORY_TYPE;
- std::vector<std::string> m_nameFormat;
public:
- template <class ChallengeType>
+ template <class AssignmentType>
static void
registerNameAssignmentFunc(const std::string& typeName)
{
- FuncFactoryFactory& factory = getFactory();
+ CurriedFuncFactory& factory = getFactory();
BOOST_ASSERT(factory.count(typeName) == 0);
- factory[typeName] = [](const std::string& format) { return std::make_unique<ChallengeType>(format); };
+ factory[typeName] = [](const std::string& format) { return std::make_unique<AssignmentType>(format); };
}
static unique_ptr<NameAssignmentFunc>
createNameAssignmentFunc(const std::string& challengeType, const std::string& format = "");
+NDNCERT_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
+ std::vector<std::string> m_nameFormat;
+
private:
typedef function<unique_ptr<NameAssignmentFunc>(const std::string&)> FactoryCreateFunc;
- typedef std::map<std::string, FactoryCreateFunc> FuncFactoryFactory;
+ typedef std::map<std::string, FactoryCreateFunc> CurriedFuncFactory;
- static FuncFactoryFactory&
+ static CurriedFuncFactory&
getFactory();
};
diff --git a/src/name-assignment/assignment-param.hpp b/src/name-assignment/assignment-param.hpp
index bc1a084..8a31dc6 100644
--- a/src/name-assignment/assignment-param.hpp
+++ b/src/name-assignment/assignment-param.hpp
@@ -36,6 +36,7 @@
std::vector<PartialName>
assignName(const std::vector<std::tuple<std::string, std::string>>& params) override;
+
};
} // namespace ndncert