26 lines
751 B
C++
26 lines
751 B
C++
|
#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());
|
||
|
}
|
||
|
}
|