summaryrefslogtreecommitdiffhomepage
path: root/src/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/KernelKit/TraceSrv.h4
-rw-r--r--src/kernel/NeKit/Atom.h9
-rw-r--r--src/kernel/NeKit/Function.h17
3 files changed, 19 insertions, 11 deletions
diff --git a/src/kernel/KernelKit/TraceSrv.h b/src/kernel/KernelKit/TraceSrv.h
index 5a9d365c..1118e0d9 100644
--- a/src/kernel/KernelKit/TraceSrv.h
+++ b/src/kernel/KernelKit/TraceSrv.h
@@ -9,7 +9,8 @@
namespace Kernel {
-namespace Detail {
+namespace TraceSrv {
+
inline constexpr auto kDebugCmdLen = 256U;
inline constexpr auto kDebugPort = 51820;
/// \brief Debug Magic Value
@@ -17,6 +18,7 @@ namespace Detail {
inline constexpr auto kDebugVersion = 0x0100;
inline constexpr auto kDebugDelim = ';';
inline constexpr auto kDebugEnd = '\r';
+
} // namespace Detail
} // namespace Kernel
diff --git a/src/kernel/NeKit/Atom.h b/src/kernel/NeKit/Atom.h
index 9d6e9f24..3dedea32 100644
--- a/src/kernel/NeKit/Atom.h
+++ b/src/kernel/NeKit/Atom.h
@@ -1,13 +1,14 @@
-// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org)
+// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org)
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/nekernel-org/nekernel
-#ifndef __NE_KIT_ATOM_H__
-#define __NE_KIT_ATOM_H__
+#ifndef NEKIT_ATOM_H
+#define NEKIT_ATOM_H
#include <NeKit/Config.h>
namespace Kernel {
+
template <class TypeAtomic>
class Atom final {
public:
@@ -24,6 +25,7 @@ class Atom final {
const TypeAtomic& operator[](const SizeT& bit) { return (fArrayOfAtoms & (1 << bit)); }
void operator|(const SizeT& bit) { fArrayOfAtoms |= (1 << bit); }
+
Atom& operator|=(const SizeT& bit) {
this->operator|(bit);
return *this;
@@ -39,6 +41,7 @@ class Atom final {
private:
TypeAtomic fArrayOfAtoms;
};
+
} // namespace Kernel
#endif
diff --git a/src/kernel/NeKit/Function.h b/src/kernel/NeKit/Function.h
index d32c0f46..77d9aa23 100644
--- a/src/kernel/NeKit/Function.h
+++ b/src/kernel/NeKit/Function.h
@@ -1,4 +1,4 @@
-// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org)
+// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org)
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/nekernel-org/nekernel
@@ -9,22 +9,21 @@
#include <NeKit/ErrorOr.h>
namespace Kernel {
-/// ================================================================================
-/// @brief Function wrapper class.
-/// ================================================================================
+
+/// @brief Function Pointer Container.
template <typename T, typename... Args>
class Function final {
public:
Function() = delete;
Function(nullPtr) = delete;
- ~Function() = default;
- explicit Function(T (*Fn)(Args... args)) : fFn(Fn) { MUST_PASS(fFn); }
+ ~Function() = default;
+ Function(T (*Fn)(Args... args)) : fFn(Fn) { MUST_PASS(fFn); }
Function& operator=(const Function&) = delete;
Function(const Function&) = delete;
- T operator()(Args&&... args) { return fFn(args...); }
+ T operator()(Args&&... args) { return fFn(forward<Args...>(args)...); }
explicit operator bool() { return fFn; }
bool operator!() { return !fFn; }
@@ -35,6 +34,10 @@ class Function final {
template <typename T, typename... Args>
using FunctionOr = ErrorOr<Function<T, Args...>>;
+
+template <typename T, typename... Args>
+using FunctionRef = Ref<Function<T, Args...>>;
+
} // namespace Kernel
#endif