123456789101112131415161718192021222324252627 |
- #ifndef READER_H
- #define READER_H
- #include <string>
- #include <unordered_map>
- #include <vector>
- class Reader final {
- int ids = 0;
- std::unordered_map<std::string, int> nameToId;
- std::vector<std::string> names;
- std::vector<std::vector<int>> distances;
- public:
- bool read(const char* path);
- void print() const;
- const std::string& getName(int id);
- const std::vector<int>& operator[](int x) const;
- int getSize() const;
- private:
- int getOrAddId(const std::string& s);
- std::string trim(const std::string& s) const;
- void distance(int column);
- };
- #endif
|