vecmem 1.26.0
Loading...
Searching...
No Matches
async_sizes.ipp
1/*
2 * VecMem project, part of the ACTS project (R&D line)
3 *
4 * (c) 2025-2026 CERN for the benefit of the ACTS project
5 *
6 * Mozilla Public License Version 2.0
7 */
8#pragma once
9
10// System includes.
11#include <cassert>
12
13namespace vecmem {
14
15template <typename SIZE_TYPE>
18
19template <typename SIZE_TYPE>
21
22 // Wait for the event to complete before accessing the value
23 m_event->wait();
24 return m_sizes;
25}
26
27template <typename SIZE_TYPE>
29
30 // Access the value assuming the event is complete
31 assert(m_event->is_ready());
32 m_event->ignore();
33 return m_sizes;
34}
35
36template <typename SIZE_TYPE>
38
39 m_event->wait();
40}
41
42template <typename SIZE_TYPE>
44
45 return m_event->is_ready();
46}
47
48template <typename SIZE_TYPE>
50
51 m_event->ignore();
52}
53
54} // namespace vecmem
An allocator class that wraps a memory resource.
Definition allocator.hpp:37
bool is_ready() const override
Function checking whether the event is complete without blocking.
Definition async_sizes.ipp:43
async_sizes(storage_type &&sizes, event_type event)
Constructor taking ownership of a size and event.
Definition async_sizes.ipp:16
std::add_lvalue_reference_t< std::add_const_t< storage_type > > const_reference
Constant (lvalue) reference to the stored size.
Definition async_sizes.hpp:34
void wait() override
Function that would block the current thread until the event is complete.
Definition async_sizes.ipp:37
std::unique_ptr< abstract_event > event_type
Type of the held event.
Definition async_sizes.hpp:36
void ignore() override
Function telling the object not to wait for the underlying event.
Definition async_sizes.ipp:49
const_reference get() const
Access the async/future value.
Definition async_sizes.ipp:20
vector< size_type > storage_type
Underlying type that stores the size variables on the heap.
Definition async_sizes.hpp:31
const_reference unsafe_get() const
Access the async/future value without waiting for completion Completion must be ensured by the user.
Definition async_sizes.ipp:28
Main namespace for the vecmem classes/functions.
Definition atomic_ref.hpp:16