17
17
#include " vecmem/edm/view.hpp"
18
18
#include " vecmem/memory/memory_resource.hpp"
19
19
#include " vecmem/utils/abstract_event.hpp"
20
+ #include " vecmem/utils/attributes.hpp"
20
21
#include " vecmem/vecmem_core_export.hpp"
21
22
22
23
// System include(s).
@@ -75,11 +76,12 @@ class VECMEM_CORE_EXPORT copy {
75
76
76
77
// / Set up the internal state of a vector buffer correctly on a device
77
78
template <typename TYPE>
78
- event_type setup (data::vector_view<TYPE> data) const ;
79
+ VECMEM_NODISCARD event_type setup (data::vector_view<TYPE> data) const ;
79
80
80
81
// / Set all bytes of the vector to some value
81
82
template <typename TYPE>
82
- event_type memset (data::vector_view<TYPE> data, int value) const ;
83
+ VECMEM_NODISCARD event_type memset (data::vector_view<TYPE> data,
84
+ int value) const ;
83
85
84
86
// / Copy a 1-dimensional vector to the specified memory resource
85
87
template <typename TYPE>
@@ -89,15 +91,17 @@ class VECMEM_CORE_EXPORT copy {
89
91
90
92
// / Copy a 1-dimensional vector's data between two existing memory blocks
91
93
template <typename TYPE>
92
- event_type operator ()(const data::vector_view<std::add_const_t <TYPE>>& from,
93
- data::vector_view<TYPE> to,
94
- type::copy_type cptype = type::unknown) const ;
94
+ VECMEM_NODISCARD event_type
95
+ operator ()(const data::vector_view<std::add_const_t <TYPE>>& from,
96
+ data::vector_view<TYPE> to,
97
+ type::copy_type cptype = type::unknown) const ;
95
98
96
99
// / Copy a 1-dimensional vector's data into a vector object
97
100
template <typename TYPE, typename ALLOC>
98
- event_type operator ()(const data::vector_view<std::add_const_t <TYPE>>& from,
99
- std::vector<TYPE, ALLOC>& to,
100
- type::copy_type cptype = type::unknown) const ;
101
+ VECMEM_NODISCARD event_type
102
+ operator ()(const data::vector_view<std::add_const_t <TYPE>>& from,
103
+ std::vector<TYPE, ALLOC>& to,
104
+ type::copy_type cptype = type::unknown) const ;
101
105
102
106
// / Helper function for getting the size of a resizable 1D buffer
103
107
template <typename TYPE>
@@ -111,11 +115,13 @@ class VECMEM_CORE_EXPORT copy {
111
115
112
116
// / Copy the internal state of a jagged vector buffer to the target device
113
117
template <typename TYPE>
114
- event_type setup (data::jagged_vector_view<TYPE> data) const ;
118
+ VECMEM_NODISCARD event_type
119
+ setup (data::jagged_vector_view<TYPE> data) const ;
115
120
116
121
// / Set all bytes of the jagged vector to some value
117
122
template <typename TYPE>
118
- event_type memset (data::jagged_vector_view<TYPE> data, int value) const ;
123
+ VECMEM_NODISCARD event_type memset (data::jagged_vector_view<TYPE> data,
124
+ int value) const ;
119
125
120
126
// / Copy a jagged vector to the specified memory resource
121
127
template <typename TYPE>
@@ -126,17 +132,17 @@ class VECMEM_CORE_EXPORT copy {
126
132
127
133
// / Copy a jagged vector's data between two existing allocations
128
134
template <typename TYPE>
129
- event_type operator ()(
130
- const data::jagged_vector_view<std::add_const_t <TYPE>>& from,
131
- data::jagged_vector_view<TYPE> to,
132
- type::copy_type cptype = type::unknown) const ;
135
+ VECMEM_NODISCARD event_type
136
+ operator ()( const data::jagged_vector_view<std::add_const_t <TYPE>>& from,
137
+ data::jagged_vector_view<TYPE> to,
138
+ type::copy_type cptype = type::unknown) const ;
133
139
134
140
// / Copy a jagged vector's data into a vector object
135
141
template <typename TYPE, typename ALLOC1, typename ALLOC2>
136
- event_type operator ()(
137
- const data::jagged_vector_view<std::add_const_t <TYPE>>& from,
138
- std::vector<std::vector<TYPE, ALLOC2>, ALLOC1>& to,
139
- type::copy_type cptype = type::unknown) const ;
142
+ VECMEM_NODISCARD event_type
143
+ operator ()( const data::jagged_vector_view<std::add_const_t <TYPE>>& from,
144
+ std::vector<std::vector<TYPE, ALLOC2>, ALLOC1>& to,
145
+ type::copy_type cptype = type::unknown) const ;
140
146
141
147
// / Helper function for getting the sizes of a resizable jagged vector
142
148
template <typename TYPE>
@@ -145,7 +151,7 @@ class VECMEM_CORE_EXPORT copy {
145
151
146
152
// / Helper function for setting the sizes of a resizable jagged vector
147
153
template <typename TYPE>
148
- event_type set_sizes (
154
+ VECMEM_NODISCARD event_type set_sizes (
149
155
const std::vector<typename data::vector_view<TYPE>::size_type>& sizes,
150
156
data::jagged_vector_view<TYPE> data) const ;
151
157
@@ -156,24 +162,24 @@ class VECMEM_CORE_EXPORT copy {
156
162
157
163
// / Set up the internal state of a buffer correctly on a device
158
164
template <typename SCHEMA>
159
- event_type setup (edm::view<SCHEMA> data) const ;
165
+ VECMEM_NODISCARD event_type setup (edm::view<SCHEMA> data) const ;
160
166
161
167
// / Set all bytes of the container to some value
162
168
template <typename ... VARTYPES>
163
- event_type memset (edm::view<edm::schema<VARTYPES...>> data,
164
- int value) const ;
169
+ VECMEM_NODISCARD event_type memset (edm::view<edm::schema<VARTYPES...>> data,
170
+ int value) const ;
165
171
166
172
// / Copy between two views
167
173
template <typename ... VARTYPES>
168
- event_type operator ()(
174
+ VECMEM_NODISCARD event_type operator ()(
169
175
const edm::view<edm::details::add_const_t <edm::schema<VARTYPES...>>>&
170
176
from,
171
177
edm::view<edm::schema<VARTYPES...>> to,
172
178
type::copy_type cptype = type::unknown) const ;
173
179
174
180
// / Copy from a view, into a host container
175
181
template <typename ... VARTYPES, template <typename > class INTERFACE >
176
- event_type operator ()(
182
+ VECMEM_NODISCARD event_type operator ()(
177
183
const edm::view<edm::details::add_const_t <edm::schema<VARTYPES...>>>&
178
184
from,
179
185
edm::host<edm::schema<VARTYPES...>, INTERFACE>& to,
@@ -193,7 +199,7 @@ class VECMEM_CORE_EXPORT copy {
193
199
// / Perform a "low level" memory filling operation
194
200
virtual void do_memset (std::size_t size, void * ptr, int value) const ;
195
201
// / Create an event for synchronization
196
- virtual event_type create_event () const ;
202
+ VECMEM_NODISCARD virtual event_type create_event () const ;
197
203
198
204
private:
199
205
// / Implementation for the 1D vector copy operator
0 commit comments