vecmem 1.14.0
Loading...
Searching...
No Matches
data.hpp
1/* VecMem project, part of the ACTS project (R&D line)
2 *
3 * (c) 2023 CERN for the benefit of the ACTS project
4 *
5 * Mozilla Public License Version 2.0
6 */
7#pragma once
8
9// Local include(s).
10#include "vecmem/edm/details/data_traits.hpp"
11#include "vecmem/edm/details/schema_traits.hpp"
12#include "vecmem/edm/schema.hpp"
13#include "vecmem/edm/view.hpp"
14#include "vecmem/memory/memory_resource.hpp"
15#include "vecmem/utils/types.hpp"
16
17// System include(s).
18#include <tuple>
19
20namespace vecmem {
21namespace edm {
22
24template <typename T>
25class data;
26
42template <typename... VARTYPES>
43class data<schema<VARTYPES...>> : public view<schema<VARTYPES...>> {
44
45public:
51 using size_type = typename view_type::size_type;
54 using tuple_type =
55 std::tuple<typename details::data_type<VARTYPES>::type...>;
56
59
61 data() = default;
63 data(data&&) = default;
64
66 data& operator=(data&&) = default;
67
73 VECMEM_HOST
74 data(size_type size, memory_resource& resource);
75
77
80
82 VECMEM_HOST
85 VECMEM_HOST
86 const tuple_type& variables() const;
87
89
90private:
92 tuple_type m_data;
93
94}; // class data
95
96} // namespace edm
97
104template <typename... VARTYPES>
105VECMEM_HOST edm::view<edm::schema<VARTYPES...>>& get_data(
107
114template <typename... VARTYPES>
115VECMEM_HOST edm::view<edm::details::add_const_t<edm::schema<VARTYPES...>>>
117
118} // namespace vecmem
119
120// Include the implementation.
121#include "vecmem/edm/impl/data.ipp"
VECMEM_HOST const tuple_type & variables() const
Direct (const) access to the underlying tuple of data objects.
data()=default
Default constructor.
data(data &&)=default
Move constructor.
data & operator=(data &&)=default
Move assignment operator.
typename view_type::size_type size_type
Size type used for the container.
Definition data.hpp:51
VECMEM_HOST tuple_type & variables()
Direct (non-const) access to the underlying tuple of data objects.
std::tuple< typename details::data_type< VARTYPES >::type... > tuple_type
The tuple type holding all of the data objects for the individual variables.
Definition data.hpp:55
VECMEM_HOST data(size_type size, memory_resource &resource)
Constructor for the data object.
schema< VARTYPES... > schema_type
The schema describing the buffer's payload.
Definition data.hpp:47
Technical base type for data<schema<VARTYPES...>>
Definition data.hpp:25
Technical base type for view<schema<VARTYPES...>>
Definition view.hpp:28
Main namespace for the vecmem classes/functions.
Definition atomic_ref.hpp:16
std::vector< T, vecmem::polymorphic_allocator< T > > vector
Alias type for vectors with our polymorphic allocator.
Definition vector.hpp:35
VECMEM_HOST data::vector_view< T > get_data(array< T, N > &a)
Helper function creating a vecmem::data::vector_view object.
Definition array.ipp:217
Meta type describing the "schema" of an SoA container.
Definition schema.hpp:46