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

26 lines
751 B
C++
Raw Normal View History

2020-07-22 20:55:13 +00:00
#include "index.hpp"
#include "Dummy.hpp"
#include "FlatSurroundingBox.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 1:
return std::make_shared<Dummy>();
default:
return std::make_shared<FlatSurroundingBox>(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());
}
}