vecmem 1.14.0
Loading...
Searching...
No Matches
proxy.ipp
1/* VecMem project, part of the ACTS project (R&D line)
2 *
3 * (c) 2024-2025 CERN for the benefit of the ACTS project
4 *
5 * Mozilla Public License Version 2.0
6 */
7#pragma once
8
9namespace vecmem {
10namespace edm {
11
12template <typename... VARTYPES, details::proxy_domain PDOMAIN,
13 details::proxy_access PACCESS, details::proxy_type PTYPE>
14template <typename PARENT>
15VECMEM_HOST_AND_DEVICE proxy<schema<VARTYPES...>, PDOMAIN, PACCESS,
16 PTYPE>::proxy(PARENT& parent,
17 typename PARENT::size_type index)
18 : m_data{details::proxy_data_creator<schema<VARTYPES...>, PDOMAIN, PACCESS,
19 PTYPE>::make(index, parent)} {
20
21 static_assert(PACCESS == details::proxy_access::non_constant,
22 "This constructor is meant for non-const proxies.");
23}
24
25template <typename... VARTYPES, details::proxy_domain PDOMAIN,
26 details::proxy_access PACCESS, details::proxy_type PTYPE>
27template <typename PARENT>
28VECMEM_HOST_AND_DEVICE proxy<schema<VARTYPES...>, PDOMAIN, PACCESS,
29 PTYPE>::proxy(const PARENT& parent,
30 typename PARENT::size_type index)
31 : m_data{details::proxy_data_creator<schema<VARTYPES...>, PDOMAIN, PACCESS,
32 PTYPE>::make(index, parent)} {
33
34 static_assert(PACCESS == details::proxy_access::constant,
35 "This constructor is meant for constant proxies.");
36}
37
38template <typename... VARTYPES, details::proxy_domain PDOMAIN,
39 details::proxy_access PACCESS, details::proxy_type PTYPE>
40template <typename... OVARTYPES, details::proxy_domain OPDOMAIN,
41 details::proxy_access OPACCESS, details::proxy_type OPTYPE>
42VECMEM_HOST_AND_DEVICE
45 : m_data(other.variables()) {}
46
47template <typename... VARTYPES, details::proxy_domain PDOMAIN,
48 details::proxy_access PACCESS, details::proxy_type PTYPE>
49VECMEM_HOST_AND_DEVICE
51 typename details::proxy_var_type<VARTYPES, proxy_domain, access_type,
52 proxy_type>::type... data)
53 : m_data(data...) {}
54
55template <typename... VARTYPES, details::proxy_domain PDOMAIN,
56 details::proxy_access PACCESS, details::proxy_type PTYPE>
57VECMEM_HOST_AND_DEVICE proxy<schema<VARTYPES...>, PDOMAIN, PACCESS, PTYPE>&
59 const proxy& other) {
60
61 if (this != &other) {
62 m_data = other.variables();
63 }
64 return *this;
65}
66
67template <typename... VARTYPES, details::proxy_domain PDOMAIN,
68 details::proxy_access PACCESS, details::proxy_type PTYPE>
69template <typename... OVARTYPES, details::proxy_domain OPDOMAIN,
70 details::proxy_access OPACCESS, details::proxy_type OPTYPE>
71VECMEM_HOST_AND_DEVICE proxy<schema<VARTYPES...>, PDOMAIN, PACCESS, PTYPE>&
74
75 m_data = other.variables();
76 return *this;
77}
78
79template <typename... VARTYPES, details::proxy_domain PDOMAIN,
80 details::proxy_access PACCESS, details::proxy_type PTYPE>
81template <std::size_t INDEX>
82VECMEM_HOST_AND_DEVICE
84 VARTYPES...>::return_type
86
87 return vecmem::get<INDEX>(m_data);
88}
89
90template <typename... VARTYPES, details::proxy_domain PDOMAIN,
91 details::proxy_access PACCESS, details::proxy_type PTYPE>
92template <std::size_t INDEX>
93VECMEM_HOST_AND_DEVICE
95 VARTYPES...>::const_return_type
97
98 return vecmem::get<INDEX>(m_data);
99}
100
101template <typename... VARTYPES, details::proxy_domain PDOMAIN,
102 details::proxy_access PACCESS, details::proxy_type PTYPE>
103VECMEM_HOST_AND_DEVICE auto
105 -> const tuple_type& {
106
107 return m_data;
108}
109
110template <typename... VARTYPES, details::proxy_domain PDOMAIN,
111 details::proxy_access PACCESS, details::proxy_type PTYPE>
112VECMEM_HOST_AND_DEVICE auto
114 -> tuple_type& {
115
116 return m_data;
117}
118
119} // namespace edm
120} // namespace vecmem
Technical base type for data<schema<VARTYPES...>>
Definition data.hpp:25
Technical base type for proxy<schema<VARTYPES...>,PDOMAIN,PACCESS,PTYPE>
Definition proxy.hpp:21
Main namespace for the vecmem classes/functions.
Definition atomic_ref.hpp:16
VECMEM_HOST_AND_DEVICE constexpr const auto & get(const tuple< Ts... > &t) noexcept
Get a constant element out of a tuple.
Definition tuple.ipp:58
std::vector< T, vecmem::polymorphic_allocator< T > > vector
Alias type for vectors with our polymorphic allocator.
Definition vector.hpp:35
Proxy types for one element of a type pack.
Definition proxy_traits.hpp:301
Technical base class for the proxy_var_type traits.
Definition proxy_traits.hpp:57
Meta type describing the "schema" of an SoA container.
Definition schema.hpp:46