Benjamin Fair | f2f5b7a | 2022-09-09 19:45:02 +0000 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <nlohmann/json.hpp> |
| 4 | |
| 5 | #include <set> |
| 6 | #include <unordered_map> |
| 7 | |
| 8 | using Association = std::tuple<std::string, std::string, std::string>; |
| 9 | |
| 10 | class Topology |
| 11 | { |
| 12 | public: |
| 13 | explicit Topology() = default; |
| 14 | |
| 15 | void addBoard(const std::string& path, const std::string& boardType, |
Matt Spinler | 6eb6097 | 2023-08-14 16:36:20 -0500 | [diff] [blame] | 16 | const std::string& boardName, |
Benjamin Fair | f2f5b7a | 2022-09-09 19:45:02 +0000 | [diff] [blame] | 17 | const nlohmann::json& exposesItem); |
Matt Spinler | 6eb6097 | 2023-08-14 16:36:20 -0500 | [diff] [blame] | 18 | std::unordered_map<std::string, std::vector<Association>> |
| 19 | getAssocs(const std::map<std::string, std::string>& boards); |
| 20 | void remove(const std::string& boardName); |
Benjamin Fair | f2f5b7a | 2022-09-09 19:45:02 +0000 | [diff] [blame] | 21 | |
| 22 | private: |
| 23 | using Path = std::string; |
| 24 | using BoardType = std::string; |
Matt Spinler | 6eb6097 | 2023-08-14 16:36:20 -0500 | [diff] [blame] | 25 | using BoardName = std::string; |
Benjamin Fair | f2f5b7a | 2022-09-09 19:45:02 +0000 | [diff] [blame] | 26 | using PortType = std::string; |
| 27 | |
| 28 | std::unordered_map<PortType, std::vector<Path>> upstreamPorts; |
| 29 | std::unordered_map<PortType, std::vector<Path>> downstreamPorts; |
Jeff Lin | b02752f | 2023-12-01 11:23:54 +0800 | [diff] [blame] | 30 | std::set<Path> powerPaths; |
Benjamin Fair | f2f5b7a | 2022-09-09 19:45:02 +0000 | [diff] [blame] | 31 | std::unordered_map<Path, BoardType> boardTypes; |
Matt Spinler | 6eb6097 | 2023-08-14 16:36:20 -0500 | [diff] [blame] | 32 | std::unordered_map<BoardName, Path> boardNames; |
Benjamin Fair | f2f5b7a | 2022-09-09 19:45:02 +0000 | [diff] [blame] | 33 | }; |