summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-12-24 19:26:16 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-12-24 19:26:16 +0100
commitc5522b589b8fae4904e2e84d9bd68e2e3e059fca (patch)
tree28cf29350578b149837a95785db73fe1c37534b3
parente476868bdc27ef0e36fc2485606634e7cf2ee00d (diff)
feat: library improvements.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
-rw-r--r--include/ocl/allocator_op.hpp2
-rw-r--r--include/ocl/detail/config.hpp2
-rw-r--r--include/ocl/tracked_ptr.hpp18
3 files changed, 13 insertions, 9 deletions
diff --git a/include/ocl/allocator_op.hpp b/include/ocl/allocator_op.hpp
index f40001f..00a1cd2 100644
--- a/include/ocl/allocator_op.hpp
+++ b/include/ocl/allocator_op.hpp
@@ -41,7 +41,7 @@ namespace ocl
template <typename type>
struct global_array_delete_op final
{
- using pointer_type = type*;
+ using pointer_type = type*;
using const_pointer_type = const type*;
auto operator()(pointer_type t) -> void
diff --git a/include/ocl/detail/config.hpp b/include/ocl/detail/config.hpp
index 16a74ac..9afbc22 100644
--- a/include/ocl/detail/config.hpp
+++ b/include/ocl/detail/config.hpp
@@ -55,6 +55,7 @@
namespace ocl
{
+
namespace detail
{
inline void throw_runtime_error(const boost::string_view& loc = BOOST_CURRENT_LOCATION.to_string())
@@ -62,6 +63,7 @@ namespace ocl
throw std::runtime_error(loc.to_string());
}
} // namespace detail
+
} // namespace ocl
#endif
diff --git a/include/ocl/tracked_ptr.hpp b/include/ocl/tracked_ptr.hpp
index c43276d..aace5d8 100644
--- a/include/ocl/tracked_ptr.hpp
+++ b/include/ocl/tracked_ptr.hpp
@@ -134,8 +134,11 @@ namespace ocl
tracked_ptr& operator=(const tracked_ptr&) = delete;
public:
- using pointer_type = Type*;
- using type = Type;
+ using pointer_type = Type*;
+ using type = Type;
+ using reference_type = Type&;
+ using const_reference_type = const Type&;
+ using manager_type = tracked_mgr<Type>;
void reset()
{
@@ -181,7 +184,6 @@ namespace ocl
{
if (this != &other)
{
- this->reset();
ptr_ = other.ptr_;
other.ptr_ = nullptr;
}
@@ -199,10 +201,10 @@ namespace ocl
return tracked_ptr<Type>();
}
- template <typename U, typename... Type>
- inline auto make_tracked(Type&&... arg) -> tracked_ptr<U>
+ template <typename RetType, typename... Type>
+ inline auto make_tracked(Type&&... arg) -> tracked_ptr<RetType>
{
- return tracked_ptr<U>(std::forward<Type>(arg)...);
+ return tracked_ptr<RetType>(std::forward<Type>(arg)...);
}
template <typename Type>
@@ -221,9 +223,9 @@ namespace ocl
}
} // namespace detail
- /// @brief a Must Pass function is a standard way to verify a container' validity, inspired from NeKernel/VMKernel.
+ /// @brief This function is a standard way to verify a container' validity, inspired from NeKernel/VMKernel.
template <typename Type>
- inline void must_pass(tracked_ptr<Type>& ptr)
+ inline void try_throw(tracked_ptr<Type>& ptr)
{
if (ptr.manager().allocator().allocated_count_ < ptr.manager().allocator().deallocated_count_)
{