NeKernel dev
Loading...
Searching...
No Matches
Vet.h
Go to the documentation of this file.
1
2/* ========================================
3
4 Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.
5
6======================================== */
7
8#pragma once
9
11#include <NeKit/Config.h>
12
13#define NE_VETTABLE : public IVet
14
15namespace Kernel {
17struct IVet {
18 IVet() = default;
19 virtual ~IVet() = default;
20
22
23
24 auto DoVet() const { return false; }
25};
26
27template <typename T>
28struct Vettable final {
29 static constexpr bool kValue = false;
30};
31
32template <>
33struct Vettable<IVet> final {
34 static constexpr bool kValue = true;
35};
36
38template <typename T, typename Fallback>
39concept IVettable = requires(IVet vettable, Fallback fallback) {
40 { Vettable<T>::kValue ? vettable.DoVet() : fallback(vettable) };
41};
42} // namespace Kernel
#define NE_COPY_DEFAULT(KLASS)
Definition Detail.h:17
Concept version of Vettable.
Definition Vet.h:39
UPS inline definitions.
Definition Device.h:12
Vet interface for objects.
Definition Vet.h:17
IVet()=default
virtual ~IVet()=default
auto DoVet() const
Start vetting object for validity.
Definition Vet.h:24
static constexpr bool kValue
Definition Vet.h:34
Definition Vet.h:28
static constexpr bool kValue
Definition Vet.h:29