Skip to content

Commit 51748b9

Browse files
committed
Rename TypedConfigureStoreChunk -> ConfigureStoreChunkFromBuffer
1 parent d354bfc commit 51748b9

3 files changed

Lines changed: 42 additions & 37 deletions

File tree

include/openPMD/LoadStoreChunk.hpp

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace openPMD
1212
{
1313
class RecordComponent;
1414
template <typename Ptr_Type>
15-
class TypedConfigureStoreChunk;
15+
class ConfigureStoreChunkFromBuffer;
1616
template <typename T>
1717
class DynamicMemoryView;
1818

@@ -76,26 +76,27 @@ class ConfigureStoreChunk : protected internal::ConfigureStoreChunkData
7676
// @todo rvalue references..?
7777
template <typename T>
7878
auto fromSharedPtr(std::shared_ptr<T>)
79-
-> TypedConfigureStoreChunk<
79+
-> ConfigureStoreChunkFromBuffer<
8080
std::shared_ptr<normalize_dataset_type<T> const>>;
8181
template <typename T>
8282
auto fromUniquePtr(UniquePtrWithLambda<T>)
83-
-> TypedConfigureStoreChunk<
83+
-> ConfigureStoreChunkFromBuffer<
8484
UniquePtrWithLambda<normalize_dataset_type<T>>>;
8585
template <typename T, typename Del>
8686
auto fromUniquePtr(std::unique_ptr<T, Del>)
87-
-> TypedConfigureStoreChunk<
87+
-> ConfigureStoreChunkFromBuffer<
8888
UniquePtrWithLambda<normalize_dataset_type<T>>>;
8989
template <typename T>
9090
auto
91-
fromRawPtr(T *data) -> TypedConfigureStoreChunk<
91+
fromRawPtr(T *data) -> ConfigureStoreChunkFromBuffer<
9292
std::shared_ptr<normalize_dataset_type<T> const>>;
9393
template <typename T_ContiguousContainer>
9494
auto fromContiguousContainer(T_ContiguousContainer &data) ->
9595
typename std::enable_if_t<
9696
auxiliary::IsContiguousContainer_v<T_ContiguousContainer>,
97-
TypedConfigureStoreChunk<std::shared_ptr<normalize_dataset_type<
98-
typename T_ContiguousContainer::value_type> const>>>;
97+
ConfigureStoreChunkFromBuffer<
98+
std::shared_ptr<normalize_dataset_type<
99+
typename T_ContiguousContainer::value_type> const>>>;
99100

100101
template <typename T>
101102
auto enqueue() -> DynamicMemoryView<T>;
@@ -105,13 +106,13 @@ class ConfigureStoreChunk : protected internal::ConfigureStoreChunkData
105106
auto enqueue(F &&createBuffer) -> DynamicMemoryView<T>;
106107
};
107108

