blob: 467a5ca319bc64a948c8eb58f7f5bd0022d53a0c [file] [log] [blame]
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +00001#pragma once
2
3#include <nlohmann/json.hpp>
4
5#include <set>
6#include <unordered_map>
7
8using Association = std::tuple<std::string, std::string, std::string>;
9
10class Topology
11{
12 public:
13 explicit Topology() = default;
14
15 void addBoard(const std::string& path, const std::string& boardType,
Matt Spinler6eb60972023-08-14 16:36:20 -050016 const std::string& boardName,
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +000017 const nlohmann::json& exposesItem);
Matt Spinler6eb60972023-08-14 16:36:20 -050018 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 Fairf2f5b7a2022-09-09 19:45:02 +000021
22 private:
23 using Path = std::string;
24 using BoardType = std::string;
Matt Spinler6eb60972023-08-14 16:36:20 -050025 using BoardName = std::string;
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +000026 using PortType = std::string;
27
28 std::unordered_map<PortType, std::vector<Path>> upstreamPorts;
29 std::unordered_map<PortType, std::vector<Path>> downstreamPorts;
Jeff Linb02752f2023-12-01 11:23:54 +080030 std::set<Path> powerPaths;
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +000031 std::unordered_map<Path, BoardType> boardTypes;
Matt Spinler6eb60972023-08-14 16:36:20 -050032 std::unordered_map<BoardName, Path> boardNames;
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +000033};