#ifndef INMOST_SOLVERFACTORY_H #define INMOST_SOLVERFACTORY_H #include namespace INMOST { struct SolverBaseFactory { virtual SolverInterface* create() = 0; virtual SolverInterface* copy(const SolverInterface* other) = 0; virtual ~SolverBaseFactory() {}; }; template struct SolverCreateFactory : SolverBaseFactory { SolverInterface *create() { return new C; }; SolverInterface *copy(const SolverInterface* other) { return new C(other); }; }; class SolverFactory { private: static std::map solvers; public: template static void registerSolver(std::string name) { solvers.insert(std::make_pair(name, new SolverCreateFactory)); }; static SolverInterface *getSolver(std::string name); static SolverInterface *copySolver(const SolverInterface *other); static std::vector getAvailableSolvers(); static bool isSolverAvailable(std::string name); }; } #endif //INMOST_SOLVERFACTORY_H