Skip to content

Commit b2bc355

Browse files
committed
Same for store API
1 parent f1bb42a commit b2bc355

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

include/openPMD/LoadStoreChunk.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ namespace core
164164

165165
auto storeChunkConfig() -> internal::LoadStoreConfigWithBuffer;
166166

167-
auto enqueueStore() -> void;
167+
auto enqueueStore() -> std::future<void>;
168+
169+
auto store(EnqueuePolicy) -> void;
168170

169171
/** This intentionally shadows the parent class's enqueueLoad methods in
170172
* order to show a compile error when using enqueueLoad() on an object

src/LoadStoreChunk.cpp

+23-1
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,34 @@ namespace core
202202
}
203203

204204
template <typename Ptr_Type>
205-
auto ConfigureStoreChunkFromBuffer<Ptr_Type>::enqueueStore() -> void
205+
auto
206+
ConfigureStoreChunkFromBuffer<Ptr_Type>::enqueueStore() -> std::future<void>
207+
{
208+
this->m_rc.storeChunk_impl(
209+
asWriteBuffer(std::move(m_buffer)),
210+
determineDatatype<auxiliary::IsPointer_t<Ptr_Type>>(),
211+
storeChunkConfig());
212+
return std::async(
213+
std::launch::deferred,
214+
[rc_lambda = m_rc]() mutable -> void { rc_lambda.seriesFlush(); });
215+
}
216+
217+
template <typename Ptr_Type>
218+
auto
219+
ConfigureStoreChunkFromBuffer<Ptr_Type>::store(EnqueuePolicy ep) -> void
206220
{
207221
this->m_rc.storeChunk_impl(
208222
asWriteBuffer(std::move(m_buffer)),
209223
determineDatatype<auxiliary::IsPointer_t<Ptr_Type>>(),
210224
storeChunkConfig());
225+
switch (ep)
226+
{
227+
case EnqueuePolicy::Defer:
228+
break;
229+
case EnqueuePolicy::Immediate:
230+
m_rc.seriesFlush();
231+
break;
232+
}
211233
}
212234

213235
template <typename Ptr_Type>

0 commit comments

Comments
 (0)