Package ghidra.program.model.data
Interface Union
-
- All Known Implementing Classes:
UnionDataType
public interface Union extends Composite
The union interface.NOTE: The use of bitfields within all unions assumes a default packing where bit allocation always starts with byte-0 of the union. Bit allocation order is dictated by data organization endianess (byte-0 msb allocated first for big-endian, while byte-0 lsb allocated first for little-endian).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ghidra.program.model.data.Composite
Composite.AlignmentType, Composite.NamedAlignment
-
-
Field Summary
-
Fields inherited from interface ghidra.program.model.data.Composite
DEFAULT_ALIGNMENT_VALUE, NOT_PACKING
-
Fields inherited from interface ghidra.program.model.data.DataType
CONFLICT_SUFFIX, DEFAULT, NO_LAST_CHANGE_TIME, NO_SOURCE_SYNC_TIME, VOID
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DataTypeComponent
insertBitField(int ordinal, DataType baseDataType, int bitSize, java.lang.String componentName, java.lang.String comment)
Inserts a new bitfield at the specified ordinal position in this union.-
Methods inherited from interface ghidra.program.model.data.Composite
add, add, add, add, addBitField, dataTypeAlignmentChanged, delete, delete, getBitFieldPacking, getComponent, getComponents, getMinimumAlignment, getNumComponents, getPackingValue, insert, insert, insert, isDefaultAligned, isInternallyAligned, isMachineAligned, isPartOf, realign, setDescription, setInternallyAligned, setMinimumAlignment, setPackingValue, setToDefaultAlignment, setToMachineAlignment
-
Methods inherited from interface ghidra.program.model.data.DataType
addParent, clone, copy, dataTypeDeleted, dataTypeNameChanged, dataTypeReplaced, dataTypeSizeChanged, dependsOn, getAlignment, getCategoryPath, getDataOrganization, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDefaultSettings, getDescription, getDisplayName, getDocs, getLastChangeTime, getLastChangeTimeInSourceArchive, getLength, getMnemonic, getName, getParents, getPathName, getRepresentation, getSettingsDefinitions, getSourceArchive, getUniversalID, getValue, getValueClass, isDeleted, isDynamicallySized, isEquivalent, isNotYetDefined, removeParent, replaceWith, setCategoryPath, setDefaultSettings, setLastChangeTime, setLastChangeTimeInSourceArchive, setName, setNameAndCategory, setSourceArchive
-
-
-
-
Method Detail
-
insertBitField
DataTypeComponent insertBitField(int ordinal, DataType baseDataType, int bitSize, java.lang.String componentName, java.lang.String comment) throws InvalidDataTypeException, java.lang.ArrayIndexOutOfBoundsException
Inserts a new bitfield at the specified ordinal position in this union. For both aligned and unaligned unions the bitfield starts with bit-0 (lsb) of the first byte for little-endian, and with bit-7 (msb) of the first byte for big-endian. This is the default behavior for most compilers. Insertion behavior may not work as expected if packing rules differ from this.- Parameters:
ordinal
- the ordinal where the new datatype is to be inserted.baseDataType
- the bitfield base datatype (certain restrictions apply).bitSize
- the declared bitfield size in bits. The effective bit size may be adjusted based upon the specified baseDataType.componentName
- the field name to associate with this component.comment
- the comment to associate with this component.- Returns:
- the bitfield component created whose associated data type will be BitFieldDataType.
- Throws:
InvalidDataTypeException
- if the specified baseDataType is not a valid base type for bitfields.java.lang.ArrayIndexOutOfBoundsException
- if ordinal is less than 0 or greater than the current number of components.
-
-