diff options
Diffstat (limited to 'kapi')
| -rw-r--r-- | kapi/kapi/devices/bus.hpp | 2 | ||||
| -rw-r--r-- | kapi/kapi/devices/driver.hpp | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/kapi/kapi/devices/bus.hpp b/kapi/kapi/devices/bus.hpp index 0e654072..10b9c39d 100644 --- a/kapi/kapi/devices/bus.hpp +++ b/kapi/kapi/devices/bus.hpp @@ -50,7 +50,7 @@ namespace kapi::devices //! Enumerate the devices on the bus. //! //! @return true iff. the bus hardware is healthy, false otherwise. - auto virtual enumerate() -> bool; + auto virtual enumerate_old() -> bool; private: kstd::vector<kstd::shared_ptr<device>> m_devices; diff --git a/kapi/kapi/devices/driver.hpp b/kapi/kapi/devices/driver.hpp index fde5068c..254f7977 100644 --- a/kapi/kapi/devices/driver.hpp +++ b/kapi/kapi/devices/driver.hpp @@ -54,6 +54,16 @@ namespace kapi::devices return static_cast<InterfaceType *>(query_interface(InterfaceType::id)); } + //! Retrieve this drivers implementation of a given capability interface. + //! + //! @return A pointer to this drivers implementation of the requested interface, nullptr if this driver does not + //! support the requested interface. + template<typename InterfaceType> + [[nodiscard]] auto as() const -> InterfaceType const * + { + return static_cast<InterfaceType *>(const_cast<driver *>(this)->query_interface(InterfaceType::id)); + } + //! Check if this driver implements a given capability interface. //! //! @return true iff. this driver implements the requested capability interface, false otherwise. |
