Package ghidra.program.database.data
Class DataTypeManagerDB
- java.lang.Object
-
- ghidra.program.database.data.DataTypeManagerDB
-
- All Implemented Interfaces:
DataTypeManager
- Direct Known Subclasses:
ProgramDataTypeManager,ProjectDataTypeManager,StandAloneDataTypeManager
public abstract class DataTypeManagerDB extends java.lang.Object implements DataTypeManager
Base class for data type managers.
-
-
Field Summary
Fields Modifier and Type Field Description protected DataOrganizationdataOrganizationprotected DBHandledbHandleprotected DataTypeManagerChangeListenerHandlerdefaultListenerprotected ghidra.program.database.data.SourceArchiveAdaptersourceArchiveAdapterprotected UniversalIDuniversalID-
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 protectedDataTypeManagerDB()Construct a temporary data-type manager.protectedDataTypeManagerDB(DBHandle handle, AddressMap addrMap, int openMode, ErrorHandler errHandler, Lock lock, TaskMonitor monitor)ConstructorprotectedDataTypeManagerDB(ResourceFile packedDBfile, int openMode)Constructor for a data-type manager backed by a packed database file.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description DataTypeaddDataType(DataType originalDataType, DataTypeConflictHandler handler)Returns a data type after adding it to this data manager.voidaddDataTypeManagerListener(DataTypeManagerChangeListener l)Add a listener that is notified when the dataTypeManger changes.protected voidaddDataTypeToDelete(long id)voidaddInvalidatedListener(InvalidatedListener listener)Adds a listener that will be notified when this manager's cache is invalidated.voidassociateDataTypeWithArchive(DataType datatype, SourceArchive archive)Change the given data type so that its source archive is the given archiveprotected voidcategoryCreated(Category cat)protected voidcategoryMoved(CategoryPath oldPath, Category category)protected voidcategoryRemoved(Category parent, java.lang.String name, long categoryID)protected voidcategoryRenamed(CategoryPath oldPath, Category category)voidclearAllSettings(Address dataAddr)Clear all settings at the given address.booleanclearSetting(Address dataAddr, java.lang.String name)Clear the setting.voidclearSettings(Address start, Address end, TaskMonitor monitor)Clears all settings in the given address range.booleancontains(DataType dataType)Return true if the given dataType exists in this data type managerbooleancontainsCategory(CategoryPath path)Returns true if the given category path exists in this datatype managerCategorycreateCategory(CategoryPath path)Create a category for the given path; returns the current category if it already exitsprotected voiddataTypeAdded(DataType newDt, DataType originalDataType)voiddataTypeChanged(DataType dt)Notification when data type is changed.protected voiddataTypeDeleted(long deletedID, DataTypePath deletedDataTypePath)protected voiddataTypeMoved(DataType dt, DataTypePath oldDataTypePath, DataTypePath newDataTypePath)protected voiddataTypeNameChanged(DataType dt, java.lang.String oldName)protected voiddataTypeReplaced(long existingDtID, DataTypePath replacedDataTypePath, DataType replacementDt)voiddbError(java.io.IOException e)Handles IOExceptionsvoiddeleteAddressRange(Address startAddr, Address endAddr, TaskMonitor monitor)Removes all settings in the rangeprotected abstract voiddeleteDataTypeIDs(java.util.LinkedList<java.lang.Long> deletedIds, TaskMonitor monitor)voiddisassociate(DataType dataType)If the indicated data type is associated with a source archive, this will remove the association and the data type will become local to this data type manager.protected voiddoSourceArchiveUpdates(CompilerSpec compilerSpec, TaskMonitor monitor)This method is only invoked during an upgrade.protected voidfavoritesChanged(DataType dataType, boolean isFavorite)DataTypefindDataType(java.lang.String dataTypePath)Gets the dataType for the given path.DataTypefindDataTypeForID(UniversalID datatypeID)Get's the data type with the matching universal data type id.voidfindDataTypes(java.lang.String name, java.util.List<DataType> list)Begin searching at the root category for all data types with the given name.voidfindDataTypes(java.lang.String name, java.util.List<DataType> list, boolean caseSensitive, TaskMonitor monitor)Begin searching at the root category for all data types with names that match the given name that may contain wildcards.voidfindEnumValueNames(long value, java.util.Set<java.lang.String> enumValueNames)Adds all enum value names that match the given value, to the given set.java.util.Iterator<Composite>getAllComposites()Returns an iterator over all composite data types (structures and unions) in this managerjava.util.Iterator<DataType>getAllDataTypes()Returns an iterator over all the dataTypes in this managervoidgetAllDataTypes(java.util.List<DataType> list)Adds all data types to the specified list.]java.util.Iterator<Structure>getAllStructures()Returns an iterator over all structures in this managerbyte[]getByteSettingsValue(Address dataAddr, java.lang.String name)Get the byte array value for an instance setting.CategorygetCategory(long id)Get the category for the given ID.CategorygetCategory(CategoryPath path)Get the category that has the given pathintgetCategoryCount()Returns the total number of data type categoriesDataOrganizationgetDataOrganization()Get the data organization associated with this data type manager.DataTypegetDataType(long dataTypeID)Returns the dataType associated with the given dataTypeId or null if the dataTypeId is not validDataTypegetDataType(SourceArchive sourceArchive, UniversalID datatypeID)DataTypegetDataType(CategoryPath path, java.lang.String name)Gets the data type with the indicated name in the indicated category.DataTypegetDataType(DataTypePath dataTypePath)Find the dataType for the given dataTypePath.DataTypegetDataType(java.lang.String dataTypePath)Retrieve the data type with the fully qualified path.intgetDataTypeCount(boolean includePointersAndArrays)Returns the total number of defined data types.java.util.List<DataType>getDataTypes(SourceArchive sourceArchive)Returns all data types within this manager that have as their source the given archiveDataType[]getDataTypes(CategoryPath path)Gets the datatypes in the given category pathjava.util.Set<DataType>getDataTypesContaining(DataType dataType)Returns the data types within this data type manager that contain the specified data type.protected abstract java.lang.StringgetDomainFileID()java.util.List<DataType>getFavorites()Returns a list of datatypes that have been designated as favorites.longgetID(DataType dt)Returns the dataTypeId for the given dataType.longgetLastChangeTimeForMyManager()Returns the timestamp of the last time this manager was changedSourceArchivegetLocalSourceArchive()Returns the source archive for this managerjava.lang.LonggetLongSettingsValue(Address dataAddr, java.lang.String name)Get the long value for an instance setting.java.lang.String[]getNames(Address dataAddr)Returns all the Settings names for the given address.protected abstract java.lang.StringgetPath()PointergetPointer(DataType dt)Returns a default sized pointer to the given datatype.PointergetPointer(DataType dt, int size)Returns a pointer of the given size to the given datatype.longgetResolvedID(DataType dt)Returns the dataTypeId for the given dataType.CategorygetRootCategory()Returns the root category Managerjava.lang.ObjectgetSettings(Address dataAddr, java.lang.String name)Gets the value of a settings as an object (either String, byte[], or Long).SourceArchivegetSourceArchive(UniversalID sourceID)Returns the source archive for the given IDSourceArchivegetSourceArchive(java.lang.String fileID)java.util.List<SourceArchive>getSourceArchives()Returns a list of source archives not including the builtin or the program's archive.java.lang.StringgetStringSettingsValue(Address dataAddr, java.lang.String name)Get the String value for an instance setting.java.lang.StringgetUniqueName(CategoryPath path1, CategoryPath path2, java.lang.String baseName)java.lang.StringgetUniqueName(CategoryPath path, java.lang.String baseName)Returns a unique name not currently used by any other dataType or category with the same baseNameUniversalIDgetUniversalID()Returns the universal ID for this dataType managerjava.lang.StringgetUnusedConflictName(CategoryPath path, java.lang.String name)This method gets a ".conflict" name that is not currently used by any data types in the indicated category of the data type manager.voidinvalidateCache()Invalidates the cache.booleanisChanged()protected booleanisCreatingDataType()booleanisEmptySetting(Address dataAddr)Returns true if no settings are set for the given address.booleanisFavorite(DataType dataType)Returns true if the given datatype has been designated as a favorite.booleanisUpdatable()Returns true if this DataTypeManager can be modified.voidmoveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor)Move the settings in the range to the new start address.booleanremove(DataType dataType, TaskMonitor monitor)Remove the given datatype from this managervoidremoveDataTypeManagerListener(DataTypeManagerChangeListener l)Remove the DataTypeManger change listener.voidremoveInvalidatedListener(InvalidatedListener listener)Removes a previously added InvalidatedListenervoidremoveSourceArchive(SourceArchive sourceArchive)Removes the source archive from this manager.DataTypereplaceDataType(DataType existingDt, DataType replacementDt, boolean updateCategoryPath)Replace an existing dataType with another.protected abstract voidreplaceDataTypeIDs(long oldID, long newID)voidreplaceSourceArchive(SourceArchive oldSourceArchive, SourceArchive newSourceArchive)Replace one source archive (oldDTM) with another (newDTM).DataTyperesolve(DataType dataType, DataTypeConflictHandler handler)Returns a dataType that is "in" (ie suitable implementation) this Manager, creating a new one if necessary.SourceArchiveresolveSourceArchive(SourceArchive sourceArchive)Returns or creates a persisted version of the given source archivebooleansetByteSettingsValue(Address dataAddr, java.lang.String name, byte[] byteValue)Set the byte array value for instance settings.voidsetFavorite(DataType dataType, boolean isFavorite)Sets the given dataType to be either a favorite or not a favorite.booleansetLongSettingsValue(Address dataAddr, java.lang.String name, long value)Set the long value for instance settings.booleansetSettings(Address dataAddr, java.lang.String name, java.lang.Object value)Set the Object settings.booleansetStringSettingsValue(Address dataAddr, java.lang.String name, java.lang.String value)Set the string value for instance settings.protected voidsourceArchiveAdded(UniversalID sourceArchiveID)voidsourceArchiveChanged(UniversalID sourceArchiveID)voidupdateID()booleanupdateSourceArchiveName(UniversalID sourceID, java.lang.String name)Updates the name associated with a source archive in this data type manager.booleanupdateSourceArchiveName(java.lang.String archiveFileID, java.lang.String name)Updates the name associated with a source archive in this data type manager.-
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
close, endTransaction, flushEvents, getName, getType, setName, startTransaction
-
-
-
-
Field Detail
-
sourceArchiveAdapter
protected ghidra.program.database.data.SourceArchiveAdapter sourceArchiveAdapter
-
dbHandle
protected DBHandle dbHandle
-
defaultListener
protected DataTypeManagerChangeListenerHandler defaultListener
-
universalID
protected UniversalID universalID
-
dataOrganization
protected DataOrganization dataOrganization
-
-
Constructor Detail
-
DataTypeManagerDB
protected DataTypeManagerDB()
Construct a temporary data-type manager. Note that this manager does not support the save or saveAs operation.
-
DataTypeManagerDB
protected DataTypeManagerDB(ResourceFile packedDBfile, int openMode) throws java.io.IOException
Constructor for a data-type manager backed by a packed database file. When opening for UPDATE an automatic upgrade will be performed if required.- Parameters:
packedDBfile- packed datatype archive file (i.e., *.gdt resource).openMode- open mode CREATE, READ_ONLY or UPDATE (seeDBConstants)- Throws:
java.io.IOException- a low-level IO error. This exception may also be thrown when a version error occurs (cause is VersionException).
-
DataTypeManagerDB
protected DataTypeManagerDB(DBHandle handle, AddressMap addrMap, int openMode, ErrorHandler errHandler, Lock lock, TaskMonitor monitor) throws CancelledException, java.io.IOException, VersionException
Constructor- Parameters:
handle- database handleaddrMap- map to convert addresses to longs and longs to addressescreateTables- true if tables should be createdrootCategoryName- name of the root category- Throws:
CancelledExceptionjava.io.IOExceptionVersionException
-
-
Method Detail
-
getDomainFileID
protected abstract java.lang.String getDomainFileID()
-
getPath
protected abstract java.lang.String getPath()
-
getUniversalID
public UniversalID getUniversalID()
Description copied from interface:DataTypeManagerReturns the universal ID for this dataType manager- Specified by:
getUniversalIDin interfaceDataTypeManager- Returns:
- the universal ID for this dataType manager
-
updateID
public void updateID()
-
getFavorites
public java.util.List<DataType> getFavorites()
Description copied from interface:DataTypeManagerReturns a list of datatypes that have been designated as favorites.- Specified by:
getFavoritesin interfaceDataTypeManager- Returns:
- the list of favorite datatypes in this manager.
-
isFavorite
public boolean isFavorite(DataType dataType)
Description copied from interface:DataTypeManagerReturns true if the given datatype has been designated as a favorite. If the datatype does not belong to this datatype manager, then false will be returned.- Specified by:
isFavoritein interfaceDataTypeManager- Parameters:
dataType- the datatype to check.- Returns:
- true if the given datatype is a favorite in this manager.
-
setFavorite
public void setFavorite(DataType dataType, boolean isFavorite)
Description copied from interface:DataTypeManagerSets the given dataType to be either a favorite or not a favorite.- Specified by:
setFavoritein interfaceDataTypeManager- Parameters:
dataType- the datatype for which to change its status as a favorite.isFavorite- true if the datatype is to be a favorite or false otherwise.
-
getUniqueName
public java.lang.String getUniqueName(CategoryPath path, java.lang.String baseName)
Description copied from interface:DataTypeManagerReturns a unique name not currently used by any other dataType or category with the same baseName- Specified by:
getUniqueNamein interfaceDataTypeManager- Parameters:
path- the path of the namebaseName- the base name to be made unique- Returns:
- a unique name starting with baseName
-
getUniqueName
public java.lang.String getUniqueName(CategoryPath path1, CategoryPath path2, java.lang.String baseName)
-
getCategory
public Category getCategory(CategoryPath path)
Description copied from interface:DataTypeManagerGet the category that has the given path- Specified by:
getCategoryin interfaceDataTypeManager- Parameters:
path- the path- Returns:
- the category
-
getCategory
public Category getCategory(long id)
Get the category for the given ID.- Specified by:
getCategoryin interfaceDataTypeManager- Parameters:
id- id of the desired category- Returns:
- null if no category exists with the given ID.
-
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- Parameters:
dataType- the dataType to be resolved.handler- used to resolve conflicts with existing dataTypes.- Returns:
- an equivalent dataType that "belongs" to this dataTypeManager.
-
getUnusedConflictName
public java.lang.String getUnusedConflictName(CategoryPath path, java.lang.String name)
This method gets a ".conflict" name that is not currently used by any data types in the indicated category of the data type manager.- Parameters:
dtm- the data type manager.path- the category path of the category where the new data type live in the data type manager.name- The name of the data type. This name may or may not contain ".conflict" as part of it. If the name contains ".conflict", only the part of the name that comes prior to the ".conflict" will be used to determine a new unused conflict name.- Returns:
- the unused conflict name
-
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- Parameters:
originalDataType- the dataType to be resolved.handler- used to resolve conflicts with existing dataTypes.- Returns:
- an equivalent dataType that "belongs" to this dataTypeManager.
-
resolveSourceArchive
public SourceArchive resolveSourceArchive(SourceArchive sourceArchive)
Description copied from interface:DataTypeManagerReturns or creates a persisted version of the given source archive- Specified by:
resolveSourceArchivein interfaceDataTypeManager- Parameters:
sourceArchive- the archive- Returns:
- the archive
-
removeSourceArchive
public void removeSourceArchive(SourceArchive sourceArchive)
Description copied from interface:DataTypeManagerRemoves the source archive from this manager. This will disassociate all data types in this manager from the given archive.- Specified by:
removeSourceArchivein interfaceDataTypeManager- Parameters:
sourceArchive- the archive
-
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- 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;
-
replaceDataTypeIDs
protected abstract void replaceDataTypeIDs(long oldID, long newID)
-
replaceSourceArchive
public void replaceSourceArchive(SourceArchive oldSourceArchive, SourceArchive newSourceArchive)
Replace one source archive (oldDTM) with another (newDTM). Any data types whose source was the oldDTM will be changed to have a source that is the newDTM. The oldDTM will no longer be referenced as a source by this data type manager.- Parameters:
oldDTM- data type manager for the old source archivenewDTM- data type manager for the new source archive- Throws:
InvalidInputException- if the oldDTM isn't currently a source archive for this data type manager or if the old and new source archives already have the same unique ID.
-
findDataTypes
public void findDataTypes(java.lang.String name, java.util.List<DataType> list)Description copied from interface:DataTypeManagerBegin searching at the root category for all data types with the given name. Places all the data types in this data type manager with the given name into the list.- Specified by:
findDataTypesin interfaceDataTypeManager- Parameters:
name- name of the data typelist- list that will be populated with matching DataType objects
-
findDataTypes
public void findDataTypes(java.lang.String name, java.util.List<DataType> list, boolean caseSensitive, TaskMonitor monitor)Description copied from interface:DataTypeManagerBegin searching at the root category for all data types with names that match the given name that may contain wildcards.- Specified by:
findDataTypesin interfaceDataTypeManager- Parameters:
name- name to match; may contain wildcardslist- list that will be populated with matching DataType objectscaseSensitive- true if the match is case sensitivemonitor- task monitor to cancel the search
-
getDataType
public DataType getDataType(DataTypePath dataTypePath)
Description copied from interface:DataTypeManagerFind the dataType for the given dataTypePath.- Specified by:
getDataTypein interfaceDataTypeManager- Parameters:
dataTypePath- the DataTypePath for the datatype- Returns:
- the datatype for the given path.
-
getDataType
public DataType getDataType(java.lang.String dataTypePath)
Description copied from interface:DataTypeManagerRetrieve the data type with the fully qualified path. So you can get the data named "bar" in the category "foo" by calling getDataType("/foo/bar"). This method can be problematic now that datatype names can contain slashes. It will work provided that the part of the datatype name that precedes its internal slash is not also the name of a category in the same category as the datatype. For example, if you call getDataType("/a/b/c"), and "b/c" is the name of your datatype, it will find it unless there is also a category "b" under category "a". A better solution is to use theDataTypeManager.getDataType(DataTypePath)method because the DataTypePath keeps the category and datatype name separate.- Specified by:
getDataTypein interfaceDataTypeManager- Parameters:
dataTypePath- path- Returns:
- the dataType or null if it isn't found
-
findDataType
public DataType findDataType(java.lang.String dataTypePath)
Description copied from interface:DataTypeManagerGets the dataType for the given path. SeeDataTypeManager.getDataType(String)for details.- Specified by:
findDataTypein interfaceDataTypeManager- Parameters:
dataTypePath- dataType path- Returns:
- dataType at the given path
-
findEnumValueNames
public void findEnumValueNames(long value, java.util.Set<java.lang.String> enumValueNames)Description copied from interface:DataTypeManagerAdds all enum value names that match the given value, to the given set.- Specified by:
findEnumValueNamesin interfaceDataTypeManager- Parameters:
value- the value to look for enum name matchesenumValueNames- the set to add matches to.
-
getResolvedID
public long getResolvedID(DataType dt)
Description copied from interface:DataTypeManagerReturns the dataTypeId for the given dataType. If the dataType is not currently in the dataTypeManger, it will be added- Specified by:
getResolvedIDin interfaceDataTypeManager- Parameters:
dt- the data type- Returns:
- the ID of the resolved type
-
getID
public long getID(DataType dt)
Description copied from interface:DataTypeManagerReturns the dataTypeId for the given dataType. If the dataType does not exist, a -1 will be returned- Specified by:
getIDin interfaceDataTypeManager- Parameters:
dt- the datatype to get an id for- Returns:
- the ID of the type
-
getDataType
public DataType getDataType(long dataTypeID)
Description copied from interface:DataTypeManagerReturns the dataType associated with the given dataTypeId or null if the dataTypeId is not valid- Specified by:
getDataTypein interfaceDataTypeManager- Parameters:
dataTypeID- the ID- Returns:
- the type
-
addInvalidatedListener
public void addInvalidatedListener(InvalidatedListener listener)
Description copied from interface:DataTypeManagerAdds a listener that will be notified when this manager's cache is invalidated. This will happen when the system has changed and the manager cannot determine the exact change, like during an undo or a redo.- Specified by:
addInvalidatedListenerin interfaceDataTypeManager- Parameters:
listener- The listener to add
-
removeInvalidatedListener
public void removeInvalidatedListener(InvalidatedListener listener)
Description copied from interface:DataTypeManagerRemoves a previously added InvalidatedListener- Specified by:
removeInvalidatedListenerin interfaceDataTypeManager- Parameters:
listener- the listener to remove.
-
remove
public boolean remove(DataType dataType, TaskMonitor monitor)
Description copied from interface:DataTypeManagerRemove the given datatype from this manager- Specified by:
removein interfaceDataTypeManager- Parameters:
dataType- the dataType to be removedmonitor- the task monitor- Returns:
- true if the data type existed and was removed
-
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- Parameters:
datatype- the typearchive- the archive
-
disassociate
public void disassociate(DataType dataType)
Description copied from interface:DataTypeManagerIf the indicated data type is associated with a source archive, this will remove the association and the data type will become local to this data type manager.- Specified by:
disassociatein interfaceDataTypeManager- Parameters:
dataType- the data type to be disassociated from a source archive.
-
addDataTypeToDelete
protected void addDataTypeToDelete(long id)
-
deleteDataTypeIDs
protected abstract void deleteDataTypeIDs(java.util.LinkedList<java.lang.Long> deletedIds, TaskMonitor monitor) throws CancelledException- Throws:
CancelledException
-
contains
public boolean contains(DataType dataType)
Description copied from interface:DataTypeManagerReturn true if the given dataType exists in this data type manager- Specified by:
containsin interfaceDataTypeManager- Parameters:
dataType- the type- Returns:
- true if the type is in this manager
-
containsCategory
public boolean containsCategory(CategoryPath path)
Description copied from interface:DataTypeManagerReturns true if the given category path exists in this datatype manager- Specified by:
containsCategoryin interfaceDataTypeManager- Parameters:
path- the path- Returns:
- true if the given category path exists in this datatype manager
-
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- Parameters:
path- the path- Returns:
- the category
-
getRootCategory
public Category getRootCategory()
Description copied from interface:DataTypeManagerReturns the root category Manager- Specified by:
getRootCategoryin interfaceDataTypeManager- Returns:
- the category
-
getDataTypes
public DataType[] getDataTypes(CategoryPath path)
Gets the datatypes in the given category path- Parameters:
path- the category path in which to look for datatypes
-
getDataType
public DataType getDataType(CategoryPath path, java.lang.String name)
Description copied from interface:DataTypeManagerGets the data type with the indicated name in the indicated category.- Specified by:
getDataTypein interfaceDataTypeManager- Parameters:
path- the path for the categoryname- the data type's name- Returns:
- the data type.
-
getCategoryCount
public int getCategoryCount()
Description copied from interface:DataTypeManagerReturns the total number of data type categories- Specified by:
getCategoryCountin interfaceDataTypeManager- Returns:
- the count
-
getDataTypeCount
public int getDataTypeCount(boolean includePointersAndArrays)
Description copied from interface:DataTypeManagerReturns the total number of defined data types.- Specified by:
getDataTypeCountin interfaceDataTypeManager- Parameters:
includePointersAndArrays- if true all pointers and array data types will be included- Returns:
- the count
-
isChanged
public boolean isChanged()
-
getSourceArchives
public java.util.List<SourceArchive> getSourceArchives()
Description copied from interface:DataTypeManagerReturns a list of source archives not including the builtin or the program's archive.- Specified by:
getSourceArchivesin interfaceDataTypeManager- Returns:
- a list of source archives not including the builtin or the program's archive.
-
getSourceArchive
public SourceArchive getSourceArchive(java.lang.String fileID)
-
getSourceArchive
public SourceArchive getSourceArchive(UniversalID sourceID)
Description copied from interface:DataTypeManagerReturns the source archive for the given ID- Specified by:
getSourceArchivein interfaceDataTypeManager- Parameters:
sourceID- the ID- Returns:
- the archive; null if the ID is null; null if the archive does not exist
-
getLocalSourceArchive
public SourceArchive getLocalSourceArchive()
Description copied from interface:DataTypeManagerReturns the source archive for this manager- Specified by:
getLocalSourceArchivein interfaceDataTypeManager- Returns:
- the archive; null if the ID is null; null if the archive does not exist
-
updateSourceArchiveName
public boolean updateSourceArchiveName(java.lang.String archiveFileID, java.lang.String name)Description copied from interface:DataTypeManagerUpdates the name associated with a source archive in this data type manager.- Specified by:
updateSourceArchiveNamein interfaceDataTypeManager- Parameters:
archiveFileID- Universal domain file ID of the source data type archive that has a new name.name- the new name of the program or archive.- Returns:
- true if the name associated with the source data type archive was changed. false if it wasn't changed.
-
updateSourceArchiveName
public boolean updateSourceArchiveName(UniversalID sourceID, java.lang.String name)
Description copied from interface:DataTypeManagerUpdates the name associated with a source archive in this data type manager.- Specified by:
updateSourceArchiveNamein interfaceDataTypeManager- Parameters:
sourceID- Universal archive ID of the source data type archive that has a new name.name- the new name of the program or archive.- Returns:
- true if the name associated with the source data type archive was changed. false if it wasn't changed.
-
getDataTypes
public java.util.List<DataType> getDataTypes(SourceArchive sourceArchive)
Description copied from interface:DataTypeManagerReturns all data types within this manager that have as their source the given archive- Specified by:
getDataTypesin interfaceDataTypeManager- Parameters:
sourceArchive- the archive- Returns:
- the types
-
dbError
public void dbError(java.io.IOException e)
Handles IOExceptions- Parameters:
e- the exception to handle
-
getAllDataTypes
public java.util.Iterator<DataType> getAllDataTypes()
Description copied from interface:DataTypeManagerReturns an iterator over all the dataTypes in this manager- Specified by:
getAllDataTypesin interfaceDataTypeManager- Returns:
- an iterator over all the dataTypes in this manager
-
getAllDataTypes
public void getAllDataTypes(java.util.List<DataType> list)
Description copied from interface:DataTypeManagerAdds all data types to the specified list.]- Specified by:
getAllDataTypesin interfaceDataTypeManager- Parameters:
list- the result list into which the types will be placed
-
getAllStructures
public java.util.Iterator<Structure> getAllStructures()
Description copied from interface:DataTypeManagerReturns an iterator over all structures in this manager- Specified by:
getAllStructuresin interfaceDataTypeManager- Returns:
- the iterator
-
getAllComposites
public java.util.Iterator<Composite> getAllComposites()
Description copied from interface:DataTypeManagerReturns an iterator over all composite data types (structures and unions) in this manager- Specified by:
getAllCompositesin interfaceDataTypeManager- Returns:
- the iterator
-
invalidateCache
public void invalidateCache()
Invalidates the cache.
-
setLongSettingsValue
public boolean setLongSettingsValue(Address dataAddr, java.lang.String name, long value)
Set the long value for instance settings.- Parameters:
dataAddr- min address of dataname- settings namevalue- value of setting- Returns:
- true if the settings actually changed
-
setStringSettingsValue
public boolean setStringSettingsValue(Address dataAddr, java.lang.String name, java.lang.String value)
Set the string value for instance settings.- Parameters:
dataAddr- min address of dataname- settings namevalue- value of setting- Returns:
- true if the settings actually changed
-
setByteSettingsValue
public boolean setByteSettingsValue(Address dataAddr, java.lang.String name, byte[] byteValue)
Set the byte array value for instance settings.- Parameters:
dataAddr- min address of data ataname- settings namebyteValue- byte array value of setting- Returns:
- true if the settings actually changed
-
setSettings
public boolean setSettings(Address dataAddr, java.lang.String name, java.lang.Object value)
Set the Object settings.- Parameters:
dataAddr- min address of dataname- the name of the settingsvalue- the value for the settings, must be either a String, byte[] or Long
-
getLongSettingsValue
public java.lang.Long getLongSettingsValue(Address dataAddr, java.lang.String name)
Get the long value for an instance setting.- Parameters:
dataAddr- min address of dataname- settings name- Returns:
- null if the named setting was not found
-
getStringSettingsValue
public java.lang.String getStringSettingsValue(Address dataAddr, java.lang.String name)
Get the String value for an instance setting.- Parameters:
dataAddr- min address of dataname- settings name- Returns:
- null if the named setting was not found
-
getByteSettingsValue
public byte[] getByteSettingsValue(Address dataAddr, java.lang.String name)
Get the byte array value for an instance setting.- Parameters:
dataAddr- min address of dataname- settings name- Returns:
- null if the named setting was not found
-
getSettings
public java.lang.Object getSettings(Address dataAddr, java.lang.String name)
Gets the value of a settings as an object (either String, byte[], or Long).- Parameters:
dataAddr- the address of the data for this settingsname- the name of settings.
-
clearSetting
public boolean clearSetting(Address dataAddr, java.lang.String name)
Clear the setting.- Parameters:
dataAddr- min address of dataname- settings name
-
clearAllSettings
public void clearAllSettings(Address dataAddr)
Clear all settings at the given address.- Parameters:
dataAddr- the address for this settings.
-
clearSettings
public void clearSettings(Address start, Address end, TaskMonitor monitor) throws CancelledException
Clears all settings in the given address range.- Parameters:
start- the first address of the range to clearend- the last address of the range to clear.monitor- the progress monitor for this operation.- Throws:
CancelledException- if the user cancels the operation.
-
moveAddressRange
public void moveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor) throws CancelledException
Move the settings in the range to the new start address.- Parameters:
fromAddr- start address from where to movetoAddr- new Address to move tolength- number of addresses to move.monitor- progress monitor- Throws:
CancelledException
-
isUpdatable
public boolean isUpdatable()
Description copied from interface:DataTypeManagerReturns true if this DataTypeManager can be modified.- Specified by:
isUpdatablein interfaceDataTypeManager- Returns:
- true if this DataTypeMangaer can be modified.
-
getNames
public java.lang.String[] getNames(Address dataAddr)
Returns all the Settings names for the given address.- Parameters:
dataAddr- the address
-
isEmptySetting
public boolean isEmptySetting(Address dataAddr)
Returns true if no settings are set for the given address.- Parameters:
dataAddr- the address to test.
-
getDataTypesContaining
public java.util.Set<DataType> getDataTypesContaining(DataType dataType)
Description copied from interface:DataTypeManagerReturns the data types within this data type manager that contain the specified data type.- Specified by:
getDataTypesContainingin interfaceDataTypeManager- Parameters:
dataType- the data type- Returns:
- a set of data types that contain the specified data type.
-
getPointer
public Pointer getPointer(DataType dt)
Description copied from interface:DataTypeManagerReturns a default sized pointer to the given datatype. The pointer size is established dynamically based upon the data organization established by the compiler specification.- Specified by:
getPointerin interfaceDataTypeManager- Parameters:
dt- the pointed to data type- Returns:
- the pointer
-
getPointer
public Pointer getPointer(DataType dt, int size)
Description copied from interface:DataTypeManagerReturns a pointer of the given size to the given datatype. Note: It is preferred to use default sized pointers when possible (i.e., size=-1, seeDataTypeManager.getPointer(DataType)) instead of explicitly specifying the size value.- Specified by:
getPointerin interfaceDataTypeManager- Parameters:
dt- the pointed to data typesize- the size of the pointer to be created or -1 for a default sized pointer- Returns:
- the pointer
-
deleteAddressRange
public void deleteAddressRange(Address startAddr, Address endAddr, TaskMonitor monitor) throws CancelledException
Removes all settings in the range- 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.
-
addDataTypeManagerListener
public void addDataTypeManagerListener(DataTypeManagerChangeListener l)
Description copied from interface:DataTypeManagerAdd a listener that is notified when the dataTypeManger changes.- Specified by:
addDataTypeManagerListenerin interfaceDataTypeManager- Parameters:
l- the listener
-
removeDataTypeManagerListener
public void removeDataTypeManagerListener(DataTypeManagerChangeListener l)
Description copied from interface:DataTypeManagerRemove the DataTypeManger change listener.- Specified by:
removeDataTypeManagerListenerin interfaceDataTypeManager- Parameters:
l- the listener
-
isCreatingDataType
protected boolean isCreatingDataType()
- Returns:
- true if manager is in the process of adding/creating a new type
-
dataTypeChanged
public void dataTypeChanged(DataType dt)
Description copied from interface:DataTypeManagerNotification when data type is changed.- Specified by:
dataTypeChangedin interfaceDataTypeManager- Parameters:
dt- data type that is changed
-
dataTypeReplaced
protected void dataTypeReplaced(long existingDtID, DataTypePath replacedDataTypePath, DataType replacementDt)
-
dataTypeDeleted
protected void dataTypeDeleted(long deletedID, DataTypePath deletedDataTypePath)
-
dataTypeMoved
protected void dataTypeMoved(DataType dt, DataTypePath oldDataTypePath, DataTypePath newDataTypePath)
-
dataTypeNameChanged
protected void dataTypeNameChanged(DataType dt, java.lang.String oldName)
-
categoryCreated
protected void categoryCreated(Category cat)
-
categoryRenamed
protected void categoryRenamed(CategoryPath oldPath, Category category)
-
categoryRemoved
protected void categoryRemoved(Category parent, java.lang.String name, long categoryID)
-
categoryMoved
protected void categoryMoved(CategoryPath oldPath, Category category)
-
favoritesChanged
protected void favoritesChanged(DataType dataType, boolean isFavorite)
-
sourceArchiveChanged
public void sourceArchiveChanged(UniversalID sourceArchiveID)
-
sourceArchiveAdded
protected void sourceArchiveAdded(UniversalID sourceArchiveID)
-
getLastChangeTimeForMyManager
public long getLastChangeTimeForMyManager()
Description copied from interface:DataTypeManagerReturns the timestamp of the last time this manager was changed- Specified by:
getLastChangeTimeForMyManagerin interfaceDataTypeManager- Returns:
- the timestamp
-
getDataType
public DataType getDataType(SourceArchive sourceArchive, UniversalID datatypeID)
- Specified by:
getDataTypein interfaceDataTypeManager
-
findDataTypeForID
public DataType findDataTypeForID(UniversalID datatypeID)
Description copied from interface:DataTypeManagerGet's the data type with the matching universal data type id.- Specified by:
findDataTypeForIDin interfaceDataTypeManager- Parameters:
datatypeID- The universal id of the data type to search for- Returns:
- The data type with the matching UUID, or null if no such data type can be found.
-
getDataOrganization
public DataOrganization getDataOrganization()
Description copied from interface:DataTypeManagerGet the data organization associated with this data type manager. Note that the DataOrganization settings may not be changed dynamically.- Specified by:
getDataOrganizationin interfaceDataTypeManager- Returns:
- data organization (will never be null)
-
doSourceArchiveUpdates
protected void doSourceArchiveUpdates(CompilerSpec compilerSpec, TaskMonitor monitor) throws CancelledException
This method is only invoked during an upgrade.- Parameters:
compilerSpec-- Throws:
CancelledException
-
-