108-
// @todo rename as ConfigureStoreChunkFromBuffer
109109
template <typename Ptr_Type>
110-
class TypedConfigureStoreChunk
111-
: public ConfigureStoreChunk<TypedConfigureStoreChunk<Ptr_Type>>
110+
class ConfigureStoreChunkFromBuffer
111+
: public ConfigureStoreChunk<ConfigureStoreChunkFromBuffer<Ptr_Type>>
112112
{
113113
public:
114-
using parent_t = ConfigureStoreChunk<TypedConfigureStoreChunk<Ptr_Type>>;
114+
using parent_t =
115+
ConfigureStoreChunk<ConfigureStoreChunkFromBuffer<Ptr_Type>>;
115116

116117
private:
117118
template <typename T>
@@ -120,12 +121,12 @@ class TypedConfigureStoreChunk
120121
Ptr_Type m_buffer;
121122
std::optional<MemorySelection> m_mem_select;
122123

123-
TypedConfigureStoreChunk(Ptr_Type buffer, parent_t &&);
124+
ConfigureStoreChunkFromBuffer(Ptr_Type buffer, parent_t &&);
124125

125126
auto storeChunkConfig() const -> internal::StoreChunkConfigFromBuffer;
126127

127128
public:
128-
auto memorySelection(MemorySelection) & -> TypedConfigureStoreChunk &;
129+
auto memorySelection(MemorySelection) & -> ConfigureStoreChunkFromBuffer &;
129130

130131
auto as_parent() && -> parent_t &&;
131132
auto as_parent() & -> parent_t &;
@@ -137,15 +138,15 @@ class TypedConfigureStoreChunk
137138
template <typename ChildClass>
138139
template <typename T>
139140
auto ConfigureStoreChunk<ChildClass>::fromSharedPtr(std::shared_ptr<T> data)
140-
-> TypedConfigureStoreChunk<
141+
-> ConfigureStoreChunkFromBuffer<
141142
std::shared_ptr<normalize_dataset_type<T> const>>
142143
{
143144
if (!data)
144145
{
145146
throw std::runtime_error(
146147
"Unallocated pointer passed during chunk store.");
147148
}
148-
return TypedConfigureStoreChunk<
149+
return ConfigureStoreChunkFromBuffer<
149150
std::shared_ptr<normalize_dataset_type<T> const>>(
150151
std::static_pointer_cast<normalize_dataset_type<T> const>(
151152
std::move(data)),
@@ -154,30 +155,31 @@ auto ConfigureStoreChunk<ChildClass>::fromSharedPtr(std::shared_ptr<T> data)
154155
template <typename ChildClass>
155156
template <typename T>
156157
auto ConfigureStoreChunk<ChildClass>::fromUniquePtr(UniquePtrWithLambda<T> data)
157-
-> TypedConfigureStoreChunk<UniquePtrWithLambda<normalize_dataset_type<T>>>
158+
-> ConfigureStoreChunkFromBuffer<
159+
UniquePtrWithLambda<normalize_dataset_type<T>>>
158160
{
159161
if (!data)
160162
{
161163
throw std::runtime_error(
162164
"Unallocated pointer passed during chunk store.");
163165
}
164-
return TypedConfigureStoreChunk<
166+
return ConfigureStoreChunkFromBuffer<
165167
UniquePtrWithLambda<normalize_dataset_type<T>>>(
166168
std::move(data).template static_cast_<normalize_dataset_type<T>>(),
167169
{std::move(*this)});
168170
}
169171
template <typename ChildClass>
170172
template <typename T>
171173
auto ConfigureStoreChunk<ChildClass>::fromRawPtr(T *data)
172-
-> TypedConfigureStoreChunk<
174+
-> ConfigureStoreChunkFromBuffer<
173175
std::shared_ptr<normalize_dataset_type<T> const>>
174176
{
175177
if (!data)
176178
{
177179
throw std::runtime_error(
178180
"Unallocated pointer passed during chunk store.");
179181
}
180-
return TypedConfigureStoreChunk<
182+
return ConfigureStoreChunkFromBuffer<
181183
std::shared_ptr<normalize_dataset_type<T> const>>(
182184
auxiliary::shareRaw(data), {std::move(*this)});
183185
}
@@ -186,7 +188,8 @@ template <typename ChildClass>
186188
template <typename T, typename Del>
187189
auto ConfigureStoreChunk<ChildClass>::fromUniquePtr(
188190
std::unique_ptr<T, Del> data)
189-
-> TypedConfigureStoreChunk<UniquePtrWithLambda<normalize_dataset_type<T>>>
191+
-> ConfigureStoreChunkFromBuffer<
192+
UniquePtrWithLambda<normalize_dataset_type<T>>>
190193
{
191194
return fromUniquePtr(UniquePtrWithLambda<T>(std::move(data)));
192195
}
@@ -196,7 +199,7 @@ auto ConfigureStoreChunk<ChildClass>::fromContiguousContainer(
196199
T_ContiguousContainer &data) ->
197200
typename std::enable_if_t<
198201
auxiliary::IsContiguousContainer_v<T_ContiguousContainer>,
199-
TypedConfigureStoreChunk<std::shared_ptr<normalize_dataset_type<
202+
ConfigureStoreChunkFromBuffer<std::shared_ptr<normalize_dataset_type<
200203
typename T_ContiguousContainer::value_type> const>>>
201204
{
202205
if (!m_extent.has_value() && dim() == 1)

include/openPMD/RecordComponent.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class RecordComponent : public BaseRecordComponent
136136
template <typename ChildClass>
137137
friend class ConfigureStoreChunk;
138138
template <typename Ptr_Type>
139-
friend class TypedConfigureStoreChunk;
139+
friend class ConfigureStoreChunkFromBuffer;
140140

141141
public:
142142
enum class Allocation

src/LoadStoreChunk.cpp

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -121,37 +121,38 @@ auto ConfigureStoreChunk<ChildClass>::enqueue() -> DynamicMemoryView<T>
121121
}
122122

123123
template <typename Ptr_Type>
124-
TypedConfigureStoreChunk<Ptr_Type>::TypedConfigureStoreChunk(
124+
ConfigureStoreChunkFromBuffer<Ptr_Type>::ConfigureStoreChunkFromBuffer(
125125
Ptr_Type buffer, parent_t &&parent)
126126
: parent_t(std::move(parent)), m_buffer(std::move(buffer))
127127
{}
128128

129129
template <typename Ptr_Type>
130-
auto TypedConfigureStoreChunk<Ptr_Type>::as_parent() && -> parent_t &&
130+
auto ConfigureStoreChunkFromBuffer<Ptr_Type>::as_parent() && -> parent_t &&
131131
{
132132
return std::move(*this);
133133
}
134134
template <typename Ptr_Type>
135-
auto TypedConfigureStoreChunk<Ptr_Type>::as_parent() & -> parent_t &
135+
auto ConfigureStoreChunkFromBuffer<Ptr_Type>::as_parent() & -> parent_t &
136136
{
137137
return *this;
138138
}
139139
template <typename Ptr_Type>
140-
auto TypedConfigureStoreChunk<Ptr_Type>::as_parent() const & -> parent_t const &
140+
auto ConfigureStoreChunkFromBuffer<Ptr_Type>::as_parent()
141+
const & -> parent_t const &
141142
{
142143
return *this;
143144
}
144145

145146
template <typename Ptr_Type>
146-
auto TypedConfigureStoreChunk<Ptr_Type>::storeChunkConfig() const
147+
auto ConfigureStoreChunkFromBuffer<Ptr_Type>::storeChunkConfig() const
147148
-> internal::StoreChunkConfigFromBuffer
148149
{
149150
return internal::StoreChunkConfigFromBuffer{
150151
this->getOffset(), this->getExtent(), m_mem_select};
151152
}
152153

153154
template <typename Ptr_Type>
154-
auto TypedConfigureStoreChunk<Ptr_Type>::enqueue() -> void
155+
auto ConfigureStoreChunkFromBuffer<Ptr_Type>::enqueue() -> void
155156
{
156157
this->m_rc.storeChunk_impl(
157158
asWriteBuffer(std::move(m_buffer)),
@@ -170,25 +171,26 @@ OPENPMD_FOREACH_DATASET_DATATYPE(INSTANTIATE_METHOD_TEMPLATES_FOR_BASE)
170171

171172
#undef INSTANTIATE_METHOD_TEMPLATES_FOR_BASE
172173

173-
#define INSTANTIATE_TYPED_STORE_CHUNK(dtype) \
174-
template class TypedConfigureStoreChunk<std::shared_ptr<dtype const>>; \
174+
#define INSTANTIATE_STORE_CHUNK_FROM_BUFFER(dtype) \
175+
template class ConfigureStoreChunkFromBuffer< \
176+
std::shared_ptr<dtype const>>; \
175177
template class ConfigureStoreChunk< \
176-
TypedConfigureStoreChunk<std::shared_ptr<dtype const>>>; \
178+
ConfigureStoreChunkFromBuffer<std::shared_ptr<dtype const>>>; \
177179
INSTANTIATE_METHOD_TEMPLATES( \
178180
ConfigureStoreChunk< \
179-
TypedConfigureStoreChunk<std::shared_ptr<dtype const>>>, \
181+
ConfigureStoreChunkFromBuffer<std::shared_ptr<dtype const>>>, \
180182
dtype) \
181-
template class TypedConfigureStoreChunk<UniquePtrWithLambda<dtype>>; \
183+
template class ConfigureStoreChunkFromBuffer<UniquePtrWithLambda<dtype>>; \
182184
template class ConfigureStoreChunk< \
183-
TypedConfigureStoreChunk<UniquePtrWithLambda<dtype>>>; \
185+
ConfigureStoreChunkFromBuffer<UniquePtrWithLambda<dtype>>>; \
184186
INSTANTIATE_METHOD_TEMPLATES( \
185187
ConfigureStoreChunk< \
186-
TypedConfigureStoreChunk<UniquePtrWithLambda<dtype>>>, \
188+
ConfigureStoreChunkFromBuffer<UniquePtrWithLambda<dtype>>>, \
187189
dtype)
188190

189-
OPENPMD_FOREACH_DATASET_DATATYPE(INSTANTIATE_TYPED_STORE_CHUNK)
191+
OPENPMD_FOREACH_DATASET_DATATYPE(INSTANTIATE_STORE_CHUNK_FROM_BUFFER)
190192

191-
#undef INSTANTIATE_TYPED_STORE_CHUNK
193+
#undef INSTANTIATE_STORE_CHUNK_FROM_BUFFER
192194
#undef INSTANTIATE_METHOD_TEMPLATES
193195

194196
} // namespace openPMD

0 commit comments

Comments
 (0)