File tree Expand file tree Collapse file tree 3 files changed +37
-6
lines changed
Expand file tree Collapse file tree 3 files changed +37
-6
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,10 @@ class ConfigureLoadStore : protected internal::ConfigureLoadStoreData
121121
122122 template <typename T>
123123 [[nodiscard]] auto enqueueLoad () -> std::shared_ptr<T>;
124+
125+ using shared_ptr_dataset_types = auxiliary::detail::
126+ map_variant<auxiliary::detail::as_shared_pointer, dataset_types>::type;
127+ [[nodiscard]] auto enqueueLoadVariant () -> shared_ptr_dataset_types;
124128};
125129
126130template <typename Ptr_Type, typename ChildClass = void >
Original file line number Diff line number Diff line change @@ -133,6 +133,29 @@ auto ConfigureLoadStore<ChildClass>::enqueueLoad() -> std::shared_ptr<T>
133133 return m_rc.loadChunkAllocate_impl <T>(storeChunkConfig ());
134134}
135135
136+ namespace
137+ {
138+ template <typename ConfigureLoadStore_t>
139+ struct VisitorEnqueueLoadVariant
140+ {
141+ template <typename T>
142+ static auto call (RecordComponent const &, ConfigureLoadStore_t &cfg) ->
143+ typename ConfigureLoadStore_t::shared_ptr_dataset_types
144+ {
145+ return cfg.template enqueueLoad <T>();
146+ }
147+ };
148+ } // namespace
149+
150+ template <typename ChildClass>
151+ auto ConfigureLoadStore<ChildClass>::enqueueLoadVariant()
152+ -> shared_ptr_dataset_types
153+ {
154+ return m_rc
155+ .visit <VisitorEnqueueLoadVariant<ConfigureLoadStore<ChildClass>>>(
156+ *this );
157+ }
158+
136159template <typename Ptr_Type, typename ChildClass>
137160ConfigureStoreChunkFromBuffer<Ptr_Type, ChildClass>::
138161 ConfigureStoreChunkFromBuffer (Ptr_Type buffer, parent_t &&parent)
Original file line number Diff line number Diff line change @@ -1676,13 +1676,17 @@ inline void write_test(const std::string &backend)
16761676 auto opaqueTypeDataset = rc.visit <ReadFromAnyType>();
16771677
16781678 auto variantTypeDataset = rc.loadChunkVariant ();
1679+ auto variantTypeDataset2 = rc.prepareLoadStore ().enqueueLoadVariant ();
16791680 rc.seriesFlush ();
1680- std::visit (
1681- [](auto &&shared_ptr) {
1682- std::cout << " First value in loaded chunk: '" << shared_ptr.get ()[0 ]
1683- << ' \' ' << std::endl;
1684- },
1685- variantTypeDataset);
1681+ for (auto ptr : {&variantTypeDataset, &variantTypeDataset2})
1682+ {
1683+ std::visit (
1684+ [](auto &&shared_ptr) {
1685+ std::cout << " First value in loaded chunk: '"
1686+ << shared_ptr.get ()[0 ] << ' \' ' << std::endl;
1687+ },
1688+ *ptr);
1689+ }
16861690
16871691#ifndef _WIN32
16881692 REQUIRE (read.rankTable (/* collective = */ false ) == compare);
You can’t perform that action at this time.
0 commit comments