Skip to content

Commit 9216dbb

Browse files
committed
Destructor for ~DeferredComputation
1 parent e525652 commit 9216dbb

17 files changed

+97
-25
lines changed

include/openPMD/IO/ADIOS/ADIOS2IOHandler.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ class ADIOS2IOHandler : public AbstractIOHandler
957957
try
958958
{
959959
auto params = internal::defaultParsedFlushParams;
960-
this->flush(params);
960+
this->flush_impl(params);
961961
}
962962
catch (std::exception const &ex)
963963
{
@@ -1005,6 +1005,6 @@ class ADIOS2IOHandler : public AbstractIOHandler
10051005
return true;
10061006
}
10071007

1008-
std::future<void> flush(internal::ParsedFlushParams &) override;
1008+
std::future<void> flush_impl(internal::ParsedFlushParams &) override;
10091009
}; // ADIOS2IOHandler
10101010
} // namespace openPMD

include/openPMD/IO/AbstractIOHandler.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,15 @@ class AbstractIOHandler
265265
* backends that decide to implement this operation asynchronously.
266266
*/
267267
std::future<void> flush(internal::FlushParams const &);
268+
std::shared_ptr<unsigned long long> m_flushCounter =
269+
std::make_shared<unsigned long long>(0);
268270

269271
/** Process operations in queue according to FIFO.
270272
*
271273
* @return Future indicating the completion state of the operation for
272274
* backends that decide to implement this operation asynchronously.
273275
*/
274-
virtual std::future<void> flush(internal::ParsedFlushParams &) = 0;
276+
std::future<void> flush(internal::ParsedFlushParams &);
275277

276278
/** The currently used backend */
277279
virtual std::string backendName() const = 0;
@@ -315,6 +317,9 @@ class AbstractIOHandler
315317
IterationEncoding m_encoding = IterationEncoding::groupBased;
316318
OpenpmdStandard m_standard = auxiliary::parseStandard(getStandardDefault());
317319
bool m_verify_homogeneous_extents = true;
320+
321+
protected:
322+
virtual std::future<void> flush_impl(internal::ParsedFlushParams &) = 0;
318323
}; // AbstractIOHandler
319324

320325
} // namespace openPMD

include/openPMD/IO/DummyIOHandler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class DummyIOHandler : public AbstractIOHandler
4444
/** No-op consistent with the IOHandler interface to enable library use
4545
* without IO.
4646
*/
47-
std::future<void> flush(internal::ParsedFlushParams &) override;
47+
std::future<void> flush_impl(internal::ParsedFlushParams &) override;
4848
std::string backendName() const override;
4949
}; // DummyIOHandler
5050
} // namespace openPMD

include/openPMD/IO/HDF5/HDF5IOHandler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class HDF5IOHandler : public AbstractIOHandler
4646
return "HDF5";
4747
}
4848

49-
std::future<void> flush(internal::ParsedFlushParams &) override;
49+
std::future<void> flush_impl(internal::ParsedFlushParams &) override;
5050

5151
private:
5252
std::unique_ptr<HDF5IOHandlerImpl> m_impl;

include/openPMD/IO/HDF5/ParallelHDF5IOHandler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class ParallelHDF5IOHandler : public AbstractIOHandler
5656
return "MPI_HDF5";
5757
}
5858

59-
std::future<void> flush(internal::ParsedFlushParams &) override;
59+
std::future<void> flush_impl(internal::ParsedFlushParams &) override;
6060

6161
private:
6262
std::unique_ptr<ParallelHDF5IOHandlerImpl> m_impl;

include/openPMD/IO/JSON/JSONIOHandler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class JSONIOHandler : public AbstractIOHandler
5959
return "JSON";
6060
}
6161

62-
std::future<void> flush(internal::ParsedFlushParams &) override;
62+
std::future<void> flush_impl(internal::ParsedFlushParams &) override;
6363

6464
private:
6565
JSONIOHandlerImpl m_impl;

include/openPMD/LoadStoreChunk.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ template <typename Ptr_Type>
2222
class ConfigureLoadStoreFromBuffer;
2323
template <typename T>
2424
class DynamicMemoryView;
25+
class Attributable;
2526

2627
namespace internal
2728
{
@@ -87,6 +88,8 @@ namespace core
8788
[[nodiscard]] auto dim() const -> uint8_t;
8889
auto storeChunkConfig() -> internal::LoadStoreConfig;
8990

91+
auto deferFlush(Attributable &);
92+
9093
public:
9194
auto getOffset() -> Offset const &;
9295
auto getExtent() -> Extent const &;
@@ -228,9 +231,12 @@ namespace compose
228231
template <typename ChildClass>
229232
class ConfigureLoadStore
230233
{
234+
ConfigureLoadStore() = default;
235+
231236
public:
232237
auto offset(Offset) -> ChildClass &;
233238
auto extent(Extent) -> ChildClass &;
239+
friend ChildClass;
234240
};
235241

236242
/** Configuration for a Store operation with a buffer type.

include/openPMD/auxiliary/Future.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class DeferredComputation
1515

1616
public:
1717
DeferredComputation(task_type);
18+
~DeferredComputation();
1819

1920
auto get() -> T;
2021

include/openPMD/backend/Attributable.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,11 @@ namespace debug
213213
void printDirty(Series const &);
214214
}
215215

216+
namespace core
217+
{
218+
class ConfigureLoadStore;
219+
}
220+
216221
/** @brief Layer to manage storage of attributes associated with file objects.
217222
*
218223
* Mandatory and user-defined Attributes and their data for every object in the
@@ -244,6 +249,7 @@ class Attributable
244249
friend class internal::AttributableData;
245250
friend class Snapshots;
246251
friend struct internal::HomogenizeExtents;
252+
friend class core::ConfigureLoadStore;
247253

248254
protected:
249255
// tag for internal constructor

src/IO/ADIOS/ADIOS2IOHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2614,7 +2614,7 @@ ADIOS2IOHandler::ADIOS2IOHandler(
26142614
{}
26152615

26162616
std::future<void>
2617-
ADIOS2IOHandler::flush(internal::ParsedFlushParams &flushParams)
2617+
ADIOS2IOHandler::flush_impl(internal::ParsedFlushParams &flushParams)
26182618
{
26192619
return m_impl.flush(flushParams);
26202620
}

0 commit comments

Comments
 (0)