Package ghidra.program.model.data
Class StructureFactory
- java.lang.Object
-
- ghidra.program.model.data.StructureFactory
-
public class StructureFactory extends java.lang.Object
Creates and initializesStructure
objects.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_STRUCTURE_NAME
-
Constructor Summary
Constructors Constructor Description StructureFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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, java.lang.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, java.lang.String structureName, boolean makeUniqueName)
Creates aStructureDataType
instance, which is inside of another structure, based upon the information provided.
-
-
-
Field Detail
-
DEFAULT_STRUCTURE_NAME
public static final java.lang.String DEFAULT_STRUCTURE_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
createStructureDataType
public static Structure createStructureDataType(Program program, Address address, int dataLength)
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:
java.lang.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, java.lang.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:
java.lang.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:
java.lang.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, java.lang.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:
java.lang.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
-
-