/** * Copyright 2023, Leon Freist (https://github.com/lfreist) * Author: Leon Freist * * This file is part of hwinfo. */ #pragma once #include #ifdef HWINFO_UNIX #include #include namespace hwinfo { struct PCIDevice { PCIDevice(std::string d_id, std::string d_name); const std::string device_id{}; const std::string device_name{}; std::map subsystems{}; }; struct PCIVendor { PCIVendor(std::string v_id, std::string v_name); const PCIDevice& operator[](const std::string& device_id) const; const std::string vendor_id{}; const std::string vendor_name{}; std::map devices{}; private: PCIDevice _invalid_device{"0000", "invalid"}; }; class PCIMapper { public: explicit PCIMapper(); ~PCIMapper() = default; const PCIVendor& vendor_from_id(const std::string& vendor_id) const; const PCIVendor& operator[](const std::string& vendor_id) const; private: std::map _vendors{}; PCIVendor _invalid_vendor{"0000", "invalid"}; }; struct PCI { static PCIMapper getMapper(); }; } // namespace hwinfo #endif // HWINFO_UNIX