diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-16 10:05:50 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-16 10:08:17 +0100 |
| commit | c258c2e5fa9f5134dbc56f717ba37231a08a9081 (patch) | |
| tree | b2a2fd77e4672aa605fa3755e165fd16a93b53a5 /src/kernel/NeKit/Domain.h | |
| parent | 3f7d7c7b64e4d731143f0d82cd52ded5c2fb091f (diff) | |
chore: kernel improvements and tweaks on the kernel.
- Two default domains:
- Computable domain, alias: Domain<T>.
- Non-Computable domain, alias: NullDomain.
- DiskSwap API improvements.
- Vettable Now returns the Result object instead of its value.
- Kernel shall not panic when `ptr_new` returns null.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src/kernel/NeKit/Domain.h')
| -rw-r--r-- | src/kernel/NeKit/Domain.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/kernel/NeKit/Domain.h b/src/kernel/NeKit/Domain.h new file mode 100644 index 00000000..cda63ee9 --- /dev/null +++ b/src/kernel/NeKit/Domain.h @@ -0,0 +1,37 @@ +/* ======================================== + + Copyright (C) 2025, Amlal El Mahrouss, licensed under the Apache 2.0 license. + +======================================== */ + +#ifndef __NE_KIT_DOMAIN_H__ +#define __NE_KIT_DOMAIN_H__ + +#include <NeKit/Config.h> + +namespace Kernel { +template <class Type> +struct IsDefined final { + using ResultType = Type; + using ResultTypeRef = Type&; + + static constexpr bool kValue = true; +}; + +template <> +struct IsDefined<nullPtr> final { + static constexpr bool kValue = false; +}; + +using NullDomain = IsDefined<nullPtr>; + +template <class Type> +using Domain = IsDefined<Type>; + +template <class Type> +concept IsAcceptable = requires() { + { IsDefined<Type>::kValue }; +}; +} // namespace Kernel + +#endif // !__NE_KIT_DOMAIN_H__
\ No newline at end of file |
