Class BuiltInDataTypeManager
- All Implemented Interfaces:
DataTypeManager,Closeable,AutoCloseable
-
Nested Class Summary
Nested classes/interfaces inherited from class ghidra.program.model.data.StandAloneDataTypeManager
StandAloneDataTypeManager.ArchiveWarning, StandAloneDataTypeManager.ArchiveWarningLevel, StandAloneDataTypeManager.LanguageUpdateOption -
Field Summary
Fields inherited from class ghidra.program.model.data.StandAloneDataTypeManager
nameFields inherited from class ghidra.program.database.data.DataTypeManagerDB
addrMap, dbHandle, DEFAULT_CALLING_CONVENTION_ID, defaultListener, errHandler, lock, readOnlyMode, sourceArchiveAdapter, tablePrefix, universalID, UNKNOWN_CALLING_CONVENTION_IDFields 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
Modifier and TypeMethodDescriptionaddDataType(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 and its dependencies so thier source archive is set to given archive.booleancanRedo()Determine if there is a transaction previously undone (seeStandAloneDataTypeManager.undo()) that can be redone (seeStandAloneDataTypeManager.redo()).booleancanUndo()Determine if there is a previous transaction that can be reverted/undone (seeStandAloneDataTypeManager.undo()).voidclose()Closes this dataType managercreateCategory(CategoryPath path) Create a category for the given path; returns the current category if it already exitsbooleanendTransaction(int transactionID, boolean commit) Ends the current transaction.static BuiltInDataTypeManagerReturns shared instance of built-in data type manager.getType()Returns this manager's archive typeprotected final booleanDetermine if a program architecture change is permittedprotected voidAdd 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 manager.replaceDataType(DataType existingDt, DataType replacementDt, boolean updateCategoryPath) Replace an existing dataType with another.resolve(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) voidSets this data type manager's nameprotected final voidsetProgramArchitecture(ProgramArchitecture programArchitecture, VariableStorageManager variableStorageMgr, boolean force, TaskMonitor monitor) Set the architecture-specific details associated with a new datatype manager.intstartTransaction(String description) Starts a transaction for making changes in this data type manager.Methods inherited from class ghidra.program.model.data.StandAloneDataTypeManager
clearProgramArchitecture, clearUndo, deleteDataTypesUsed, finalize, flushEvents, getAllRedoNames, getAllUndoNames, getDomainFileID, getName, getPath, getProgramArchitectureSummary, getRedoName, getTransactionCount, getUndoName, getWarning, getWarningDetail, getWarningMessage, handleDataOrganizationChange, initializeOtherAdapters, initTransactionState, isProgramArchitectureMissing, isProgramArchitectureUpgradeRequired, logWarning, openTransaction, redo, replaceDataTypesUsed, setImmutable, setProgramArchitecture, undoMethods inherited from class ghidra.program.database.data.DataTypeManagerDB
addDataTypeManagerListener, addDataTypes, addDataTypeToDelete, addDataTypeToReplace, addInvalidatedListener, allowsDefaultBuiltInSettings, allowsDefaultComponentSettings, categoryCreated, categoryMoved, categoryRemoved, categoryRenamed, compilerSpecChanged, contains, containsCategory, dataTypeAdded, dataTypeChanged, dataTypeDeleted, dataTypeMoved, dataTypeNameChanged, dataTypeReplaced, dataTypeSettingsChanged, dbError, dedupeAllConflicts, dedupeConflicts, 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, getFavorites, getID, getKnownCallingConventionNames, getLastChangeTimeForMyManager, getLocalSourceArchive, getPointer, getPointer, getProgramArchitecture, getProgramArchitectureSummary, getResolvedID, getRootCategory, getSourceArchive, getSourceArchive, getSourceArchives, getUniqueName, getUniversalID, getUnusedConflictName, getUnusedConflictName, getVariableStorageManager, hasDataOrganizationChange, hasParent, invalidateCache, isChanged, isCreatingDataType, isFavorite, isTransactionActive, isUpdatable, migrateOldFlexArrayComponentsIfRequired, notifyRestored, readDataOrganization, removeDataTypeManagerListener, removeInvalidatedListener, removeParentChildRecord, removeSourceArchive, replaceSourceArchive, resolveSourceArchive, saveDataOrganization, setFavorite, sourceArchiveAdded, sourceArchiveChanged, updateID, updateLastChangeTime, updateSourceArchiveName, updateSourceArchiveNameMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ghidra.program.model.data.DataTypeManager
withTransaction, withTransaction
-
Method Details
-
getDataTypeManager
Returns shared instance of built-in data type manager.- Returns:
- the manager
-
setProgramArchitecture
protected final void setProgramArchitecture(ProgramArchitecture programArchitecture, VariableStorageManager variableStorageMgr, boolean force, TaskMonitor monitor) throws IOException, CancelledException Description copied from class:StandAloneDataTypeManagerSet the architecture-specific details associated with a new datatype manager. This method is intended to be used during instantiation of derived implementations.- Overrides:
setProgramArchitecturein classStandAloneDataTypeManager- Parameters:
programArchitecture- program architecture details (required)variableStorageMgr- variable storage manager. Must be null.force- if true database update will occur and datatypes will be updated if any change to the data organization is detected (a stored copy may be used to detect this condition). This should never be passed as true if opened read-only. If true and no variable storage is specified it will be created.monitor- task monitor- Throws:
IOException- if IO error occursCancelledException- if task cancelled
-
isArchitectureChangeAllowed
protected final boolean isArchitectureChangeAllowed()Description copied from class:StandAloneDataTypeManagerDetermine if a program architecture change is permitted- Overrides:
isArchitectureChangeAllowedin classStandAloneDataTypeManager- Returns:
- true if change allowed else false if disallowed
-
startTransaction
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 boolean endTransaction(int transactionID, boolean commit) Description copied from interface:DataTypeManagerEnds the current transaction.NOTE: If multiple transactions are outstanding the full transaction will not be ended until all transactions have been ended. If any of the transactions indicate a false for
committhe transaction will ultimately be rolled-back when the final transaction is ended.NOTE: Use of rollback (
commit=falseshould be avoided unless absolutely neccessary since it will incur overhead to revert changes and may rollback multiple concurrent transactions if they exist.NOTE: If this manager is part of a larger
DomainObjectits transactions may become entangled with other transactions at a higher level. In such cases, use of theDomainObjecttransaction interface is preferred. The return value from this method cannot be relied on in such cases.- 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 should be rolled back.- Returns:
- true if this invocation was the final transaction and all changes were comitted.
-
canUndo
public boolean canUndo()Description copied from class:StandAloneDataTypeManagerDetermine if there is a previous transaction that can be reverted/undone (seeStandAloneDataTypeManager.undo()).- Overrides:
canUndoin classStandAloneDataTypeManager- Returns:
- true if there is a previous transaction that can be reverted/undone, else false.
-
canRedo
public boolean canRedo()Description copied from class:StandAloneDataTypeManagerDetermine if there is a transaction previously undone (seeStandAloneDataTypeManager.undo()) that can be redone (seeStandAloneDataTypeManager.redo()).- Overrides:
canRedoin classStandAloneDataTypeManager- Returns:
- true if there is a transaction previously undone that can be redone, else false
-
createCategory
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
-
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
-
getType
Description copied from interface:DataTypeManagerReturns this manager's archive type- Specified by:
getTypein interfaceDataTypeManager- Overrides:
getTypein classStandAloneDataTypeManager- Returns:
- the type
-
resolve
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
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
Description 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
Description copied from interface:DataTypeManagerChange the given data type and its dependencies so thier source archive is set to given archive. Only those data types not already associated with a source archive will be changed.- Specified by:
associateDataTypeWithArchivein interfaceDataTypeManager- Overrides:
associateDataTypeWithArchivein classDataTypeManagerDB- Parameters:
datatype- the typearchive- the archive
-
remove
Description copied from interface:DataTypeManagerRemove the given datatype from this manager.
NOTE: Any use of the specified datatype within aFunctionDefinitionwill be converted to thedefault 'undefined' datatype. Any use within aStructureorUnionwill be converted to theBadDataTypeas a placeholder to retain the component's field name and length (the comment will be prefixed with a message indicating the remval of the old datatype.- 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;
-
close
public void close()Description copied from interface:DataTypeManagerCloses this dataType manager- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceDataTypeManager- Overrides:
closein classStandAloneDataTypeManager
-