/** * File: GenFactory.hh * Copyright (C) 2025 Tyler Triplett * License: GNU GPL 3.0 or later <https://www.gnu.org/licenses/gpl-3.0.html> * * This is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef GEN_FACTORY_HH #define GEN_FACTORY_HH #include <pch.hh> #include <generators/BaseGen.hh> #include <unordered_map> #include <memory> namespace ty { class GenFactory { private: using genFn = std::function<std::shared_ptr<BaseGen>(const int& w, const int& h)>; std::unordered_map<std::string, genFn> genMap_; template <typename T> void addGen(const std::string& type); public: GenFactory(); ~GenFactory(); GenFactory(const GenFactory&) = delete; std::shared_ptr<BaseGen> create(const std::string& type, const int& w, const int& h) const; }; } /// ty #include <generators/GenFactory.tt> #endif /// GEN_FACTORY_HH