#include #include #include #include #include "WorkAreaManager.h" #include "rapidcsv.h" CWorkAreaManager& CWorkAreaManager::GetInstance() { static CWorkAreaManager m; return m; } void CWorkAreaManager::LoadCSV(const char* file) { rapidcsv::Document doc("data.csv"); int32_t count= doc.GetRowCount(); std::vector < std::string > name= doc.GetColumn(0); std::vector x = doc.GetColumn(1); std::vector y = doc.GetColumn(2); for (int32_t i = 0; i < count; i++) { std::cout << name[i] << "," << x[i] << "," << y[i] << std::endl; const char* str = name[i].c_str() + 1; int32_t index = std::stod(str)-1; _area[name[i].c_str()[0] - 'A'][index].x = x[i]; _area[name[i].c_str()[0] - 'A'][index].y = y[i]; } for (size_t i = 0; i < count; i++) { std::cout << _area[i]->x << "," << _area[i]->y << std::endl; } } Point& CWorkAreaManager::GetPoint(WorkArea area, int32_t no) { return _area[area][no]; }