Package ghidra.program.model.data
Class DataTypeInstance
- java.lang.Object
-
- ghidra.program.model.data.DataTypeInstance
-
public class DataTypeInstance extends java.lang.Object
An instance of a DataType that is applicable for a given context. Most dataTypes are not context sensitive and are suitable for use anywhere. Others like dynamic structures need to create an instance that wraps the data type. It helps for situations where a data type must have a length.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DataTypeInstance(DataType dt, int length)
Create an instance of a data type with the given length.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DataType
getDataType()
static DataTypeInstance
getDataTypeInstance(DataType dataType, int length)
Attempt to create a fixed-length data-type instance.static DataTypeInstance
getDataTypeInstance(DataType dataType, MemBuffer buf)
Generate a data-type instance Factory and Dynamic data-types are NOT handled.static DataTypeInstance
getDataTypeInstance(DataType dataType, MemBuffer buf, int length)
Attempt to create a data-type instance associated with a specific memory location.int
getLength()
void
setLength(int length)
Set the length of this data type instancejava.lang.String
toString()
-
-
-
Constructor Detail
-
DataTypeInstance
protected DataTypeInstance(DataType dt, int length)
Create an instance of a data type with the given length.- Parameters:
dt
- data typelength
- fixed length of the data type
-
-
Method Detail
-
getDataType
public DataType getDataType()
- Returns:
- the data type
-
getLength
public int getLength()
- Returns:
- the fixed length of the data type
-
setLength
public void setLength(int length)
Set the length of this data type instance
-
getDataTypeInstance
public static DataTypeInstance getDataTypeInstance(DataType dataType, MemBuffer buf)
Generate a data-type instance Factory and Dynamic data-types are NOT handled.- Parameters:
dataType
-buf
-- Returns:
- data-type instance or null if one could not be determined
-
getDataTypeInstance
public static DataTypeInstance getDataTypeInstance(DataType dataType, int length)
Attempt to create a fixed-length data-type instance. Factory and non-sizable Dynamic data-types are NOT handled.- Parameters:
dataType
-length
- length for sizable Dynamic data-types, otherwise ignored- Returns:
- data-type instance or null if unable to create instance.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getDataTypeInstance
public static DataTypeInstance getDataTypeInstance(DataType dataType, MemBuffer buf, int length)
Attempt to create a data-type instance associated with a specific memory location. Factory and Dynamic data-types are handled.- Parameters:
dataType
-buf
- memory locationlength
- length for sizable Dynamic data-types, otherwise ignored- Returns:
- data-type instance or null if unable to create instance.
-
-