Package ghidra.program.model.data
Class BuiltInDataTypeManager
- java.lang.Object
-
- ghidra.program.database.data.DataTypeManagerDB
-
- ghidra.program.model.data.StandAloneDataTypeManager
-
- ghidra.program.model.data.BuiltInDataTypeManager
-
- All Implemented Interfaces:
DataTypeManager
public class BuiltInDataTypeManager extends StandAloneDataTypeManager
Data type manager for built in types that do not live anywhere except in memory.
-
-
Field Summary
-
Fields inherited from class ghidra.program.model.data.StandAloneDataTypeManager
name
-
Fields inherited from class ghidra.program.database.data.DataTypeManagerDB
dataOrganization, dbHandle, defaultListener, sourceArchiveAdapter, universalID
-
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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DataTypeaddDataType(DataType originalDataType, DataTypeConflictHandler handler)Returns a data type after adding it to this data manager.voidassociateDataTypeWithArchive(DataType datatype, SourceArchive archive)Change the given data type so that its source archive is the given archivevoidclose()Closes this dataType managerCategorycreateCategory(CategoryPath path)Create a category for the given path; returns the current category if it already exitsvoidendTransaction(int transactionID, boolean commit)Ends the current transactionstatic BuiltInDataTypeManagergetDataTypeManager()Returns shared instance of built-in data-type manager.ArchiveTypegetType()Returns this manager's archive typeprotected voidpopulateBuiltInTypes()Add the built in data types to the default built in folder if they were not found in any other category.booleanremove(DataType dataType, TaskMonitor monitor)Remove the given datatype from this managerDataTypereplaceDataType(DataType existingDt, DataType replacementDt, boolean updateCategoryPath)Replace an existing dataType with another.DataTyperesolve(DataType dataType, DataTypeConflictHandler handler)Returns a dataType that is "in" (ie suitable implementation) this Manager, creating a new one if necessary.protected UniversalIDresolveSourceArchiveID(DataType dataType)voidsetName(java.lang.String name)Sets this data type manager's nameintstartTransaction(java.lang.String description)Starts a transaction for making changes in this data type manager.-
Methods inherited from class ghidra.program.model.data.StandAloneDataTypeManager
deleteDataTypeIDs, finalize, flushEvents, getDomainFileID, getName, getPath, replaceDataTypeIDs
-
Methods inherited from class ghidra.program.database.data.DataTypeManagerDB
addDataTypeManagerListener, addDataTypeToDelete, addInvalidatedListener, categoryCreated, categoryMoved, categoryRemoved, categoryRenamed, clearAllSettings, clearSetting, clearSettings, contains, containsCategory, dataTypeAdded, dataTypeChanged, dataTypeDeleted, dataTypeMoved, dataTypeNameChanged, dataTypeReplaced, dbError, deleteAddressRange, disassociate, doSourceArchiveUpdates, favoritesChanged, findDataType, findDataTypeForID, findDataTypes, findDataTypes, findEnumValueNames, getAllComposites, getAllDataTypes, getAllDataTypes, getAllStructures, getByteSettingsValue, getCategory, getCategory, getCategoryCount, getDataOrganization, getDataType, getDataType, getDataType, getDataType, getDataType, getDataTypeCount, getDataTypes, getDataTypes, getDataTypesContaining, getFavorites, getID, getLastChangeTimeForMyManager, getLocalSourceArchive, getLongSettingsValue, getNames, getPointer, getPointer, getResolvedID, getRootCategory, getSettings, getSourceArchive, getSourceArchive, getSourceArchives, getStringSettingsValue, getUniqueName, getUniqueName, getUniversalID, getUnusedConflictName, invalidateCache, isChanged, isCreatingDataType, isEmptySetting, isFavorite, isUpdatable, moveAddressRange, removeDataTypeManagerListener, removeInvalidatedListener, removeSourceArchive, replaceSourceArchive, resolveSourceArchive, setByteSettingsValue, setFavorite, setLongSettingsValue, setSettings, setStringSettingsValue, sourceArchiveAdded, sourceArchiveChanged, updateID, updateSourceArchiveName, updateSourceArchiveName
-
-
-
-
Method Detail
-
getDataTypeManager
public static BuiltInDataTypeManager getDataTypeManager()
Returns shared instance of built-in data-type manager.
-
startTransaction
public int startTransaction(java.lang.String description)
Description copied from interface:DataTypeManagerStarts a transaction for making changes in this data type manager.- Specified by:
startTransactionin interfaceDataTypeManager- Overrides:
startTransactionin classStandAloneDataTypeManager- Parameters:
description- a short description of the changes to be made.- Returns:
- the transaction ID
-
endTransaction
public void endTransaction(int transactionID, boolean commit)Description copied from interface:DataTypeManagerEnds the current transaction- Specified by:
endTransactionin interfaceDataTypeManager- Overrides:
endTransactionin classStandAloneDataTypeManager- Parameters:
transactionID- id of the transaction to endcommit- true if changes are committed, false if changes in transaction are revoked
-
createCategory
public Category createCategory(CategoryPath path)
Description copied from interface:DataTypeManagerCreate a category for the given path; returns the current category if it already exits- Specified by:
createCategoryin interfaceDataTypeManager- Overrides:
createCategoryin classDataTypeManagerDB- Parameters:
path- the path- Returns:
- the category
-
close
public void close()
Description copied from interface:DataTypeManagerCloses this dataType manager- Specified by:
closein interfaceDataTypeManager- Overrides:
closein classStandAloneDataTypeManager
-
populateBuiltInTypes
protected void populateBuiltInTypes()
Add the built in data types to the default built in folder if they were not found in any other category.
-
resolveSourceArchiveID
protected UniversalID resolveSourceArchiveID(DataType dataType)
-
getType
public ArchiveType getType()
Description copied from interface:DataTypeManagerReturns this manager's archive type- Specified by:
getTypein interfaceDataTypeManager- Overrides:
getTypein classStandAloneDataTypeManager- Returns:
- the type
-
resolve
public DataType resolve(DataType dataType, DataTypeConflictHandler handler)
Description copied from interface:DataTypeManagerReturns a dataType that is "in" (ie suitable implementation) this Manager, creating a new one if necessary. Also the returned dataType will be in a category in this dataTypeManager that is equivalent to the category of the passed in dataType.- Specified by:
resolvein interfaceDataTypeManager- Overrides:
resolvein classDataTypeManagerDB- Parameters:
dataType- the dataType to be resolved.handler- used to resolve conflicts with existing dataTypes.- Returns:
- an equivalent dataType that "belongs" to this dataTypeManager.
-
addDataType
public DataType addDataType(DataType originalDataType, DataTypeConflictHandler handler)
Description copied from interface:DataTypeManagerReturns a data type after adding it to this data manager. The returned dataType will be in a category in this dataTypeManager that is equivalent to the category of the passed in dataType.- Specified by:
addDataTypein interfaceDataTypeManager- Overrides:
addDataTypein classDataTypeManagerDB- Parameters:
originalDataType- the dataType to be resolved.handler- used to resolve conflicts with existing dataTypes.- Returns:
- an equivalent dataType that "belongs" to this dataTypeManager.
-
setName
public void setName(java.lang.String name) throws InvalidNameExceptionDescription copied from interface:DataTypeManagerSets this data type manager's name- Specified by:
setNamein interfaceDataTypeManager- Overrides:
setNamein classStandAloneDataTypeManager- Parameters:
name- the new name- Throws:
InvalidNameException- if the given name is invalid (such as when null or empty)
-
associateDataTypeWithArchive
public void associateDataTypeWithArchive(DataType datatype, SourceArchive archive)
Description copied from interface:DataTypeManagerChange the given data type so that its source archive is the given archive- Specified by:
associateDataTypeWithArchivein interfaceDataTypeManager- Overrides:
associateDataTypeWithArchivein classDataTypeManagerDB- Parameters:
datatype- the typearchive- the archive
-
remove
public boolean remove(DataType dataType, TaskMonitor monitor)
Description copied from interface:DataTypeManagerRemove the given datatype from this manager- Specified by:
removein interfaceDataTypeManager- Overrides:
removein classDataTypeManagerDB- Parameters:
dataType- the dataType to be removedmonitor- the task monitor- Returns:
- true if the data type existed and was removed
-
replaceDataType
public DataType replaceDataType(DataType existingDt, DataType replacementDt, boolean updateCategoryPath) throws DataTypeDependencyException
Description copied from interface:DataTypeManagerReplace an existing dataType with another. All instances and references will be updated to use the replacement dataType.- Specified by:
replaceDataTypein interfaceDataTypeManager- Overrides:
replaceDataTypein classDataTypeManagerDB- Parameters:
existingDt- the dataType to be replaced.replacementDt- the dataType to use as the replacement.updateCategoryPath- if true, the replacementDt will have its categoryPath changed to the exitingDt's path.- Returns:
- the resolved replacement dataType.
- Throws:
DataTypeDependencyException- if the replacement datatype depends on the existing dataType;
-
-