summaryrefslogtreecommitdiffhomepage
path: root/include/ocl
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-12-05 08:41:23 -0500
committerAmlal El Mahrouss <amlal@nekernel.org>2025-12-05 08:41:23 -0500
commit85ee44f72ee2b65656111a6749f3c6cea6ff33e4 (patch)
treeafc85021c5fb8b1e2b98f4737ceb1469a65e4278 /include/ocl
parentc0ff4b289a74d2ce9cb390aaceba4bd5e1d4fd0f (diff)
chore: new version of OCL.Core.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'include/ocl')
-rw-r--r--include/ocl/allocator_op.hpp8
-rw-r--r--include/ocl/crc_hash.hpp10
-rw-r--r--include/ocl/detail/config.hpp24
-rw-r--r--include/ocl/detail/net_config.hpp8
-rw-r--r--include/ocl/is_same.hpp5
-rw-r--r--include/ocl/option.hpp6
-rw-r--r--include/ocl/print.hpp6
-rw-r--r--include/ocl/unique_socket.hpp5
8 files changed, 43 insertions, 29 deletions
diff --git a/include/ocl/allocator_op.hpp b/include/ocl/allocator_op.hpp
index f953391..9092800 100644
--- a/include/ocl/allocator_op.hpp
+++ b/include/ocl/allocator_op.hpp
@@ -1,12 +1,12 @@
/*
* File: allocator_op.hpp
- * Purpose: Allocator System container.
+ * Purpose: Allocator Operations container.
* Author: Amlal El Mahrouss (amlal@nekernel.org)
* Copyright 2025, Amlal El Mahrouss, Licensed under the Boost Software License. Licensed under the BSL 1.0 license
*/
-#ifndef _OCL_ALLOCATOR_SYSTEM_HPP
-#define _OCL_ALLOCATOR_SYSTEM_HPP
+#ifndef __OCL_CORE_ALLOC
+#define __OCL_CORE_ALLOC
#include <ocl/detail/config.hpp>
#include <memory>
@@ -63,4 +63,4 @@ namespace ocl
using allocator = allocator_op<type, global_new_op<type>, global_delete_op<type>>;
} // namespace ocl
-#endif // ifndef _OCL_ALLOCATOR_SYSTEM_HPP \ No newline at end of file
+#endif // ifndef __OCL_CORE_ALLOC \ No newline at end of file
diff --git a/include/ocl/crc_hash.hpp b/include/ocl/crc_hash.hpp
index cbb757f..f0b155c 100644
--- a/include/ocl/crc_hash.hpp
+++ b/include/ocl/crc_hash.hpp
@@ -5,8 +5,8 @@
* Copyright 2025, Amlal El Mahrouss, Licensed under the Boost Software License.
*/
-#ifndef _OCL_CRC32_HPP
-#define _OCL_CRC32_HPP
+#ifndef __OCL_CORE_CRC_HASH
+#define __OCL_CORE_CRC_HASH
#include <ocl/detail/config.hpp>
#include <unordered_map>
@@ -111,10 +111,6 @@ namespace std
}
};
- // Source - https://stackoverflow.com/a/68521441
- // Posted by StoryTeller - Unslander Monica, modified by community. See post 'Timeline' for change history
- // Retrieved 2025-11-30, License - CC BY-SA 4.0
-
template <class Fn, class... ArgTypes>
struct is_invocable_hash : std::bool_constant <
requires(Fn fn, ArgTypes... arg_types)
@@ -124,4 +120,4 @@ namespace std
} // namespace std
-#endif // !_OCL_CRC32_HPP \ No newline at end of file
+#endif // !__OCL_CORE_CRC_HASH \ No newline at end of file
diff --git a/include/ocl/detail/config.hpp b/include/ocl/detail/config.hpp
index c3c01ea..3a85618 100644
--- a/include/ocl/detail/config.hpp
+++ b/include/ocl/detail/config.hpp
@@ -5,7 +5,8 @@
* Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License.
*/
-#pragma once
+#ifndef __OCL_CORE_CONFIG
+#define __OCL_CORE_CONFIG
#include <boost/config.hpp>
#include <boost/core/addressof.hpp>
@@ -15,18 +16,17 @@
#include <boost/container/allocator.hpp>
#include <boost/assert.hpp>
-#include <cassert>
-
-#include <sys/types.h>
-#include <unistd.h>
-
#define OCL_DEPRECATED() [[deprecated]]
#define OCL_DEPRECATED_MSG(MSG) [[deprecated(MSG)]]
+#if 202002L > __cplusplus
+#error !! OCL.Core works with C++20 and greater !!
+#endif
+
#ifdef __cplusplus
#define OCL_DECL extern "C"
/// DLL/Dylib/So specific macro.
-#define OCL_EXPORT_DECL extern "C" BOOST_SYMBOL_EXPORT
+#define OCL_EXPORT_DECL extern "C" __attribute__((visibility("default")))
#else
#define OCL_DECL
#define OCL_EXPORT_DECL
@@ -35,4 +35,14 @@
#ifdef _WIN32
#define OCL_USE_CRLF_ENDINGS 1
#define OCL_WINDOWS 1
+#endif
+
+#ifndef OCL_WINDOWS
+#include <unistd.h>
+#endif
+
+#if OCL_WANTS_PRAGMA_ONCE
+#define OCL_HAS_PRAGMA_ONCE 1
+#endif
+
#endif \ No newline at end of file
diff --git a/include/ocl/detail/net_config.hpp b/include/ocl/detail/net_config.hpp
index d5c116d..671d4ba 100644
--- a/include/ocl/detail/net_config.hpp
+++ b/include/ocl/detail/net_config.hpp
@@ -4,11 +4,11 @@
* Author: Amlal El Mahrouss (amlal@nekernel.org)
* Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License.
*/
-
-#pragma once
+
+#ifndef __OCL_NET_CONFIG
+#define __OCL_NET_CONFIG
#include <stdexcept>
-#include <unistd.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <string>
@@ -18,3 +18,5 @@
#ifdef OCL_WINDOWS
#error !!! "Windows is not supported yet for <unique_socket>" !!!
#endif // OCL_WINDOWS
+
+#endif // __OCL_NET_CONFIG \ No newline at end of file
diff --git a/include/ocl/is_same.hpp b/include/ocl/is_same.hpp
index 3e9e706..de3425e 100644
--- a/include/ocl/is_same.hpp
+++ b/include/ocl/is_same.hpp
@@ -5,7 +5,8 @@
* Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License.
*/
-#pragma once
+#ifndef __OCL_CORE_IS_SAME
+#define __OCL_CORE_IS_SAME
#include <ocl/detail/config.hpp>
@@ -106,3 +107,5 @@ namespace ocl
}
};
} // namespace ocl
+
+#endif \ No newline at end of file
diff --git a/include/ocl/option.hpp b/include/ocl/option.hpp
index 73cef13..e114b43 100644
--- a/include/ocl/option.hpp
+++ b/include/ocl/option.hpp
@@ -4,8 +4,8 @@
* Copyright 2023-2025, Amlal El Mahrouss, Licensed under the Boost Software License
*/
-#ifndef _OCL_OPT_HPP
-#define _OCL_OPT_HPP
+#ifndef __OCL_CORE_OPTION
+#define __OCL_CORE_OPTION
#include <ocl/detail/config.hpp>
#include <utility>
@@ -131,4 +131,4 @@ namespace ocl
}
} // namespace ocl
-#endif /* ifndef _OCL_OPT_HPP */ \ No newline at end of file
+#endif /* ifndef __OCL_CORE_OPTION */ \ No newline at end of file
diff --git a/include/ocl/print.hpp b/include/ocl/print.hpp
index 53c673e..02b3044 100644
--- a/include/ocl/print.hpp
+++ b/include/ocl/print.hpp
@@ -5,8 +5,8 @@
* Copyright 2025, Amlal El Mahrouss, Licensed under the Boost Software License. Licensed under the BSL 1.0 license
*/
-#ifndef _OCL_PRINT_HPP
-#define _OCL_PRINT_HPP
+#ifndef __OCL_CORE_PRINT
+#define __OCL_CORE_PRINT
#include <ocl/detail/config.hpp>
@@ -74,4 +74,4 @@ namespace ocl::io
}
} // namespace ocl::io
-#endif // ifndef _OCL_PRINT_HPP
+#endif // ifndef __OCL_CORE_PRINT
diff --git a/include/ocl/unique_socket.hpp b/include/ocl/unique_socket.hpp
index a8e532e..c5e67cc 100644
--- a/include/ocl/unique_socket.hpp
+++ b/include/ocl/unique_socket.hpp
@@ -5,7 +5,8 @@
* Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License.
*/
-#pragma once
+#ifndef __OCL_CORE_SOCKET
+#define __OCL_CORE_SOCKET
#include <ocl/detail/config.hpp>
#include <ocl/detail/net_config.hpp>
@@ -209,3 +210,5 @@ namespace ocl
{ sock.bad() };
};
} // namespace ocl
+
+#endif \ No newline at end of file