Class DataTypeImpl
- All Implemented Interfaces:
DataType
- Direct Known Subclasses:
ArrayDataType,BuiltIn,DefaultDataType,GenericDataType,MissingBuiltInDataType
-
Field Summary
FieldsFields inherited from class ghidra.program.model.data.AbstractDataType
categoryPath, dataMgr, nameFields inherited from interface ghidra.program.model.data.DataType
CONFLICT_SUFFIX, DEFAULT, NO_LAST_CHANGE_TIME, NO_SOURCE_SYNC_TIME, TYPEDEF_ATTRIBUTE_PREFIX, TYPEDEF_ATTRIBUTE_SUFFIX, VOID -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDataTypeImpl(CategoryPath path, String name, DataTypeManager dataMgr) -
Method Summary
Modifier and TypeMethodDescriptionvoidInform this data type that it has the given parent
TODO: This method is reserved for internal DB use.final booleanintGet the aligned-length of this datatype as a number of 8-bit bytes.intGets the alignment to be used when aligning this datatype within another datatype.Gets the settings for this data type.longGet the timestamp corresponding to the last time this type was changed within its datatype managerlongGet the timestamp corresponding to the last time this type was sync'd within its source archiveGet the parents of this datatype.Get the full category path name that includes this datatype's name.Get the list of settings definitions available for use with this datatype.Get the source archive where this type originatedGet the universal ID for this datatype.Class<?> getValueClass(Settings settings) Get the Class of the value Object to be returned by this datatype (seeDataType.getValue(MemBuffer, Settings, int)).inthashCode()protected voidNotify all parents that this datatype's alignment has changedprotected voidNotify all parents that this datatype has been deletedprotected voidnotifyNameChanged(String oldName) Notify all parents that this datatype's name has changedprotected final voidnotifyParents(Consumer<DataType> consumer) protected voidnotifyReplaced(DataType replacement) Notify any parents that I have been replaced.protected voidNotify all parents that the size of this datatype has changed or other significant change that may affect a parent containing this datatype.voidremoveParent(DataType dt) Remove a parent datatypevoidreplaceWith(DataType dataType) For datatypes that support change, this method replaces the internals of this datatype with the internals of the given datatype.voidsetDescription(String description) Sets a String briefly describing this DataType.voidsetLastChangeTime(long lastChangeTime) Sets the lastChangeTime for this datatype.voidsetLastChangeTimeInSourceArchive(long lastChangeTimeInSourceArchive) Sets the lastChangeTimeInSourceArchive for this datatype.voidsetSourceArchive(SourceArchive archive) Set the source archive where this type originatedMethods inherited from class ghidra.program.model.data.AbstractDataType
dataTypeAlignmentChanged, dataTypeDeleted, dataTypeNameChanged, dataTypeReplaced, dataTypeSizeChanged, dependsOn, encodeRepresentation, encodeValue, getCategoryPath, getDataOrganization, getDataOrganization, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDisplayName, getMnemonic, getName, getTypeDefSettingsDefinitions, hasLanguageDependantLength, isDeleted, isEncodable, isNotYetDefined, isZeroLength, setCategoryPath, setName, setNameAndCategory, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface ghidra.program.model.data.DataType
clone, copy, getDescription, getLength, getRepresentation, getValue, isEquivalent
-
Field Details
-
defaultSettings
-
-
Constructor Details
-
DataTypeImpl
-
-
Method Details
-
getValueClass
Description copied from interface:DataTypeGet the Class of the value Object to be returned by this datatype (seeDataType.getValue(MemBuffer, Settings, int)).- Parameters:
settings- the relevant settings to use or null for default.- Returns:
- Class of the value to be returned by this datatype or null if it can vary or is unspecified. Types which correspond to a string or char array will return the String class.
-
getDefaultSettings
Description copied from interface:DataTypeGets the settings for this data type. The settings may have underlying default settings and may in turn become defaults for instance-specific settings (e.g., Data or DataTypeComponent). It is important to note that these settings are tied to a specific DataType instantiation so it is important to understand the scope of its use. Example: TheBuiltInDataTypeManagerhas its own set of DataType instances which are separate from those which have been instantiated or resolved to a specific Program/ArchiveDataTypeManager. Settings manipulation may be disabled by default in some instances.- Returns:
- the settings for this dataType.
-
getSettingsDefinitions
Description copied from interface:DataTypeGet the list of settings definitions available for use with this datatype.In the case of a
TypeDef, the return list will include theTypeDefSettingsDefinitionlist from the associated base data type.Unlike
TypeDefSettingsDefinitionstandard settings definitions generally support default, component-default and data-instance use. In addition, standard settings definitions are never considered duringDataType.isEquivalent(DataType)checking or during the resolve process.- Returns:
- list of the settings definitions for this datatype.
-
getPathName
Description copied from interface:DataTypeGet the full category path name that includes this datatype's name.If the category is null, then this just the datatype's name is returned.
- Specified by:
getPathNamein interfaceDataType- Overrides:
getPathNamein classAbstractDataType- Returns:
- the path, or just this type's name
-
getAlignedLength
public int getAlignedLength()Description copied from interface:DataTypeGet the aligned-length of this datatype as a number of 8-bit bytes.For primitive datatypes this is equivalent to the C/C++ "sizeof" operation within source code and should be used when determining
Arrayelement length or component sizing for aComposite. ForPointer,CompositeandArraytypes this will return the same value asDataType.getLength().Example: For x86 32-bit gcc an 80-bit
long doubleraw data lengthof 10-bytes will fit within a floating point register while itsaligned-lengthof 12-bytes is used by the gcc compiler for data/array/component allocations to maintain alignment (i.e.,sizeof(long double)).NOTE: Other than the
VoidDataType, no datatype should ever return 0, even ifDataType.isZeroLength(), and onlyDynamic/FactoryDataType/FunctionDefinitiondatatypes should return -1. IfDataType.isZeroLength()is true a length of 1 should be returned.- Returns:
- byte length of binary encoding.
-
getAlignment
public int getAlignment()Description copied from interface:DataTypeGets the alignment to be used when aligning this datatype within another datatype.- Returns:
- this datatype's alignment.
-
addParent
Description copied from interface:DataTypeInform this data type that it has the given parent
TODO: This method is reserved for internal DB use.- Specified by:
addParentin interfaceDataType- Overrides:
addParentin classAbstractDataType- Parameters:
dt- parent data type
-
removeParent
Description copied from interface:DataTypeRemove a parent datatypeTODO: This method is reserved for internal DB use.
- Specified by:
removeParentin interfaceDataType- Overrides:
removeParentin classAbstractDataType- Parameters:
dt- parent datatype
-
getParents
Description copied from interface:DataTypeGet the parents of this datatype. NOTE: This method is intended to be used on a DB-managed datatype only and is not fully supported for use with non-DB datatype instances.- Specified by:
getParentsin interfaceDataType- Overrides:
getParentsin classAbstractDataType- Returns:
- parents of this datatype
-
notifySizeChanged
protected void notifySizeChanged()Notify all parents that the size of this datatype has changed or other significant change that may affect a parent containing this datatype. -
notifyAlignmentChanged
protected void notifyAlignmentChanged()Notify all parents that this datatype's alignment has changed -
notifyNameChanged
Notify all parents that this datatype's name has changed- Parameters:
oldName-
-
notifyDeleted
protected void notifyDeleted()Notify all parents that this datatype has been deleted -
notifyReplaced
Notify any parents that I have been replaced.- Parameters:
replacement- replacement data type
-
notifyParents
-
getLastChangeTime
public long getLastChangeTime()Description copied from interface:DataTypeGet the timestamp corresponding to the last time this type was changed within its datatype manager- Specified by:
getLastChangeTimein interfaceDataType- Overrides:
getLastChangeTimein classAbstractDataType- Returns:
- timestamp of last change within datatype manager
-
getLastChangeTimeInSourceArchive
public long getLastChangeTimeInSourceArchive()Description copied from interface:DataTypeGet the timestamp corresponding to the last time this type was sync'd within its source archive- Specified by:
getLastChangeTimeInSourceArchivein interfaceDataType- Overrides:
getLastChangeTimeInSourceArchivein classAbstractDataType- Returns:
- timestamp of last sync with source archive
-
getSourceArchive
Description copied from interface:DataTypeGet the source archive where this type originated- Specified by:
getSourceArchivein interfaceDataType- Overrides:
getSourceArchivein classAbstractDataType- Returns:
- source archive object
-
setSourceArchive
Description copied from interface:DataTypeSet the source archive where this type originated- Specified by:
setSourceArchivein interfaceDataType- Overrides:
setSourceArchivein classAbstractDataType- Parameters:
archive- source archive object
-
getUniversalID
Description copied from interface:DataTypeGet the universal ID for this datatype.This value is intended to be a unique identifier across all programs and archives. The same ID indicates that two datatypes were originally the same one. Keep in mind names, categories, and component makeup may differ and have changed since there origin.
- Specified by:
getUniversalIDin interfaceDataType- Overrides:
getUniversalIDin classAbstractDataType- Returns:
- datatype UniversalID
-
replaceWith
Description copied from interface:DataTypeFor datatypes that support change, this method replaces the internals of this datatype with the internals of the given datatype.The datatypes must be of the same "type" (i.e. structure can only be replacedWith another structure.
- Specified by:
replaceWithin interfaceDataType- Overrides:
replaceWithin classAbstractDataType- Parameters:
dataType- the datatype that contains the internals to upgrade to.
-
setLastChangeTime
public void setLastChangeTime(long lastChangeTime) Description copied from interface:DataTypeSets the lastChangeTime for this datatype.Normally, this is updated automatically when a datatype is changed, but when committing or updating while synchronizing an archive, the lastChangeTime may need to be updated externally.
- Specified by:
setLastChangeTimein interfaceDataType- Overrides:
setLastChangeTimein classAbstractDataType- Parameters:
lastChangeTime- the time to use as the lastChangeTime for this datatype
-
setLastChangeTimeInSourceArchive
public void setLastChangeTimeInSourceArchive(long lastChangeTimeInSourceArchive) Description copied from interface:DataTypeSets the lastChangeTimeInSourceArchive for this datatype.This is used by when a datatype change is committed back to its source archive.
- Specified by:
setLastChangeTimeInSourceArchivein interfaceDataType- Overrides:
setLastChangeTimeInSourceArchivein classAbstractDataType- Parameters:
lastChangeTimeInSourceArchive- the time to use as the lastChangeTimeInSourceArchive for this datatype
-
setDescription
Sets a String briefly describing this DataType.
If a data type that extends this class wants to allow the description to be changed, then it must override this method.- Specified by:
setDescriptionin interfaceDataType- Overrides:
setDescriptionin classAbstractDataType- Parameters:
description- a one-liner describing this DataType.- Throws:
UnsupportedOperationException- if the description is not allowed to be set for this data type.
-
hashCode
public int hashCode() -
equals
-