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 @@ -1659,13 +1659,17 @@ inline void write_test(const std::string &backend)
16591659 auto opaqueTypeDataset = rc.visit <ReadFromAnyType>();
16601660
16611661 auto variantTypeDataset = rc.loadChunkVariant ();
1662+ auto variantTypeDataset2 = rc.prepareLoadStore ().enqueueLoadVariant ();
16621663 rc.seriesFlush ();
1663- std::visit (
1664- [](auto &&shared_ptr) {
1665- std::cout << " First value in loaded chunk: '" << shared_ptr.get ()[0 ]
1666- << ' \' ' << std::endl;
1667- },
1668- variantTypeDataset);
1664+ for (auto ptr : {&variantTypeDataset, &variantTypeDataset2})
1665+ {
1666+ std::visit (
1667+ [](auto &&shared_ptr) {
1668+ std::cout << " First value in loaded chunk: '"
1669+ << shared_ptr.get ()[0 ] << ' \' ' << std::endl;
1670+ },
1671+ *ptr);
1672+ }
16691673}
16701674
16711675TEST_CASE (" write_test" , " [serial]" )
You can’t perform that action at this time.
0 commit comments