Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/openPMD/RecordComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ class RecordComponent : public BaseRecordComponent
* @param extent Extent within the dataset, counted from the offset.
*/
template <typename T>
void storeChunkRaw(T *data, Offset offset, Extent extent);
void storeChunkRaw(T const *data, Offset offset, Extent extent);

/** Store a chunk of data from a contiguous container.
*
Expand Down
6 changes: 2 additions & 4 deletions include/openPMD/auxiliary/ShareRawInternal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,14 @@ std::shared_ptr<T const> shareRaw(T const *x)
}

template <typename T>
auto shareRaw(T &c)
-> std::shared_ptr<typename std::remove_pointer<decltype(c.data())>::type>
auto shareRaw(T &c) -> std::shared_ptr<typename T::value_type>
{
using value_type = typename std::remove_pointer<decltype(c.data())>::type;
return std::shared_ptr<value_type>(c.data(), [](value_type *) {});
}

template <typename T>
auto shareRaw(T const &c)
-> std::shared_ptr<typename std::remove_pointer<decltype(c.data())>::type>
auto shareRaw(T const &c) -> std::shared_ptr<typename T::value_type>
{
using value_type = typename std::remove_pointer<decltype(c.data())>::type;
return std::shared_ptr<value_type>(c.data(), [](value_type *) {});
Expand Down
12 changes: 6 additions & 6 deletions src/RecordComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,13 +820,13 @@ template <typename T>
void RecordComponent::storeChunk(std::shared_ptr<T[]> data, Offset o, Extent e)
{
storeChunk(
std::static_pointer_cast<T>(std::move(data)),
std::static_pointer_cast<T const>(std::move(data)),
std::move(o),
std::move(e));
}

template <typename T>
void RecordComponent::storeChunkRaw(T *ptr, Offset offset, Extent extent)
void RecordComponent::storeChunkRaw(T const *ptr, Offset offset, Extent extent)
{
storeChunk(auxiliary::shareRaw(ptr), std::move(offset), std::move(extent));
}
Expand Down Expand Up @@ -864,15 +864,15 @@ void RecordComponent::verifyChunk(Offset const &o, Extent const &e) const
template void RecordComponent::verifyChunk<type>( \
Offset const &o, Extent const &e) const; \
template DynamicMemoryView<type> RecordComponent::storeChunk<type>( \
Offset offset, Extent extent);
Offset offset, Extent extent); \
template void RecordComponent::storeChunkRaw<type>( \
OPENPMD_PTR(type const) ptr, Offset offset, Extent extent);

#define OPENPMD_INSTANTIATE_CONST_AND_NONCONST(type) \
template void RecordComponent::storeChunk<type>( \
std::shared_ptr<type> data, Offset o, Extent e); \
template void RecordComponent::storeChunk<type>( \
std::shared_ptr<OPENPMD_ARRAY(type)> data, Offset o, Extent e); \
template void RecordComponent::storeChunkRaw<type>( \
OPENPMD_PTR(type) ptr, Offset offset, Extent extent);
std::shared_ptr<OPENPMD_ARRAY(type)> data, Offset o, Extent e);

#define OPENPMD_INSTANTIATE_WITH_AND_WITHOUT_EXTENT(type) \
template std::shared_ptr<type> RecordComponent::loadChunk<type>( \
Expand Down
Loading