Package ghidra.program.database.data

# Class ProgramBasedDataTypeManagerDB

java.lang.Object
ghidra.program.database.data.DataTypeManagerDB
ghidra.program.database.data.ProgramBasedDataTypeManagerDB

All Implemented Interfaces:
  `DataTypeManager`, `DomainFileBasedDataTypeManager`, `FileBasedDataTypeManager`, `ProgramBasedDataTypeManager`

Direct Known Subclasses:
  `DBTraceDataTypeManager`, `ProgramDataTypeManager`

public abstract class ProgramBasedDataTypeManagerDB extends DataTypeManagerDB implements ProgramBasedDataTypeManager
DB-based Program datatype manager implementation which has the concept of an address-based listing and corresponding datatype instance settings.

- ## Field Summary

  ### Fields inherited from class ghidra.program.database.data.DataTypeManagerDB

  `addrMap, dbHandle, DEFAULT_CALLING_CONVENTION_ID, defaultListener, errHandler, lock, readOnlyMode, sourceArchiveAdapter, tablePrefix, universalID, UNKNOWN_CALLING_CONVENTION_ID`

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

  `BAD_DATATYPE_ID, BUILT_IN_ARCHIVE_KEY, BUILT_IN_ARCHIVE_UNIVERSAL_ID, BUILT_IN_DATA_TYPES_NAME, DEFAULT_DATATYPE_ID, LOCAL_ARCHIVE_KEY, LOCAL_ARCHIVE_UNIVERSAL_ID, NULL_DATATYPE_ID`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `ProgramBasedDataTypeManagerDB(DBHandle handle, AddressMap addrMap, OpenMode openMode, String tablePrefix, ErrorHandler errHandler, Lock lock, TaskMonitor monitor)`
  Constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clearAllSettings(Data data)`
  Clear all settings for the given data.
  `boolean`
  `clearSetting(Data data, String name)`
  Clear the specified setting for the given data
  `protected abstract void`
  `dataSettingChanged(Address address)`
  Provides notification when a data instance setting has changed at a specific address.
  `void`
  `deleteAddressRange(Address startAddr, Address endAddr, TaskMonitor monitor)`
  Removes all settings in the range
  `static Address`
  `getDataSettingsAddress(Data data)`
  `String[]`
  `getInstanceSettingsNames(Data data)`
  Returns all the instance Settings names used for the specified data
  `Long`
  `getLongSettingsValue(Data data, String name)`
  Get the long value for data instance settings.
  `Object`
  `getSettings(Data data, String name)`
  Gets the value for data instance settings in Object form.
  `String`
  `getStringSettingsValue(Data data, String name)`
  Get the String value for data instance settings.
  `protected void`
  `initializeOtherAdapters(OpenMode openMode, TaskMonitor monitor)`
  Initialize other DB adapters after base implementation adapters has been initialized.
  `void`
  `invalidateCache()`
  Invalidates the cache.
  `boolean`
  `isChangeAllowed(Data data, SettingsDefinition settingsDefinition)`
  Determine if a settings change is permitted for the specified settingsDefinition.
  `boolean`
  `isEmptySetting(Data data)`
  Returns true if no settings are set for the given data
  `void`
  `moveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor)`
  Move the settings in the range to the new start address
  `boolean`
  `setLongSettingsValue(Data data, String name, long value)`
  Set the long value for data instance settings.
  `boolean`
  `setSettings(Data data, String name, Object value)`
  Set the Object value for data instance settings.
  `boolean`
  `setStringSettingsValue(Data data, String name, String value)`
  Set the string value for data instance settings.

  ### Methods inherited from class ghidra.program.database.data.DataTypeManagerDB

  `addDataType, addDataTypeManagerListener, addDataTypes, addDataTypeToDelete, addDataTypeToReplace, addInvalidatedListener, allowsDefaultBuiltInSettings, allowsDefaultComponentSettings, associateDataTypeWithArchive, categoryCreated, categoryMoved, categoryRemoved, categoryRenamed, close, compilerSpecChanged, contains, containsCategory, createCategory, dataTypeAdded, dataTypeChanged, dataTypeDeleted, dataTypeMoved, dataTypeNameChanged, dataTypeReplaced, dataTypeSettingsChanged, dbError, dedupeAllConflicts, dedupeConflicts, deleteDataTypesUsed, disassociate, dispose, doSourceArchiveUpdates, favoritesChanged, findDataType, findDataTypeForID, findDataTypes, findDataTypes, findEnumValueNames, fixupComposites, getAddressMap, getAllComposites, getAllDataTypes, getAllDataTypes, getAllFunctionDefinitions, getAllStructures, getCallingConvention, getCallingConventionID, getCallingConventionName, getCategory, getCategory, getCategoryCount, getChildIds, getDataMap, getDataOrganization, getDataType, getDataType, getDataType, getDataType, getDataType, getDataTypeCount, getDataTypes, getDataTypes, getDataTypesContaining, getDefaultCallingConvention, getDefinedCallingConventionNames, getDomainFileID, getFavorites, getID, getKnownCallingConventionNames, getLastChangeTimeForMyManager, getLocalSourceArchive, getPath, getPointer, getPointer, getProgramArchitecture, getProgramArchitectureSummary, getProgramArchitectureSummary, getResolvedID, getRootCategory, getSourceArchive, getSourceArchive, getSourceArchives, getUniqueName, getUniversalID, getUnusedConflictName, getUnusedConflictName, getVariableStorageManager, handleDataOrganizationChange, hasDataOrganizationChange, hasParent, isChanged, isCreatingDataType, isFavorite, isTransactionActive, isUpdatable, migrateOldFlexArrayComponentsIfRequired, notifyRestored, readDataOrganization, remove, remove, removeDataTypeManagerListener, removeInvalidatedListener, removeParentChildRecord, removeSourceArchive, replaceDataType, replaceDataTypesUsed, replaceSourceArchive, resolve, resolveSourceArchive, saveDataOrganization, setFavorite, setProgramArchitecture, sourceArchiveAdded, sourceArchiveChanged, updateID, updateLastChangeTime, updateSourceArchiveName, updateSourceArchiveName`

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

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

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

  `addDataType, addDataTypeManagerListener, addDataTypes, addInvalidatedListener, allowsDefaultBuiltInSettings, allowsDefaultComponentSettings, associateDataTypeWithArchive, close, contains, containsCategory, createCategory, disassociate, endTransaction, findDataType, findDataTypeForID, findDataTypes, findDataTypes, findEnumValueNames, flushEvents, getAddressMap, getAllComposites, getAllDataTypes, getAllDataTypes, getAllFunctionDefinitions, getAllStructures, getCallingConvention, getCategory, getCategory, getCategoryCount, getDataOrganization, getDataType, getDataType, getDataType, getDataType, getDataType, getDataTypeCount, getDataTypes, getDataTypesContaining, getDefaultCallingConvention, getDefinedCallingConventionNames, getFavorites, getID, getKnownCallingConventionNames, getLastChangeTimeForMyManager, getLocalSourceArchive, getName, getPointer, getPointer, getProgramArchitecture, getProgramArchitectureSummary, getResolvedID, getRootCategory, getSourceArchive, getSourceArchives, getType, getUniqueName, getUniversalID, isFavorite, isUpdatable, openTransaction, remove, remove, remove, removeDataTypeManagerListener, removeInvalidatedListener, removeSourceArchive, replaceDataType, resolve, resolveSourceArchive, setFavorite, setName, startTransaction, updateSourceArchiveName, updateSourceArchiveName, withTransaction, withTransaction`

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

  `getDomainFile`

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

  `getPath`

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

  `getProgram`

- ## Constructor Details

  - ### ProgramBasedDataTypeManagerDB

    protected ProgramBasedDataTypeManagerDB(DBHandle handle, AddressMap addrMap, OpenMode openMode, String tablePrefix, ErrorHandler errHandler, Lock lock, TaskMonitor monitor) throws CancelledException, VersionException, IOException
    Constructor
    Parameters:
      `handle` - open database handle
      `addrMap` - the address map (instance settings not supported if null)
      `openMode` - the program open mode
      `tablePrefix` - DB table prefix to be applied to all associated table names. This need only be specified when using multiple instances with the same DB handle (null or empty string for no-prefix).
      `errHandler` - the database io error handler
      `lock` - the program synchronization lock
      `monitor` - the progress monitor
    Throws:
      `CancelledException` - if the user cancels an upgrade
      `VersionException` - if the database does not match the expected version.
      `IOException` - if a database IO error occurs.

- ## Method Details

  - ### initializeOtherAdapters

    protected void initializeOtherAdapters(OpenMode openMode, TaskMonitor monitor) throws CancelledException, IOException, VersionException
    Description copied from class: `DataTypeManagerDB`
    Initialize other DB adapters after base implementation adapters has been initialized.
    Overrides:
      `initializeOtherAdapters` in class `DataTypeManagerDB`
    Parameters:
      `openMode` - the DB open mode
      `monitor` - the progress monitor
    Throws:
      `CancelledException` - if the user cancels an upgrade
      `IOException` - if a database IO error occurs.
      `VersionException` - if the database does not match the expected version.

  - ### invalidateCache

    public void invalidateCache()
    Description copied from class: `DataTypeManagerDB`
    Invalidates the cache.
    Overrides:
      `invalidateCache` in class `DataTypeManagerDB`

  - ### dataSettingChanged

    protected abstract void dataSettingChanged(Address address)
    Provides notification when a data instance setting has changed at a specific address.
    Parameters:
      `address` - data address

  - ### isChangeAllowed

    public boolean isChangeAllowed(Data data, SettingsDefinition settingsDefinition)
    Description copied from interface: `ProgramBasedDataTypeManager`
    Determine if a settings change is permitted for the specified settingsDefinition.
    Specified by:
      `isChangeAllowed` in interface `ProgramBasedDataTypeManager`
    Parameters:
      `data` - data code unit
      `settingsDefinition` - settings definition
    Returns:
      true if change permitted else false

  - ### setLongSettingsValue

    public boolean setLongSettingsValue(Data data, String name, long value)
    Description copied from interface: `ProgramBasedDataTypeManager`
    Set the long value for data instance settings.
    Specified by:
      `setLongSettingsValue` in interface `ProgramBasedDataTypeManager`
    Parameters:
      `data` - data code unit
      `name` - settings name
      `value` - value of setting
    Returns:
      true if the settings actually changed

  - ### setStringSettingsValue

    public boolean setStringSettingsValue(Data data, String name, String value)
    Description copied from interface: `ProgramBasedDataTypeManager`
    Set the string value for data instance settings.
    Specified by:
      `setStringSettingsValue` in interface `ProgramBasedDataTypeManager`
    Parameters:
      `data` - data code unit
      `name` - settings name
      `value` - value of setting
    Returns:
      true if the settings actually changed

  - ### setSettings

    public boolean setSettings(Data data, String name, Object value)
    Description copied from interface: `ProgramBasedDataTypeManager`
    Set the Object value for data instance settings.
    Specified by:
      `setSettings` in interface `ProgramBasedDataTypeManager`
    Parameters:
      `data` - data code unit
      `name` - the name of the settings
      `value` - the value for the settings, must be either a String, byte[] or Long
    Returns:
      true if the settings were updated

  - ### getLongSettingsValue

    public Long getLongSettingsValue(Data data, String name)
    Description copied from interface: `ProgramBasedDataTypeManager`
    Get the long value for data instance settings.
    Specified by:
      `getLongSettingsValue` in interface `ProgramBasedDataTypeManager`
    Parameters:
      `data` - data code unit
      `name` - settings name
    Returns:
      null if the named setting was not found

  - ### getStringSettingsValue

    public String getStringSettingsValue(Data data, String name)
    Description copied from interface: `ProgramBasedDataTypeManager`
    Get the String value for data instance settings.
    Specified by:
      `getStringSettingsValue` in interface `ProgramBasedDataTypeManager`
    Parameters:
      `data` - data code unit
      `name` - settings name
    Returns:
      null if the named setting was not found

  - ### getSettings

    public Object getSettings(Data data, String name)
    Description copied from interface: `ProgramBasedDataTypeManager`
    Gets the value for data instance settings in Object form.
    Specified by:
      `getSettings` in interface `ProgramBasedDataTypeManager`
    Parameters:
      `data` - data code unit
      `name` - the name of settings.
    Returns:
      the settings object

  - ### clearSetting

    public boolean clearSetting(Data data, String name)
    Description copied from interface: `ProgramBasedDataTypeManager`
    Clear the specified setting for the given data
    Specified by:
      `clearSetting` in interface `ProgramBasedDataTypeManager`
    Parameters:
      `data` - data code unit
      `name` - settings name
    Returns:
      true if the settings were cleared

  - ### clearAllSettings

    public void clearAllSettings(Data data)
    Description copied from interface: `ProgramBasedDataTypeManager`
    Clear all settings for the given data.
    Specified by:
      `clearAllSettings` in interface `ProgramBasedDataTypeManager`
    Parameters:
      `data` - data code unit

  - ### moveAddressRange

    public void moveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor) throws CancelledException
    Description copied from interface: `ProgramBasedDataTypeManager`
    Move the settings in the range to the new start address
    Specified by:
      `moveAddressRange` in interface `ProgramBasedDataTypeManager`
    Parameters:
      `fromAddr` - start address from where to move
      `toAddr` - new Address to move to
      `length` - number of addresses to move
      `monitor` - progress monitor
    Throws:
      `CancelledException` - if the operation was cancelled

  - ### getInstanceSettingsNames

    public String[] getInstanceSettingsNames(Data data)
    Description copied from interface: `ProgramBasedDataTypeManager`
    Returns all the instance Settings names used for the specified data
    Specified by:
      `getInstanceSettingsNames` in interface `ProgramBasedDataTypeManager`
    Parameters:
      `data` - data code unit
    Returns:
      the names

  - ### isEmptySetting

    public boolean isEmptySetting(Data data)
    Description copied from interface: `ProgramBasedDataTypeManager`
    Returns true if no settings are set for the given data
    Specified by:
      `isEmptySetting` in interface `ProgramBasedDataTypeManager`
    Parameters:
      `data` - data code unit
    Returns:
      true if not settings

  - ### deleteAddressRange

    public void deleteAddressRange(Address startAddr, Address endAddr, TaskMonitor monitor) throws CancelledException
    Description copied from interface: `ProgramBasedDataTypeManager`
    Removes all settings in the range
    Specified by:
      `deleteAddressRange` in interface `ProgramBasedDataTypeManager`
    Parameters:
      `startAddr` - the first address in the range.
      `endAddr` - the last address in the range.
      `monitor` - the progress monitor
    Throws:
      `CancelledException` - if the user cancelled the operation.

  - ### getDataSettingsAddress

    public static Address getDataSettingsAddress(Data data)