Skip to content

refactor: add a .size field to asdf_extension_t#232

Merged
embray merged 1 commit into
asdf-format:mainfrom
embray:extension-size
Jul 16, 2026
Merged

refactor: add a .size field to asdf_extension_t#232
embray merged 1 commit into
asdf-format:mainfrom
embray:extension-size

Conversation

@embray

@embray embray commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

This records the size (in bytes) of the extension object. This is useful for dynamic allocation, where e.g. a generic extension object allocator does not know the type of the object it's constructing, but needs to know at least the correct size for the object. This is used in libasdf-gwcs where there are "class hierarchies" where the generic base allocator would need to know the size of the objects for "subclasses" without knowing the actual type of the subclass.

Arguably this would be a case for adding some .alloc and/or .init method for extensions, but for the present purposes that's more than would be needed.

This records the size (in bytes) of the extension object.  This is
useful for dynamic allocation, where e.g. a generic extension object
allocator does not know the type of the object it's constructing, but
needs to know at least the correct size for the object.  This is used in
libasdf-gwcs where there are "class hierarchies" where the generic base
allocator would need to know the size of the objects for "subclasses"
without knowing the actual type of the subclass.
@embray embray added the refactoring Changes to code structure or APIs label Jul 16, 2026
@embray
embray merged commit ef485e8 into asdf-format:main Jul 16, 2026
12 checks passed
@embray
embray deleted the extension-size branch July 16, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Changes to code structure or APIs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant