Diligent Engine
Loading...
Searching...
No Matches
binding_model Namespace Reference

Functions

 inferred_value_policy (value, *, is_result=False, is_field=False, interfaces=())
 record_usage (types, policies=None)
 pointer_defaults (value, policy, *, is_result=False, is_field=False, interfaces=())
 resolve_span_length (length, siblings, context, types=None, *, field=False)
 apply_policies (model, policies, symbols, conventions=None)

Detailed Description

Binding policies over the language-neutral API model; independent of Clang.

Function Documentation

◆ apply_policies()

apply_policies ( model,
policies,
symbols,
conventions = None )
Validate and attach policies to a freshly extracted or JSON-loaded model.

Mutates the supplied model. The result contains only JSON-compatible data,
so emitters and external generator adapters do not need Clang objects.

◆ inferred_value_policy()

inferred_value_policy ( value,
* ,
is_result = False,
is_field = False,
interfaces = () )
Derive ordinary value-reference marshalling from the native type.

References are non-null and do not transfer ownership of their storage.
Value references are marshalled during the call (results are snapshots).
An API retaining an input reference must explicitly override that lifetime.
Mutable value arguments default to outputs; interface arguments are inputs.
Inout and mutable input storage require overrides. Record-usage analysis
supplies field directions; API conventions can supply pointer contracts.

◆ pointer_defaults()

pointer_defaults ( value,
policy,
* ,
is_result = False,
is_field = False,
interfaces = () )
Diligent conventions, enabled once per API and overridden per value.

These are API contracts, not C++ ownership guarantees. Ordinary pointers
borrow call-scoped storage. Interface output slots transfer a strong reference,
while direct interface returns borrow one from the object. Descriptor pointer
fields and pointer arguments defaulted to nullptr are nullable. Other pointer
arguments and results are required unless explicitly marked nullable.
Retained storage and exceptions to these conventions need explicit metadata.

◆ record_usage()

record_usage ( types,
policies = None )
Propagate input/output use through records, bases, arrays, and pointers.

Descriptor fields follow the enclosing descriptor's marshalling direction;
indirect writable buffers can override that convention. The same analysis is
used before policy validation and by emitters consuming a resolved model.

◆ resolve_span_length()

resolve_span_length ( length,
siblings,
context,
types = None,
* ,
field = False )
Resolve a sibling count, a nested value-field count, or a fixed field extent.