diff options
| author | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-24 09:04:34 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-24 09:04:34 +0100 |
| commit | 917eae9453ecac6d9aeb04254d5d5c97e5a6c9e1 (patch) | |
| tree | 767f6aeabb24f02c119e073e3efd2c710aabed5d /Private/KernelKit/DeviceManager.hpp | |
| parent | 5563deabd8f7ce3fc713ea23f8cf5bbac33b4024 (diff) | |
Kernel: MS-1: Microkernel and bootloader.
Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/KernelKit/DeviceManager.hpp')
| -rw-r--r-- | Private/KernelKit/DeviceManager.hpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/Private/KernelKit/DeviceManager.hpp b/Private/KernelKit/DeviceManager.hpp index 9a689b26..582d1194 100644 --- a/Private/KernelKit/DeviceManager.hpp +++ b/Private/KernelKit/DeviceManager.hpp @@ -24,6 +24,8 @@ #include <NewKit/ErrorOr.hpp> #include <NewKit/Ref.hpp> +#include "NewKit/KernelCheck.hpp" + namespace HCore { template <typename T> class DeviceInterface; @@ -61,10 +63,18 @@ class DeviceInterface { void (*m_In)(T Data); }; +/// +/// +/// @brief Input Output Buffer +/// Used mainly to communicate between hardware. +/// template <typename T> class IOBuf final { public: - explicit IOBuf(T Dat) : m_Data(Dat) {} + explicit IOBuf(T Dat) : m_Data(Dat) { + // at least pass something valid when instancating this struct. + MUST_PASS(Dat); + } IOBuf &operator=(const IOBuf<T> &) = default; IOBuf(const IOBuf<T> &) = default; @@ -72,8 +82,15 @@ class IOBuf final { ~IOBuf() = default; public: - T operator->() const { return m_Data; } - T &operator[](Size index) const { return m_Data[index]; } + template <typename R> + R operator->() const { + return m_Data; + } + + template <typename R> + R &operator[](Size index) const { + return m_Data[index]; + } private: T m_Data; |
