Package ghidra.program.model.data
Class StructureFactory
java.lang.Object
ghidra.program.model.data.StructureFactory
Creates and initializes
Structure
objects.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Structure
createStructureDataType
(Program program, Address address, int dataLength) Creates aStructureDataType
instance based upon the information provided.static Structure
createStructureDataType
(Program program, Address address, int dataLength, String structureName, boolean makeUniqueName) Creates aStructureDataType
instance based upon the information provided.static Structure
createStructureDataTypeInStrucuture
(Program program, Address address, int[] fromPath, int[] toPath) Creates aStructureDataType
instance, which is inside of another structure, based upon the information provided.static Structure
createStructureDataTypeInStrucuture
(Program program, Address address, int[] fromPath, int[] toPath, String structureName, boolean makeUniqueName) Creates aStructureDataType
instance, which is inside of another structure, based upon the information provided.
-
Field Details
-
DEFAULT_STRUCTURE_NAME
- See Also:
-
-
Constructor Details
-
StructureFactory
public StructureFactory()
-
-
Method Details
-
createStructureDataType
Creates aStructureDataType
instance based upon the information provided. The instance will not be placed in memory.This method is just a pass-through method for
createStructureDataType(Program,Address,int,String,boolean)
equivalent to calling:Structure newStructure = StructureFactory.createStructureDataType( program, address, dataLength, DEFAULT_STRUCTURE_NAME, true );
- Parameters:
program
- The program to which the structure will belong.address
- The address of the structure.dataLength
- The number of components to add to the structure.- Returns:
- A new structure not yet added to memory.
- Throws:
IllegalArgumentException
- for the following conditions:- if
dataLength
is not greater than zero - if the number of components to add exceeds the available address space
- if there are any instructions in the provided address space
- if there are no data components to add to the structure
- if
-
createStructureDataType
public static Structure createStructureDataType(Program program, Address address, int dataLength, String structureName, boolean makeUniqueName) Creates aStructureDataType
instance based upon the information provided. The instance will not be placed in memory.- Parameters:
program
- The program to which the structure will belong.address
- The address of the structure.dataLength
- The number of components to add to the structure.structureName
- The name of the structure to create.makeUniqueName
- True indicates that the provided name should be altered as necessary in order to make it unique in the program.- Returns:
- A new structure not yet added to memory.
- Throws:
IllegalArgumentException
- for the following conditions:- if
structureName
isnull
- if
dataLength
is not greater than zero - if the number of components to add exceeds the available address space
- if there are any instructions in the provided address space
- if there are no data components to add to the structure
- if
-
createStructureDataTypeInStrucuture
public static Structure createStructureDataTypeInStrucuture(Program program, Address address, int[] fromPath, int[] toPath) Creates aStructureDataType
instance, which is inside of another structure, based upon the information provided. The instance will not be placed in memory.This method is just a pass-through method for
createStructureDataTypeInStrucuture(Program,Address,int[],int[],String,boolean)
equivalent to calling:Structure newStructure = StructureFactory.createStructureDataTypeInStrucuture( program, address, fromPath, toPath, DEFAULT_STRUCTURE_NAME, true );
- Parameters:
program
- The program to which the structure will belong.address
- The address of the structure.fromPath
- The path to the first element in the parent structure that will be in the new structure.toPath
- The path to the last element in the parent structure that will be in the new structure.- Returns:
- A new structure not yet added to memory.
- Throws:
IllegalArgumentException
- for the following conditions:- if the component at
fromPath
or the component attoPath
are null - if there is not data to add to the structure
- if the parent data type is not a structure
- if the component at
-
createStructureDataTypeInStrucuture
public static Structure createStructureDataTypeInStrucuture(Program program, Address address, int[] fromPath, int[] toPath, String structureName, boolean makeUniqueName) Creates aStructureDataType
instance, which is inside of another structure, based upon the information provided. The instance will not be placed in memory.- Parameters:
program
- The program to which the structure will belong.address
- The address of the structure.fromPath
- The path to the first element in the parent structure that will be in the new structure.toPath
- The path to the last element in the parent structure that will be in the new structure.structureName
- the name of the structure to createmakeUniqueName
- True indicates that the provided name should be altered as necessary in order to make it unique in the program.- Returns:
- A new structure not yet added to memory.
- Throws:
IllegalArgumentException
- for the following conditions:- if
structureName
isnull
- if the component at
fromPath
or the component attoPath
are null - if there is not data to add to the structure
- if the parent data type is not a structure
- if
-