summaryrefslogtreecommitdiffhomepage
path: root/dev/Usr/LibCF
diff options
context:
space:
mode:
Diffstat (limited to 'dev/Usr/LibCF')
-rw-r--r--dev/Usr/LibCF/Atom.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/dev/Usr/LibCF/Atom.h b/dev/Usr/LibCF/Atom.h
new file mode 100644
index 00000000..9dde247e
--- /dev/null
+++ b/dev/Usr/LibCF/Atom.h
@@ -0,0 +1,47 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+#pragma once
+
+#include <LibCF/Core.h>
+
+namespace LibCF
+{
+ template <typename T>
+ class CFAtom final
+ {
+ public:
+ explicit CFAtom() = default;
+ ~CFAtom() = default;
+
+ public:
+ CFAtom& operator=(const CFAtom&) = delete;
+ CFAtom(const CFAtom&) = delete;
+
+ public:
+ T operator[](SizeT bit)
+ {
+ return (fArrayOfAtoms & (1 << bit));
+ }
+
+ void operator|(SizeT bit)
+ {
+ fArrayOfAtoms |= (1 << bit);
+ }
+
+ friend Boolean operator==(CFAtom<T>& atomic, const T& idx)
+ {
+ return atomic[idx] == idx;
+ }
+
+ friend Boolean operator!=(CFAtom<T>& atomic, const T& idx)
+ {
+ return atomic[idx] == idx;
+ }
+
+ private:
+ T fArrayOfAtoms;
+ };
+} // namespace LibCF