Repository navigation
feat(writing): size strings per dataset and attribute - #203
Open
Blackclaws wants to merge 1 commit into
Open
Blackclaws wants to merge 1 commit into
Blackclaws wants to merge 1 commit into
Conversation
H5StringInfo, passed to an H5Dataset or H5Attribute constructor, sizes the strings of that one object in place of the file-wide options: Length for its strings, MemberLength for the string members of its compound type (consulted before the field and property mappers), and Padding for its fixed-length strings, including SpacePad. Datasets of one element type can now have different member widths. The datatype cache keys on the widths a member length resolves to rather than on the delegate, so objects asking for the same widths share one message. Closes Apollo3zehn#138 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #138. Independent of the writing stack in #190; based on
dev.H5WriteOptionssizes strings for the whole file. A plain string dataset only hasDefaultStringLength, and a compound member is sized by the field and property mappers, which see the sameFieldInfoorPropertyInfofor every dataset of a row type. So many tables of one row type cannot have different column widths.This adds
H5StringInfo, passed to theH5DatasetandH5Attributeconstructors next toopaqueInfo, as the issue suggests:LengthDefaultStringLengthfor the object, and ofAttributeStringLengthfor an attribute: 0 for variable-length, a positive value for fixed-length,nullto keep the file-wide setting. It is also the width of a compound string member that nothing more specific sizes.MemberLengthstringfield or property of the element type, beforeFieldStringLengthMapperandPropertyStringLengthMapper. Returningnullleaves the member to them.PaddingH5StringPadding.NullTerminate,NullPadorSpacePadfor the object's fixed-length strings, compound members included.nullkeeps what the writer declares today.Worth flagging
MemberLengthreturns, not on the delegate. A caller that builds anH5StringInfoper dataset passes a new delegate each time, and keying on it would give every dataset a compound message of its own. Datasets asking for the same widths share one.MemberLengthcovers the element type's own members. A compound nested inside it is sized by the mappers andLength. Covering nested members would mean walking the type a second time to build the cache key.SpacePadfills the field with spaces. The reader already strips trailing spaces for it, so a value's own trailing spaces do not survive.Lengthkeeps it. The fallback to variable-length when a measured width makes the attribute message too large applies only to measured widths.stringInfois a new optional constructor parameter. Source compiles unchanged; assemblies built against an earlier version need recompiling.H5Dataset's rarely set options into a record of their own. Whichever is merged second movesStringInfothere; I'll rebase.doc/writing/data-types.mdhas a new section. NoCHANGELOG.mdentry, assuming you would rather write it yourself.StringInfoTestscovers:Length: 0overriding aDefaultStringLengthMemberLength, the mappers andLengthSpacePadfield holds andh5dumpreportingH5T_STR_SPACEPADBeginWriteand written laterStringOverflowunder a per-object widthAttributeStringLength🤖 Generated with Claude Code