1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#pragma once
#include <functional>
#include <memory>
#include <string>
#include <unordered_map>
#include <tao/config/value.hpp>
struct workload_simulator {
virtual ~workload_simulator() = default;
virtual void simulate() = 0;
};
class workload_factory {
public:
workload_factory();
std::shared_ptr<workload_simulator> operator()(const tao::config::value& config);
using builder = std::function<std::shared_ptr<workload_simulator>(const tao::config::value&)>;
void register_workload(std::string type, builder func);
private:
std::unordered_map<std::string, builder> _builders;
};
|