Package ghidra.program.model.data

# Class StructuredDynamicDataType

java.lang.Object
ghidra.program.model.data.AbstractDataType
ghidra.program.model.data.DataTypeImpl
ghidra.program.model.data.BuiltIn
ghidra.program.model.data.DynamicDataType
ghidra.program.model.data.StructuredDynamicDataType

All Implemented Interfaces:
  `BuiltInDataType`, `DataType`, `Dynamic`, `ExtensionPoint`

public abstract class StructuredDynamicDataType extends DynamicDataType
Structured Dynamic Data type. Dynamic Structure that is built by adding data types to it. NOTE: This is a special Dynamic data-type which can only appear as a component created by a Dynamic data-type

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected List<String>`
  `componentDescs`
  `protected List<String>`
  `componentNames`
  `protected List<DataType>`
  `components`
  `protected String`
  `description`

  ### Fields inherited from class ghidra.program.model.data.DataTypeImpl

  `defaultSettings`

  ### Fields inherited from class ghidra.program.model.data.AbstractDataType

  `categoryPath, dataMgr, EMPTY_TYPEDEF_DEFINITIONS, name`

  ### Fields inherited from interface ghidra.program.model.data.DataType

  `CONFLICT_SUFFIX, DEFAULT, NO_LAST_CHANGE_TIME, NO_SOURCE_SYNC_TIME, TYPEDEF_ATTRIBUTE_PREFIX, TYPEDEF_ATTRIBUTE_SUFFIX, VOID`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `StructuredDynamicDataType(String name, String description, DataTypeManager dtm)`
  Construct an empty dynamic structure

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `add(DataType data, String componentName, String componentDescription)`
  Add a component data type onto the end of the dynamic structure
  `protected DataTypeComponent[]`
  `getAllComponents(MemBuffer buf)`
  Get all dynamic components associated with the specified MemBuffer
  `String`
  `getDescription()`
  Get a String briefly describing this DataType.
  `String`
  `getMnemonic(Settings settings)`
  Get the mnemonic for this DataType.
  `String`
  `getRepresentation(MemBuffer buf, Settings settings, int length)`
  Get bytes from memory in a printable format for this type.
  `Object`
  `getValue(MemBuffer buf, Settings settings, int length)`
  Returns the interpreted data value as an instance of the `advertised value class`.
  `void`
  `setComponents(List<DataType> components, List<String> componentNames, List<String> componentDescs)`
  Set the components of the dynamic structure all at once.

  ### Methods inherited from class ghidra.program.model.data.DynamicDataType

  `canSpecifyLength, getComponent, getComponentAt, getComponents, getComps, getLength, getLength, getNumComponents, getReplacementBaseType, invalidateCache`

  ### Methods inherited from class ghidra.program.model.data.BuiltIn

  `addParent, copy, getBuiltInSettingsDefinitions, getCTypeDeclaration, getCTypeDeclaration, getCTypeDeclaration, getCTypeDeclaration, getDecompilerDisplayName, getLastChangeTime, getSettingsDefinitions, getUniversalID, isEquivalent, removeParent, setDefaultSettings`

  ### Methods inherited from class ghidra.program.model.data.DataTypeImpl

  `equals, getAlignedLength, getAlignment, getDefaultSettings, getLastChangeTimeInSourceArchive, getParents, getSourceArchive, getValueClass, hashCode, notifyAlignmentChanged, notifyDeleted, notifyNameChanged, notifyParents, notifyReplaced, notifySizeChanged, replaceWith, setDescription, setLastChangeTime, setLastChangeTimeInSourceArchive, setSourceArchive`

  ### Methods inherited from class ghidra.program.model.data.AbstractDataType

  `dataTypeAlignmentChanged, dataTypeDeleted, dataTypeNameChanged, dataTypeReplaced, dataTypeSizeChanged, dependsOn, encodeRepresentation, encodeValue, getCategoryPath, getDataOrganization, getDataOrganization, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDisplayName, getName, getPathName, getTypeDefSettingsDefinitions, hasLanguageDependantLength, isDeleted, isEncodable, isNotYetDefined, isZeroLength, setCategoryPath, setName, setNameAndCategory, toString`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface ghidra.program.model.data.BuiltInDataType

  `getCTypeDeclaration, setDefaultSettings`

  ### Methods inherited from interface ghidra.program.model.data.DataType

  `addParent, clone, copy, dataTypeAlignmentChanged, dataTypeDeleted, dataTypeNameChanged, dataTypeReplaced, dataTypeSizeChanged, dependsOn, encodeRepresentation, encodeValue, getAlignedLength, getAlignment, getCategoryPath, getDataOrganization, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDefaultSettings, getDisplayName, getLastChangeTime, getLastChangeTimeInSourceArchive, getName, getParents, getPathName, getSettingsDefinitions, getSourceArchive, getTypeDefSettingsDefinitions, getUniversalID, getValueClass, hasLanguageDependantLength, isDeleted, isEncodable, isEquivalent, isNotYetDefined, isZeroLength, removeParent, replaceWith, setCategoryPath, setDescription, setLastChangeTime, setLastChangeTimeInSourceArchive, setName, setNameAndCategory, setSourceArchive`

- ## Field Details

  - ### description

    protected String description

  - ### components

    protected List<DataType> components

  - ### componentNames

    protected List<String> componentNames

  - ### componentDescs

    protected List<String> componentDescs

- ## Constructor Details

  - ### StructuredDynamicDataType

    public StructuredDynamicDataType(String name, String description, DataTypeManager dtm)
    Construct an empty dynamic structure
    Parameters:
      `name` - name of the dynamic structure
      `description` - description of the dynamic structure

- ## Method Details

  - ### add

    public void add(DataType data, String componentName, String componentDescription)
    Add a component data type onto the end of the dynamic structure
    Parameters:
      `data` - data type to add
      `componentName` - name of the field in the dynamic structure
      `componentDescription` - description of the field

  - ### setComponents

    public void setComponents(List<DataType> components, List<String> componentNames, List<String> componentDescs)
    Set the components of the dynamic structure all at once. This does not add the components in, it replaces any existing ones.
    Parameters:
      `components` - list of components to add
      `componentNames` - list of field names of each component
      `componentDescs` - list of descriptions of each component

  - ### getAllComponents

    protected DataTypeComponent[] getAllComponents(MemBuffer buf)
    Description copied from class: `DynamicDataType`
    Get all dynamic components associated with the specified MemBuffer
    Specified by:
      `getAllComponents` in class `DynamicDataType`
    Parameters:
      `buf` - memory buffer positioned at start of data type instance
    Returns:
      all components or null if memory data is not valid for this data type.

  - ### getDescription

    public String getDescription()
    Description copied from interface: `DataType`
    Get a String briefly describing this DataType.
    Returns:
      a one-liner describing this DataType.

  - ### getValue

    public Object getValue(MemBuffer buf, Settings settings, int length)
    Description copied from interface: `DataType`
    Returns the interpreted data value as an instance of the `advertised value class`.

    For instance, `Pointer` data types should return an Address object (or null), or integer data types should return a `Scalar` object.

    Parameters:
      `buf` - the data buffer
      `settings` - the settings to use.
      `length` - indicates the maximum number of bytes that may be consumed by a `Dynamic` datatype, otherwise this value is ignored. A value of -1 may be specified to allow a Dynamic datatype to determine the length based upon the actual data bytes
    Returns:
      the data object, or null if data is invalid

  - ### getRepresentation

    public String getRepresentation(MemBuffer buf, Settings settings, int length)
    Description copied from interface: `DataType`
    Get bytes from memory in a printable format for this type.
    Parameters:
      `buf` - the data.
      `settings` - the settings to use for the representation.
      `length` - the number of bytes to represent.
    Returns:
      the representation of the data in this format, never null.

  - ### getMnemonic

    public String getMnemonic(Settings settings)
    Description copied from interface: `DataType`
    Get the mnemonic for this DataType.
    Specified by:
      `getMnemonic` in interface `DataType`
    Overrides:
      `getMnemonic` in class `AbstractDataType`
    Parameters:
      `settings` - settings which may influence the result or null
    Returns:
      the mnemonic for this DataType.