24 lines
542 B
C++
Executable File
24 lines
542 B
C++
Executable File
// kms_factory.hpp
|
|
#ifndef KMS_FACTORY_HPP
|
|
#define KMS_FACTORY_HPP
|
|
|
|
#include "kms_interface.hpp"
|
|
|
|
class KmsFactory {
|
|
public:
|
|
using CreatorFunc = std::function<std::unique_ptr<IKmsCore>(const IKmsConfig &)>;
|
|
|
|
static KmsFactory& instance();
|
|
|
|
void registerCreator(const std::string& name, CreatorFunc func);
|
|
|
|
std::unique_ptr<IKmsCore> create(const IKmsConfig& config) const;
|
|
|
|
std::vector<std::string> listRegistered() const;
|
|
|
|
private:
|
|
std::unordered_map<std::string, CreatorFunc> creators_;
|
|
};
|
|
|
|
|
|
#endif // KMS_FACTORY_HPP
|