Package ghidra.app.services
Interface BlockModelService
-
public interface BlockModelServiceService for providing block models.
-
-
Field Summary
Fields Modifier and Type Field Description static intBASIC_MODELType for a simple block model.static java.lang.StringDEFAULT_BLOCK_MODEL_NAMEDefault basic block model (Simple Block Model)static java.lang.StringDEFAULT_SUBROUTINE_MODEL_NAMEDefault subroutine model (M-Model)static java.lang.StringISOLATED_ENTRY_SUBROUTINE_MODEL_NAMEName of the implementation for a subroutine that has a unique entry point, which may share code with other subroutines.static java.lang.StringMULTI_ENTRY_SUBROUTINE_MODEL_NAMEName of the implementation for a subroutine with multiple entry points.static java.lang.StringOVERLAPPED_SUBROUTINE_MODEL_NAMEName of the implementation for an overlapped subroutine model.static java.lang.StringPARTITIONED_SUBROUTINE_MODEL_NAMEName of the implementation for a subroutine that does not share code with other subroutines and may have one or more entry points.static java.lang.StringSIMPLE_BLOCK_MODEL_NAMEName of the implementation for a Simple block model.static intSUBROUTINE_MODELType for a subroutine block model.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddListener(BlockModelServiceListener listener)Add service listener.CodeBlockModelgetActiveBlockModel()Get new instance of the active Basic Block model for the current program.CodeBlockModelgetActiveBlockModel(boolean includeExternals)Get new instance of the active Basic Block model for the current program.CodeBlockModelgetActiveBlockModel(Program program)Get new instance of the active Basic Block model.CodeBlockModelgetActiveBlockModel(Program program, boolean includeExternals)Get new instance of the active Basic Block model.java.lang.StringgetActiveBlockModelName()Get the name of the active Basic Block model.CodeBlockModelgetActiveSubroutineModel()Get new instance of the active Subroutine Block model for the current program.CodeBlockModelgetActiveSubroutineModel(boolean includeExternals)Get new instance of the active Subroutine Block model for the current program.CodeBlockModelgetActiveSubroutineModel(Program program)Get new instance of the active Subroutine Block model.CodeBlockModelgetActiveSubroutineModel(Program program, boolean includeExternals)Get new instance of the active Subroutine Block model.java.lang.StringgetActiveSubroutineModelName()Get the name of the active Subroutine model.java.lang.String[]getAvailableModelNames(int modelType)Get list of registered block models of the specified type.CodeBlockModelgetNewModelByName(java.lang.String modelName)Get new instance of the specified block model.CodeBlockModelgetNewModelByName(java.lang.String modelName, boolean includeExternals)Get new instance of the specified block model.CodeBlockModelgetNewModelByName(java.lang.String modelName, Program program)Get new instance of the specified block model.CodeBlockModelgetNewModelByName(java.lang.String modelName, Program program, boolean includeExternals)Get new instance of the specified block model.voidregisterModel(java.lang.Class<? extends CodeBlockModel> modelClass, java.lang.String modelName)Register a new model.voidremoveListener(BlockModelServiceListener listener)Remove service listener.voidunregisterModel(java.lang.Class<? extends CodeBlockModel> modelClass)Deregister a model.
-
-
-
Field Detail
-
BASIC_MODEL
static final int BASIC_MODEL
Type for a simple block model.- See Also:
SimpleBlockModel, Constant Field Values
-
SUBROUTINE_MODEL
static final int SUBROUTINE_MODEL
Type for a subroutine block model.- See Also:
- Constant Field Values
-
SIMPLE_BLOCK_MODEL_NAME
static final java.lang.String SIMPLE_BLOCK_MODEL_NAME
Name of the implementation for a Simple block model.- See Also:
- Constant Field Values
-
MULTI_ENTRY_SUBROUTINE_MODEL_NAME
static final java.lang.String MULTI_ENTRY_SUBROUTINE_MODEL_NAME
Name of the implementation for a subroutine with multiple entry points.- See Also:
- Constant Field Values
-
ISOLATED_ENTRY_SUBROUTINE_MODEL_NAME
static final java.lang.String ISOLATED_ENTRY_SUBROUTINE_MODEL_NAME
Name of the implementation for a subroutine that has a unique entry point, which may share code with other subroutines.- See Also:
- Constant Field Values
-
OVERLAPPED_SUBROUTINE_MODEL_NAME
static final java.lang.String OVERLAPPED_SUBROUTINE_MODEL_NAME
Name of the implementation for an overlapped subroutine model.- See Also:
- Constant Field Values
-
PARTITIONED_SUBROUTINE_MODEL_NAME
static final java.lang.String PARTITIONED_SUBROUTINE_MODEL_NAME
Name of the implementation for a subroutine that does not share code with other subroutines and may have one or more entry points.- See Also:
- Constant Field Values
-
DEFAULT_BLOCK_MODEL_NAME
static final java.lang.String DEFAULT_BLOCK_MODEL_NAME
Default basic block model (Simple Block Model)- See Also:
- Constant Field Values
-
DEFAULT_SUBROUTINE_MODEL_NAME
static final java.lang.String DEFAULT_SUBROUTINE_MODEL_NAME
Default subroutine model (M-Model)- See Also:
- Constant Field Values
-
-
Method Detail
-
registerModel
void registerModel(java.lang.Class<? extends CodeBlockModel> modelClass, java.lang.String modelName)
Register a new model.- Parameters:
modelClass- code block model class. Subroutine models must implement the SubroutineBlockMode interface - all other models are assumed to be basic block models.modelName- name of model
-
unregisterModel
void unregisterModel(java.lang.Class<? extends CodeBlockModel> modelClass)
Deregister a model.- Parameters:
modelClass- code block model class.
-
getActiveBlockModel
CodeBlockModel getActiveBlockModel()
Get new instance of the active Basic Block model for the current program.- Returns:
- new Basic Block model instance or null if program is not open.
-
getActiveBlockModel
CodeBlockModel getActiveBlockModel(boolean includeExternals)
Get new instance of the active Basic Block model for the current program.- Parameters:
includeExternals- externals are included if true- Returns:
- new Basic Block model instance or null if program is not open.
-
getActiveBlockModel
CodeBlockModel getActiveBlockModel(Program program)
Get new instance of the active Basic Block model.- Parameters:
program- program to associate with the block model- Returns:
- new Basic Block model instance or null if program is null
-
getActiveBlockModel
CodeBlockModel getActiveBlockModel(Program program, boolean includeExternals)
Get new instance of the active Basic Block model.- Parameters:
program- program to associate with the block modelincludeExternals- externals are included if true- Returns:
- new Basic Block model instance or null if program is null
-
getActiveBlockModelName
java.lang.String getActiveBlockModelName()
Get the name of the active Basic Block model.- Returns:
- active block model name
-
getActiveSubroutineModel
CodeBlockModel getActiveSubroutineModel()
Get new instance of the active Subroutine Block model for the current program.- Returns:
- new Subroutine Block model instance or null if program is not open
-
getActiveSubroutineModel
CodeBlockModel getActiveSubroutineModel(boolean includeExternals)
Get new instance of the active Subroutine Block model for the current program.- Parameters:
includeExternals- externals are included if true- Returns:
- new Subroutine Block model instance or null if program is not open
-
getActiveSubroutineModel
CodeBlockModel getActiveSubroutineModel(Program program)
Get new instance of the active Subroutine Block model.- Parameters:
program- program associated with the block model.- Returns:
- new Subroutine Block model instance or null if program is null
-
getActiveSubroutineModel
CodeBlockModel getActiveSubroutineModel(Program program, boolean includeExternals)
Get new instance of the active Subroutine Block model.- Parameters:
program- program associated with the block model.includeExternals- externals are included if true- Returns:
- new Subroutine Block model instance or null if program is null
-
getActiveSubroutineModelName
java.lang.String getActiveSubroutineModelName()
Get the name of the active Subroutine model.- Returns:
- active subroutine model name
-
getNewModelByName
CodeBlockModel getNewModelByName(java.lang.String modelName) throws NotFoundException
Get new instance of the specified block model.- Parameters:
modelName- name of registered block model- Returns:
- new model instance or null if program is not open.
- Throws:
NotFoundException- if specified model is not registered
-
getNewModelByName
CodeBlockModel getNewModelByName(java.lang.String modelName, boolean includeExternals) throws NotFoundException
Get new instance of the specified block model.- Parameters:
modelName- name of registered block modelincludeExternals- externals are included if true- Returns:
- new model instance or null if program is not open.
- Throws:
NotFoundException- if specified model is not registered
-
getNewModelByName
CodeBlockModel getNewModelByName(java.lang.String modelName, Program program) throws NotFoundException
Get new instance of the specified block model.- Parameters:
modelName- name of registered block modelprogram- program associated with the model- Returns:
- new model instance or null if program is null
- Throws:
NotFoundException- if specified model is not registered
-
getNewModelByName
CodeBlockModel getNewModelByName(java.lang.String modelName, Program program, boolean includeExternals) throws NotFoundException
Get new instance of the specified block model.- Parameters:
modelName- name of registered block modelprogram- program associated with the modelincludeExternals- externals are included if true- Returns:
- new model instance or null if program is null
- Throws:
NotFoundException- if specified model is not registered
-
getAvailableModelNames
java.lang.String[] getAvailableModelNames(int modelType)
Get list of registered block models of the specified type. A modelType of ANY_BLOCK will return all models registered. List ordering is based upon the registration order. It is important to recognize that the list of returned names could change as models are registered and unregistered.- Parameters:
modelType- type of model (ANY_MODEL, BASIC_MODEL or SUBROUTINE_MODEL)- Returns:
- array of model names
-
addListener
void addListener(BlockModelServiceListener listener)
Add service listener.- Parameters:
listener- listener to add
-
removeListener
void removeListener(BlockModelServiceListener listener)
Remove service listener.- Parameters:
listener- to remove
-
-