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
19 changes: 19 additions & 0 deletions src/dawnpy/descriptor/generation/io_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,21 @@ def generate_io_config( # noqa: C901
else []
)

# Per-field C++ hook: an IO handler owns emission of its own
# type-specific value-types (symmetric with the binary path);
# anything it declines falls back to the generic loop below.
field_hook = getattr(handler, "emit_config_field_cpp", None)
hook_ctx = (
IoGeneratorContext(
config_loader=self._config_loader,
format_helper=self._format_helper,
objects=self._objects(),
config_rw_grants=self._config_rw_grants(),
)
if field_hook is not None
else None
)

# Count how many config items are present. ``limits`` expands
# into three cfg items (min/max/step), every other field is one.
config_count = 0
Expand All @@ -224,6 +239,10 @@ def generate_io_config( # noqa: C901
for field_def in field_defs:
field_name = field_def.name
if field_name in config:
if field_hook is not None and field_hook(
lines, field_def, obj, hook_ctx
):
continue
cpp_helper = field_def.cpp_helper
value = config[field_name]
value_type = field_def.value_type or "auto"
Expand Down
Loading
Loading