Skip to content

Commit

Permalink
Add support for negative python-style indexing to writeTableRecords
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAce committed Oct 10, 2021
1 parent e15e5aa commit e57e949
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/h5pp/details/h5ppHdf5.h
Original file line number Diff line number Diff line change
Expand Up @@ -2941,13 +2941,14 @@ namespace h5pp::hdf5 {
}

template<typename DataType>
inline void writeTableRecords(const DataType &data, TableInfo &info, size_t offset = 0, std::optional<size_t> extent = std::nullopt) {
inline void writeTableRecords(const DataType &data, TableInfo &info, hsize_t offset = 0, std::optional<hsize_t> extent = std::nullopt) {
/*
* This function replaces H5TBwrite_records() and avoids creating expensive temporaries for the dataset id and type id for the
* compound table type. In addition, it has the ability to extend the existing the dataset if the incoming data larger than the
* current bound
*/
info.assertWriteReady();
offset = util::wrapUnsigned(offset, info.numRecords.value()); // Allows python style negative indexing

if constexpr(std::is_same_v<DataType, std::vector<std::byte>>) {
if(not extent) extent = data.size() / info.recordBytes.value();
Expand Down

0 comments on commit e57e949

Please sign in to comment.