Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flexible std::strings. #744

Merged
merged 1 commit into from
Oct 31, 2023
Merged

Flexible std::strings. #744

merged 1 commit into from
Oct 31, 2023

Conversation

1uc
Copy link
Collaborator

@1uc 1uc commented May 5, 2023

This PR outlines how one could read and write std::string and containers of std::string into/from fixed or variable length HDF5 strings.

@codecov
Copy link

codecov bot commented May 5, 2023

Codecov Report

Attention: 35 lines in your changes are missing coverage. Please review.

Comparison is base (386d1b6) 84.68% compared to head (8bfa11f) 84.73%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #744      +/-   ##
==========================================
+ Coverage   84.68%   84.73%   +0.04%     
==========================================
  Files          68       69       +1     
  Lines        4812     5043     +231     
==========================================
+ Hits         4075     4273     +198     
- Misses        737      770      +33     
Files Coverage Δ
include/highfive/bits/H5Attribute_misc.hpp 80.30% <100.00%> (ø)
include/highfive/bits/H5DataType_misc.hpp 79.59% <ø> (ø)
include/highfive/bits/H5Inspector_misc.hpp 90.97% <100.00%> (+0.30%) ⬆️
include/highfive/bits/H5ReadWrite_misc.hpp 83.87% <100.00%> (+3.22%) ⬆️
include/highfive/bits/H5Slice_traits_misc.hpp 90.24% <100.00%> (ø)
tests/unit/tests_high_five_base.cpp 99.71% <100.00%> (+0.01%) ⬆️
include/highfive/bits/H5Converter_misc.hpp 96.62% <95.16%> (-3.38%) ⬇️
src/examples/read_write_std_strings.cpp 0.00% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@1uc 1uc force-pushed the 1uc/flexible_std_string branch 3 times, most recently from 648f84e to b597762 Compare May 5, 2023 10:04
@1uc 1uc marked this pull request as ready for review May 5, 2023 11:52
@1uc
Copy link
Collaborator Author

1uc commented May 5, 2023

Things to discuss:

  • Currently the new code defaults to ASCII while old code default to UFT8. Probably, it would make more sense to default to UFT8 everywhere.
  • There's no default for the padding of fixed-length strings. The issue is that the natural choice null-terminated could easily lead to writing strings to disk that claim they're null-terminated, but they're not. The fact that they're not null-terminated isn't the issue, we know their length. The problem is only that they claim that they are; when they're not.

@1uc 1uc force-pushed the 1uc/flexible_std_string branch from b597762 to 84143ca Compare May 6, 2023 11:06
@1uc 1uc force-pushed the 1uc/flexible_std_string branch from 84143ca to 13e6a74 Compare May 26, 2023 07:45
@1uc 1uc mentioned this pull request Jun 26, 2023
@1uc 1uc force-pushed the 1uc/flexible_std_string branch 3 times, most recently from e35ea57 to 796e529 Compare August 2, 2023 14:34
@1uc 1uc force-pushed the 1uc/flexible_std_string branch from 796e529 to 233f773 Compare September 8, 2023 07:31
Copy link
Member

@matz-e matz-e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a glance over this, looks good.

This commit implements serializing `std::string` to both variable (the
default) and fixed length HDF5 strings.
@1uc 1uc force-pushed the 1uc/flexible_std_string branch from 233f773 to 8bfa11f Compare October 31, 2023 16:26
@1uc 1uc merged commit 858c7d9 into master Oct 31, 2023
36 checks passed
@1uc 1uc deleted the 1uc/flexible_std_string branch October 31, 2023 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants