blob: 4ea524665d9d94207161d7a4078df5c41a2a385a [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;
30 std::unordered_map<Path, BoardType> boardTypes;
Matt Spinler6eb60972023-08-14 16:36:20 -050031 std::unordered_map<BoardName, Path> boardNames;
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +000032};