Package ghidra.program.model.data
Class ParameterDefinitionImpl
java.lang.Object
ghidra.program.model.data.ParameterDefinitionImpl
- All Implemented Interfaces:
ParameterDefinition
,Comparable<ParameterDefinition>
-
Constructor Summary
ModifierConstructorDescriptionParameterDefinitionImpl
(String name, DataType dataType, String comment) Constructs a new ParameterImp with an unassigned ordinal.protected
ParameterDefinitionImpl
(String name, DataType dataType, String comment, int ordinal) Constructs a new ParameterImp -
Method Summary
Modifier and TypeMethodDescriptionfinal int
Get the Comment for this variableGet the Data Type of this variableint
Get the length of this variablegetName()
Get the Name of this variable.int
Get the parameter ordinalboolean
Determine if parm is equivalent to this parameter definition by both ordinal and datatype.boolean
isEquivalent
(Variable variable) Determine if a variable corresponds to a parameter which is equivalent to this parameter definition by both ordinal and datatype.void
setComment
(String comment) Set the comment for this variablevoid
setDataType
(DataType type) Set the Data Type of this variable.void
Set the name of this variable.toString()
static DataType
validateDataType
(DataType dataType, DataTypeManager dtMgr, boolean voidOK) Check the specified datatype for use as a return, parameter or variable type.
-
Constructor Details
-
ParameterDefinitionImpl
Constructs a new ParameterImp with an unassigned ordinal. The ordinal will be established by the function definition.- Parameters:
name
- the name of the parameter.dataType
- the fixed-length datatype of the parametercomment
- the comment to store about this parameter.- Throws:
IllegalArgumentException
- if invalid parameter datatype specified
-
ParameterDefinitionImpl
Constructs a new ParameterImp- Parameters:
name
- the name of the parameter.dataType
- the fixed-length datatype of the parametercomment
- the comment to store about this parameter.ordinal
- the index of this parameter within the function signature.- Throws:
IllegalArgumentException
- if invalid parameter datatype specified
-
-
Method Details
-
validateDataType
public static DataType validateDataType(DataType dataType, DataTypeManager dtMgr, boolean voidOK) throws IllegalArgumentException Check the specified datatype for use as a return, parameter or variable type. It may not be suitable for other uses. The following datatypes will be mutated into a default pointer datatype:- Function definition datatype
- An unsized/zero-element array
- Parameters:
dataType
- datatype to be checked. If null specified the DEFAULT datatype will be returned.dtMgr
- target datatype manager (null permitted which will adopt default data organization)voidOK
- true if checking return datatype and void is allow, else false.- Returns:
- cloned/mutated datatype suitable for function parameters and variables (including function return data type).
- Throws:
IllegalArgumentException
- if an unacceptable datatype was specified
-
compareTo
- Specified by:
compareTo
in interfaceComparable<ParameterDefinition>
-
getOrdinal
public int getOrdinal()Description copied from interface:ParameterDefinition
Get the parameter ordinal- Specified by:
getOrdinal
in interfaceParameterDefinition
- Returns:
- the ordinal (index) of this parameter within the function signature.
-
getComment
Description copied from interface:ParameterDefinition
Get the Comment for this variable- Specified by:
getComment
in interfaceParameterDefinition
- Returns:
- the comment
-
getDataType
Description copied from interface:ParameterDefinition
Get the Data Type of this variable- Specified by:
getDataType
in interfaceParameterDefinition
- Returns:
- the data type of the variable
-
getLength
public int getLength()Description copied from interface:ParameterDefinition
Get the length of this variable- Specified by:
getLength
in interfaceParameterDefinition
- Returns:
- the length of the variable
-
getName
Description copied from interface:ParameterDefinition
Get the Name of this variable.- Specified by:
getName
in interfaceParameterDefinition
- Returns:
- the name of the variable or null if no name has been specified.
-
setComment
Description copied from interface:ParameterDefinition
Set the comment for this variable- Specified by:
setComment
in interfaceParameterDefinition
- Parameters:
comment
- the comment
-
setDataType
Description copied from interface:ParameterDefinition
Set the Data Type of this variable.- Specified by:
setDataType
in interfaceParameterDefinition
- Parameters:
type
- dataType the fixed-length datatype of the parameter
-
setName
Description copied from interface:ParameterDefinition
Set the name of this variable.- Specified by:
setName
in interfaceParameterDefinition
- Parameters:
name
- the name
-
isEquivalent
Description copied from interface:ParameterDefinition
Determine if a variable corresponds to a parameter which is equivalent to this parameter definition by both ordinal and datatype. Name is not considered relevant.- Specified by:
isEquivalent
in interfaceParameterDefinition
- Parameters:
variable
- variable to be compared with this parameter definition.- Returns:
- true if the specified variable represents the same parameter by ordinal
and dataType. False will always be returned if specified variable is
not a
Parameter
.
-
isEquivalent
Description copied from interface:ParameterDefinition
Determine if parm is equivalent to this parameter definition by both ordinal and datatype. Name is not considered relevant.- Specified by:
isEquivalent
in interfaceParameterDefinition
- Parameters:
parm
- parameter definition to be compared with this parameter definition.- Returns:
- true if the specified parameter definition represents the same parameter by ordinal and dataType.
-
toString
-