Package ghidra.program.model.symbol

# Class RefTypeFactory

java.lang.Object
ghidra.program.model.symbol.RefTypeFactory

public class RefTypeFactory extends Object
Factory class to create RefType objects.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RefTypeFactory()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static RefType`
  `get(byte type)`
  Get static instance of the specified RefType/FlowType
  `static RefType[]`
  `getDataRefTypes()`
  `static FlowType`
  `getDefaultComputedFlowType(Instruction instr)`
  Determine default computed FlowType for a specified instruction.
  `static FlowType`
  `getDefaultFlowType(Instruction instr, Address toAddr, boolean allowComputedFlowType)`
  Determine default FlowType for a specified instruction and flow destination toAddr.
  `static RefType`
  `getDefaultMemoryRefType(CodeUnit cu, int opIndex, Address toAddr, boolean ignoreExistingReferences)`
  Get the default memory flow/data RefType for the specified code unit and opIndex.
  `static RefType`
  `getDefaultRegisterRefType(CodeUnit cu, Register reg, int opIndex)`
  Get the default stack data RefType for the specified code-unit/opIndex and register
  `static RefType`
  `getDefaultStackRefType(CodeUnit cu, int opIndex)`
  Get the default register data RefType for the specified code-unit/opIndex and register
  `static RefType[]`
  `getExternalRefTypes()`
  `static RefType[]`
  `getMemoryRefTypes()`
  `static RefType[]`
  `getStackRefTypes()`

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

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### RefTypeFactory

    public RefTypeFactory()

- ## Method Details

  - ### getMemoryRefTypes

    public static RefType[] getMemoryRefTypes()

  - ### getStackRefTypes

    public static RefType[] getStackRefTypes()

  - ### getDataRefTypes

    public static RefType[] getDataRefTypes()

  - ### getExternalRefTypes

    public static RefType[] getExternalRefTypes()

  - ### get

    public static RefType get(byte type)
    Get static instance of the specified RefType/FlowType
    Parameters:
      `type` - ref-type value
    Returns:
      ref-type instance
    Throws:
      `NoSuchElementException` - if ref-type is not defined

  - ### getDefaultRegisterRefType

    public static RefType getDefaultRegisterRefType(CodeUnit cu, Register reg, int opIndex)
    Get the default stack data RefType for the specified code-unit/opIndex and register
    Parameters:
      `cu` - the code unit
      `reg` - the register
      `opIndex` - the op index
    Returns:
      default RefType

  - ### getDefaultStackRefType

    public static RefType getDefaultStackRefType(CodeUnit cu, int opIndex)
    Get the default register data RefType for the specified code-unit/opIndex and register
    Parameters:
      `cu` - the code unit to get the default stack ref type.
      `opIndex` - the operand index.
    Returns:
      the default register datat refType.

  - ### getDefaultFlowType

    public static FlowType getDefaultFlowType(Instruction instr, Address toAddr, boolean allowComputedFlowType)
    Determine default FlowType for a specified instruction and flow destination toAddr.
    Parameters:
      `instr` - instruction
      `toAddr` - flow destination address
      `allowComputedFlowType` - if true and an absolute flow type is not found a computed flow type will be returned if only one exists.
    Returns:
      FlowType or null if unable to determine

  - ### getDefaultComputedFlowType

    public static FlowType getDefaultComputedFlowType(Instruction instr)
    Determine default computed FlowType for a specified instruction. It is assumed that all computed flows utilize a register in its destination specification/computation.
    Parameters:
      `instr` - instruction
    Returns:
      FlowType or null if unable to determine

  - ### getDefaultMemoryRefType

    public static RefType getDefaultMemoryRefType(CodeUnit cu, int opIndex, Address toAddr, boolean ignoreExistingReferences)
    Get the default memory flow/data RefType for the specified code unit and opIndex.
    Parameters:
      `cu` - the code unit
      `opIndex` - the op index
      `toAddr` - reference destination
      `ignoreExistingReferences` - if true existing references will not influence default reference type returned.
    Returns:
      default RefType