diff options
Diffstat (limited to 'kapi')
| -rw-r--r-- | kapi/kapi/devices/bus.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/kapi/kapi/devices/bus.hpp b/kapi/kapi/devices/bus.hpp index 26b46830..13951e46 100644 --- a/kapi/kapi/devices/bus.hpp +++ b/kapi/kapi/devices/bus.hpp @@ -37,6 +37,9 @@ namespace kapi::devices //! @param protocol The bus protocol to use. bus(kstd::string const & name, bus_protocol & protocol); + //! Tear down this bus recursively. + ~bus() override; + //! Attach a child device to this bus. //! //! Whenever a device is attached to a bus, the bus takes sole ownership of the device. @@ -44,6 +47,12 @@ namespace kapi::devices //! @param child The child device to attach. auto add_child(kstd::shared_ptr<device> child) -> void; + //! Detach a child device from this bus and tear it down. + //! + //! @param child The device to detach. + //! @return true iff. the child was found an removed, false otherwise. + auto remove_child(device & child) -> bool; + //! Get the children attached to this bus. //! //! @return A vector of all children attached to this bus. @@ -54,6 +63,8 @@ namespace kapi::devices auto query_facet(kapi::capabilities::facet_id facet) -> void * override; private: + auto do_remove_child(device & child) -> void; + bus_protocol * m_protocol{}; kstd::vector<kstd::shared_ptr<device>> m_devices{}; }; |
