Package ghidra.app.services

# Interface BlockModelService

public interface BlockModelService
Service for providing block models.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `BASIC_MODEL`
  Type for a simple block model.
  `static final String`
  `DEFAULT_BLOCK_MODEL_NAME`
  Default basic block model (Simple Block Model)
  `static final String`
  `DEFAULT_SUBROUTINE_MODEL_NAME`
  Default subroutine model (M-Model)
  `static final 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.
  `static final String`
  `MULTI_ENTRY_SUBROUTINE_MODEL_NAME`
  Name of the implementation for a subroutine with multiple entry points.
  `static final String`
  `OVERLAPPED_SUBROUTINE_MODEL_NAME`
  Name of the implementation for an overlapped subroutine model.
  `static final 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.
  `static final String`
  `SIMPLE_BLOCK_MODEL_NAME`
  Name of the implementation for a Simple block model.
  `static final int`
  `SUBROUTINE_MODEL`
  Type for a subroutine block model.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addListener(BlockModelServiceListener listener)`
  Add service listener.
  `CodeBlockModel`
  `getActiveBlockModel()`
  Deprecated.
  use getActiveBlockModel(Program) instead
  `CodeBlockModel`
  `getActiveBlockModel(boolean includeExternals)`
  Deprecated.
  use getActiveBlockModel(Program, boolean) instead
  `CodeBlockModel`
  `getActiveBlockModel(Program program)`
  Get new instance of the active Basic Block model.
  `CodeBlockModel`
  `getActiveBlockModel(Program program, boolean includeExternals)`
  Get new instance of the active Basic Block model.
  `String`
  `getActiveBlockModelName()`
  Get the name of the active Basic Block model.
  `CodeBlockModel`
  `getActiveSubroutineModel()`
  Deprecated.
  use getActiveSubroutineModel(Program) instead
  `CodeBlockModel`
  `getActiveSubroutineModel(boolean includeExternals)`
  Deprecated.
  use getActiveSubroutineModel(Program) instead
  `CodeBlockModel`
  `getActiveSubroutineModel(Program program)`
  Get new instance of the active Subroutine Block model.
  `CodeBlockModel`
  `getActiveSubroutineModel(Program program, boolean includeExternals)`
  Get new instance of the active Subroutine Block model.
  `String`
  `getActiveSubroutineModelName()`
  Get the name of the active Subroutine model.
  `String[]`
  `getAvailableModelNames(int modelType)`
  Get list of registered block models of the specified type.
  `CodeBlockModel`
  `getNewModelByName(String modelName)`
  Deprecated.
  use getNewModelByName(String, Program) instead
  `CodeBlockModel`
  `getNewModelByName(String modelName, boolean includeExternals)`
  Deprecated.
  use getNewModelByName(String, Program, boolean) instead
  `CodeBlockModel`
  `getNewModelByName(String modelName, Program program)`
  Get new instance of the specified block model.
  `CodeBlockModel`
  `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_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 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 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 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 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 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 String DEFAULT_BLOCK_MODEL_NAME
    Default basic block model (Simple Block Model)
    See Also:
      - Constant Field Values

  - ### DEFAULT_SUBROUTINE_MODEL_NAME

    static final String DEFAULT_SUBROUTINE_MODEL_NAME
    Default subroutine model (M-Model)
    See Also:
      - Constant Field Values

- ## Method Details

  - ### registerModel

    void registerModel(Class<? extends CodeBlockModel> modelClass, 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(Class<? extends CodeBlockModel> modelClass)
    Deregister a model.
    Parameters:
      `modelClass` - code block model class.

  - ### getActiveBlockModel

    @Deprecated CodeBlockModel getActiveBlockModel()
    Deprecated.
    use getActiveBlockModel(Program) instead
    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

    @Deprecated CodeBlockModel getActiveBlockModel(boolean includeExternals)
    Deprecated.
    use getActiveBlockModel(Program, boolean) instead
    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 model
      `includeExternals` - 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 CodeBlockModel getActiveSubroutineModel()
    Deprecated.
    use getActiveSubroutineModel(Program) instead
    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

    @Deprecated CodeBlockModel getActiveSubroutineModel(boolean includeExternals)
    Deprecated.
    use getActiveSubroutineModel(Program) instead
    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

    String getActiveSubroutineModelName()
    Get the name of the active Subroutine model.
    Returns:
      active subroutine model name

  - ### getNewModelByName

    @Deprecated CodeBlockModel getNewModelByName(String modelName) throws NotFoundException
    Deprecated.
    use getNewModelByName(String, Program) instead
    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

    @Deprecated CodeBlockModel getNewModelByName(String modelName, boolean includeExternals) throws NotFoundException
    Deprecated.
    use getNewModelByName(String, Program, boolean) instead
    Get new instance of the specified block model.
    Parameters:
      `modelName` - name of registered block model
      `includeExternals` - 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(String modelName, Program program) throws NotFoundException
    Get new instance of the specified block model.
    Parameters:
      `modelName` - name of registered block model
      `program` - 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 model
      `program` - program associated with the model
      `includeExternals` - externals are included if true
    Returns:
      new model instance or null if program is null
    Throws:
      `NotFoundException` - if specified model is not registered

  - ### getAvailableModelNames

    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