30 lines
862 B
C++
30 lines
862 B
C++
#include "index.hpp"
|
|
#include "Dummy.hpp"
|
|
#include "FlatSurroundingBox.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>();
|
|
|
|
case 1:
|
|
return std::make_shared<FlatSurroundingBox>(data.at(names[1]));
|
|
|
|
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());
|
|
}
|
|
} |