Package ghidra.app.services
Interface BlockModelService
public interface BlockModelService
Service for providing block models.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Type for a simple block model.static final String
Default basic block model (Simple Block Model)static final String
Default subroutine model (M-Model)static final String
Name of the implementation for a subroutine that has a unique entry point, which may share code with other subroutines.static final String
Name of the implementation for a subroutine with multiple entry points.static final String
Name of the implementation for an overlapped subroutine model.static final String
Name of the implementation for a subroutine that does not share code with other subroutines and may have one or more entry points.static final String
Name of the implementation for a Simple block model.static final int
Type for a subroutine block model. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(BlockModelServiceListener listener) Add service listener.Deprecated.use getActiveBlockModel(Program) insteadgetActiveBlockModel
(boolean includeExternals) Deprecated.use getActiveBlockModel(Program, boolean) insteadgetActiveBlockModel
(Program program) Get new instance of the active Basic Block model.getActiveBlockModel
(Program program, boolean includeExternals) Get new instance of the active Basic Block model.Get the name of the active Basic Block model.Deprecated.use getActiveSubroutineModel(Program) insteadgetActiveSubroutineModel
(boolean includeExternals) Deprecated.use getActiveSubroutineModel(Program) insteadgetActiveSubroutineModel
(Program program) Get new instance of the active Subroutine Block model.getActiveSubroutineModel
(Program program, boolean includeExternals) Get new instance of the active Subroutine Block model.Get the name of the active Subroutine model.String[]
getAvailableModelNames
(int modelType) Get list of registered block models of the specified type.getNewModelByName
(String modelName) Deprecated.use getNewModelByName(String, Program) insteadgetNewModelByName
(String modelName, boolean includeExternals) Deprecated.use getNewModelByName(String, Program, boolean) insteadgetNewModelByName
(String modelName, Program program) Get new instance of the specified block model.getNewModelByName
(String modelName, Program program, boolean includeExternals) Get new instance of the specified block model.void
registerModel
(Class<? extends CodeBlockModel> modelClass, String modelName) Register a new model.void
removeListener
(BlockModelServiceListener listener) Remove service listener.void
unregisterModel
(Class<? extends CodeBlockModel> modelClass) Deregister a model.
-
Field Details
-
BASIC_MODEL
static final int BASIC_MODELType for a simple block model.- See Also:
-
SUBROUTINE_MODEL
static final int SUBROUTINE_MODELType for a subroutine block model.- See Also:
-
SIMPLE_BLOCK_MODEL_NAME
Name of the implementation for a Simple block model.- See Also:
-
MULTI_ENTRY_SUBROUTINE_MODEL_NAME
Name of the implementation for a subroutine with multiple entry points.- See Also:
-
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:
-
OVERLAPPED_SUBROUTINE_MODEL_NAME
Name of the implementation for an overlapped subroutine model.- See Also:
-
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:
-
DEFAULT_BLOCK_MODEL_NAME
Default basic block model (Simple Block Model)- See Also:
-
DEFAULT_SUBROUTINE_MODEL_NAME
Default subroutine model (M-Model)- See Also:
-
-
Method Details
-
registerModel
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
Deregister a model.- Parameters:
modelClass
- code block model class.
-
getActiveBlockModel
Deprecated.use getActiveBlockModel(Program) insteadGet 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
Deprecated.use getActiveBlockModel(Program, boolean) insteadGet 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
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
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
String getActiveBlockModelName()Get the name of the active Basic Block model.- Returns:
- active block model name
-
getActiveSubroutineModel
Deprecated.use getActiveSubroutineModel(Program) insteadGet 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
Deprecated.use getActiveSubroutineModel(Program) insteadGet 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
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
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
String getActiveSubroutineModelName()Get the name of the active Subroutine model.- Returns:
- active subroutine model name
-
getNewModelByName
Deprecated.use getNewModelByName(String, Program) insteadGet 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
@Deprecated CodeBlockModel getNewModelByName(String modelName, boolean includeExternals) throws NotFoundException Deprecated.use getNewModelByName(String, Program, boolean) insteadGet 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
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(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
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
Add service listener.- Parameters:
listener
- listener to add
-
removeListener
Remove service listener.- Parameters:
listener
- to remove
-