@Retention(value=RUNTIME) @Target(value=TYPE) public @interface RawStructure
C struct
definition. The interface must extend PointerBase
, i.e., it is a word type. There is
never a Java class that implements the interface.
Field accesses are done via interface methods that are annotated with RawField
. All calls
of the interface methods are replaced with the appropriate memory operations.
The layout and size of the structure is inferred from the fields defined with RawField
.
All fields are aligned according to the field size, i.e., 8-byte types are aligned at 8-byte
boundaries. It is currently not possible to influence the layout of fields. However, it is
possible to reserve extra space at the end of the structure by specifying a
RawStructure.sizeProvider()
.
Modifier and Type | Optional Element and Description |
---|---|
Class<? extends IntUnaryOperator> |
sizeProvider
Class of a function that computes the size of the structure.
|
public abstract Class<? extends IntUnaryOperator> sizeProvider
fields
of the
structure. The returned value must not be smaller than that provided argument.
By default, the size computed based on the layout is used.
The provided class must have a no-argument constructor.