@Retention(value=RUNTIME) @Target(value=METHOD) public @interface CField
C struct
.
If the method has a non-void return type, it is a get-method of the field. Calls of the method
are replaced with a memory read. The possible signatures are
FieldType getFieldName([IntType index], [LocationIdentity locationIdentity]);
If the method has the return type void, it is a set-method of the field. Calls of the method are
replaced with a memory write. The possible signatures are
void setFieldName([IntType index], FieldType value, [LocationIdentity locationIdentity]);
The receiver is the pointer to the struct that is accessed, i.e., the base address of the memory access.
The FieldType
must be the Java-equivalent of the C type used in the C struct. The
additional annotations AllowNarrowingCast
or AllowWideningCast
can be used to
relax the strict type requirements.
The optional parameter index
(always the first parameter when it is present) denotes an
index, i.e., the receiver is treated as an array of the struct. The type must be a primitive
integer type or a word type
. Address arithmetic is used to scale the index with
the size of the struct.
The optional parameter locationIdentity
specifies the LocationIdentity
to be used
for the memory access. Two memory accesses with two different location identities are guaranteed
to not alias. The parameter cannot be used together with the UniqueLocationIdentity
annotation, which is another way of providing a location identity for the memory access.
Multiple accessor methods, with different signatures according to the rules of allowed signatures, are allowed for a single field.