public class FieldList<T> extends java.lang.Object implements IDestructableField
| Modifier and Type | Field and Description |
|---|---|
static FieldPointer |
FIRST_BLOCK
Pointer to the first block.
|
static FieldPointer |
LAST_BLOCK_WITH_ELEMENTS
Pointer to the block where insertions are currently happening.
|
protected int |
offset |
| Modifier and Type | Method and Description |
|---|---|
void |
allocate(Nd nd,
long address,
int numElements)
Ensures that the receiver will have space for the given number of elements without additional
allocation.
|
T |
append(Nd nd,
long address) |
java.util.List<T> |
asList(Nd nd,
long address)
Returns the contents of the receiver as a
List. |
static <T> FieldList<T> |
create(StructDef<?> ownerStruct,
StructDef<T> elementType)
Creates a new
FieldList in the given struct which contains elements of the given type. |
static <T> FieldList<T> |
create(StructDef<?> ownerStruct,
StructDef<T> elementType,
int elementsPerBlock)
Creates a new
FieldList in the given struct which contains elements of the given type. |
void |
destruct(Nd nd,
long address) |
java.lang.String |
getFieldName()
Returns the name of the field.
|
int |
getOffset()
Returns the field offset, in bytes from the start of the struct.
|
int |
getRecordSize()
Returns the size of the field, in bytes.
|
protected void |
setFieldName(java.lang.String fieldName) |
void |
setOffset(int offset)
Sets the field offset (bytes from the start of the struct).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAlignmentpublic static final FieldPointer FIRST_BLOCK
public static final FieldPointer LAST_BLOCK_WITH_ELEMENTS
protected int offset
public static <T> FieldList<T> create(StructDef<?> ownerStruct, StructDef<T> elementType)
FieldList in the given struct which contains elements of the given type. The resulting list
will grow by 1 element each time it overflows.ownerStruct - the struct to which the new list field will be added. Must not have had StructDef.done()
invoked on it yet.elementType - the type of elements that will be contained in the struct.public static <T> FieldList<T> create(StructDef<?> ownerStruct, StructDef<T> elementType, int elementsPerBlock)
FieldList in the given struct which contains elements of the given type. The resulting list
will grow by the given number of elements each time it overflows.ownerStruct - the struct to which the new list field will be added. Must not have had StructDef.done()
invoked on it yet.elementType - the type of elements that will be contained in the struct.elementsPerBlock - the number of elements that will be allocated each time the list overflows.public int getRecordSize()
IFieldgetRecordSize in interface IFieldpublic java.util.List<T> asList(Nd nd, long address)
List.nd - the database to be queried.address - the address of the parent structpublic void allocate(Nd nd, long address, int numElements)
append(Nd, long)
calls if they know in advance how many elements will be appended. Will create the minimum number
of extra blocks needed to the given number of additional elements.public void destruct(Nd nd, long address)
destruct in interface IDestructableFieldprotected final void setFieldName(java.lang.String fieldName)
public final void setOffset(int offset)
IFieldpublic final int getOffset()
IFieldpublic final java.lang.String getFieldName()
IFieldgetFieldName in interface IField