From b486b794abaf35b0b2376662173eb07549252cfc Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Sat, 25 Jul 2026 23:39:23 +0200 Subject: kapi: introduce the "bus" facet --- kapi/kapi/devices/bus.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'kapi') diff --git a/kapi/kapi/devices/bus.hpp b/kapi/kapi/devices/bus.hpp index af9f2c33..2a306031 100644 --- a/kapi/kapi/devices/bus.hpp +++ b/kapi/kapi/devices/bus.hpp @@ -4,6 +4,7 @@ // IWYU pragma: private, include #include +#include #include #include @@ -21,6 +22,9 @@ namespace kapi::devices //! A bus device that represents a logical/physical tree of devices and busses. struct bus : device { + //! The id of the bus facet. + constexpr auto static id = interface_id{"bus"}; + //! Construct a bus with the given name. //! //! @param name The name of the bus. @@ -33,6 +37,9 @@ namespace kapi::devices //! @param child The child device to attach. auto add_child(kstd::shared_ptr child) -> void; + //! Get the children attached to this bus. + //! + //! @return A vector of all children attached to this bus. [[nodiscard]] auto children() const -> std::span const>; //! Get this bus's protocol facet, if present. @@ -40,6 +47,10 @@ namespace kapi::devices //! @return this bus's protocol facet if it has one, nullptr otherwise. [[nodiscard]] virtual auto protocol() -> struct bus_protocol *; + protected: + //! All busses have the "bus" facet. + auto query_interface(interface_id interface) -> void * override; + private: kstd::vector> m_devices; }; -- cgit v1.2.3