Class DataTypeCleaner

java.lang.Object
ghidra.program.util.DataTypeCleaner
All Implemented Interfaces:
Closeable, AutoCloseable

public class DataTypeCleaner extends Object implements Closeable
DataTypeCleaner provides a convenient way to clean composite definitions which may be included within a complex datatype which was derived from an source unrelated to a target DataTypeManager. The cleaning process entails clearing all details associated with all composites other than their description which may be present. There is also an option to retain those composites which are already defined within the target.
All datatypes and their referenced datatypes will be accumulated and possibly re-used across multiple invocations of the clean(DataType) method. It is important that this instance be closed when instance and any resulting DataType is no longer in use.
  • Constructor Details

    • DataTypeCleaner

      public DataTypeCleaner(DataTypeManager targetDtm, boolean retainExistingComposites)
      Consruct a DataTypeCleaner instance. The caller must ensure that this instance is closed when instance and any resulting DataType is no longer in use.
      Parameters:
      targetDtm - target datatype manager
      retainExistingComposites - if true all composites will be checked against the targetDtm and retained if it already exists, otherwise all composites will be cleaned.
  • Method Details

    • clean

      public DataType clean(DataType dt)
      Clean the specified datatype
      Parameters:
      dt - datatype
      Returns:
      clean datatype
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable