diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-06-03 09:31:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-03 09:31:01 +0200 |
| commit | 6511afbf405c31513bc88ab06bca58218610a994 (patch) | |
| tree | e2509b7f9b59643b2a97773604aa383a2fd2e2f3 /dev/kernel/KernelKit/DeviceMgr.h | |
| parent | 5c0bb7ee7b1b0fee02cc179fb21f4c57a61d6c2d (diff) | |
| parent | bebcbe04c2b47b3b4fcdc093b1736cc0295109fe (diff) | |
Merge pull request #36 from nekernel-org/dev
0.0.3 — NeKernel
Diffstat (limited to 'dev/kernel/KernelKit/DeviceMgr.h')
| -rw-r--r-- | dev/kernel/KernelKit/DeviceMgr.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/dev/kernel/KernelKit/DeviceMgr.h b/dev/kernel/KernelKit/DeviceMgr.h index 7c7b9da3..c6467190 100644 --- a/dev/kernel/KernelKit/DeviceMgr.h +++ b/dev/kernel/KernelKit/DeviceMgr.h @@ -24,13 +24,13 @@ #define kDeviceMgrRootDirPath "/devices/" -#define NE_DEVICE : public ::Kernel::IDeviceObject +#define NE_DEVICE : public ::Kernel::DeviceInterface // Last Rev: Wed, May 27, 2025 6:22 PM namespace Kernel { template <typename T> -class IDeviceObject; +class DeviceInterface; template <typename T> class IOBuf; @@ -39,24 +39,26 @@ class IOBuf; /// @brief Device contract interface, represents an HW device. /***********************************************************************************/ template <typename T> -class IDeviceObject { +class DeviceInterface { public: - explicit IDeviceObject(void (*Out)(IDeviceObject<T>*, T), void (*In)(IDeviceObject<T>*, T)) + DeviceInterface() = default; + + explicit DeviceInterface(void (*Out)(DeviceInterface<T>*, T), void (*In)(DeviceInterface<T>*, T)) : fOut(Out), fIn(In) {} - virtual ~IDeviceObject() = default; + virtual ~DeviceInterface() = default; public: - IDeviceObject& operator=(const IDeviceObject<T>&) = default; - IDeviceObject(const IDeviceObject<T>&) = default; + DeviceInterface& operator=(const DeviceInterface<T>&) = default; + DeviceInterface(const DeviceInterface<T>&) = default; public: - virtual IDeviceObject<T>& operator<<(T Data) { + virtual DeviceInterface<T>& operator<<(T Data) { fOut(this, Data); return *this; } - virtual IDeviceObject<T>& operator>>(T Data) { + virtual DeviceInterface<T>& operator>>(T Data) { fIn(this, Data); return *this; } @@ -68,8 +70,8 @@ class IDeviceObject { Bool operator!() { return !fOut || !fIn; } protected: - Void (*fOut)(IDeviceObject<T>*, T Data) = {nullptr}; - Void (*fIn)(IDeviceObject<T>*, T Data) = {nullptr}; + Void (*fOut)(DeviceInterface<T>*, T Data) = {nullptr}; + Void (*fIn)(DeviceInterface<T>*, T Data) = {nullptr}; }; /// |
