1
0
Fork 0
Univerxel/src/client/contouring/index.cpp

26 lines
735 B
C++

#include "index.hpp"
#include "Dummy.hpp"
#include "FlatDualMC.hpp"
namespace contouring {
int idxByName(const std::string& name) {
for (size_t i = 0; i < names.size(); i++) {
if(name == names[i])
return (int)i;
}
return 0;
}
std::shared_ptr<Abstract> load(int idx, const std::map<std::string, std::string>& data) {
switch (idx) {
case 2:
return std::make_shared<Dummy>();
default:
return std::make_shared<FlatDualMC>(data.at(names[0]));
}
}
void save(int idx, std::shared_ptr<Abstract>& ct, std::map<std::string, std::string>& data) {
data.insert_or_assign(names[idx], ct->getOptions());
}
}