Package ghidra.app.cmd.data

# Class CreateDataBackgroundCmd

java.lang.Object
ghidra.framework.cmd.BackgroundCommand<Program>
ghidra.app.cmd.data.CreateDataBackgroundCmd

All Implemented Interfaces:
  `Command<Program>`

public class CreateDataBackgroundCmd extends BackgroundCommand<Program>
This command will create a data of type dataType throughout an addressSet. If there are any existing instructions in the area to be made into data, the command will fail. Any data in the area will be replaced with the new dataType, except when the existing data or the given dataType is a pointer. If the existing dataType is a pointer, then it will be changed into a pointer to the given dataType. If the given dataType is a pointer and the existing data is >= to the size of a pointer, it will become a pointer to the existing type. If the existing dataType is less than the size of a pointer, then a pointer to dataType will only be created if there are enough undefined bytes following to make a pointer.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CreateDataBackgroundCmd(AddressSetView addrSet, DataType dataType)`
  Constructs a command for applying a dataType to a set of addresses.
  `CreateDataBackgroundCmd(AddressSetView addrSet, DataType dataType, boolean stackPointers)`
  This is the same as `CreateDataBackgroundCmd(AddressSetView, DataType)` except that it allows the caller to control whether or not a pointer data type is created when a non-pointer data type is applied at a location that previously contained a pointer data type.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `applyTo(Program program, TaskMonitor monitor)`
  Method called when this command is to apply changes to the given domain object.

  ### Methods inherited from class ghidra.framework.cmd.BackgroundCommand

  `applyTo, canCancel, dispose, getName, getStatusMsg, hasProgress, isModal, run, setStatusMsg, taskCompleted, toString`

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

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

- ## Constructor Details

  - ### CreateDataBackgroundCmd

    public CreateDataBackgroundCmd(AddressSetView addrSet, DataType dataType)
    Constructs a command for applying a dataType to a set of addresses. Simple pointer conversion will NOT be performed.
    Parameters:
      `addrSet` - The address set to fill with the given dataType.
      `dataType` - the dataType to be applied to the address set.

  - ### CreateDataBackgroundCmd

    public CreateDataBackgroundCmd(AddressSetView addrSet, DataType dataType, boolean stackPointers)
    This is the same as `CreateDataBackgroundCmd(AddressSetView, DataType)` except that it allows the caller to control whether or not a pointer data type is created when a non-pointer data type is applied at a location that previously contained a pointer data type.
    Parameters:
      `addrSet` - The address set to fill with the given dataType.
      `dataType` - the dataType to be applied to the address set.
      `stackPointers` - if true simple pointer conversion is enabled (see `DataUtilities.reconcileAppliedDataType(DataType, DataType, boolean)`).

- ## Method Details

  - ### applyTo

    public boolean applyTo(Program program, TaskMonitor monitor)
    Description copied from class: `BackgroundCommand`
    Method called when this command is to apply changes to the given domain object. A monitor is provided to display status information about the command as it executes in the background.
    Specified by:
      `applyTo` in class `BackgroundCommand<Program>`
    Parameters:
      `program` - domain object that will be affected by the command
      `monitor` - monitor to show progress of the command
    Returns:
      true if the command applied successfully