Public Member Functions

# BinNavi.API.disassembly.Function Class Reference

Represents a single function. More...

Inherits BinNavi::APIHelpers::ApiObject< INaviFunction >.

List of all members.

## Public Member Functions
void | addListener (final IFunctionListener listener)
| Adds a function listener.
void | close ()
Address | getAddress ()
| The address of the function.
int | getBlockCount ()
| Number of basic blocks in the function.
String | getComment ()
| Comment of the function.
String | getDescription ()
| Description of the function.
int | getEdgeCount ()
| Number of edges in the function.
FlowGraph | getGraph ()
| The graph of the function.
Module | getModule ()
| The module the function belongs to.
String | getName ()
| The name of the function.
ReilFunction | getReilCode () throws InternalTranslationException
| REIL code of the function.
FunctionType | getType ()
| Returns the type of the function.
boolean | isLoaded ()
| Checks if the function is loaded.
void | load () throws CouldntLoadDataException
| Loads the function.
void | removeListener (final IFunctionListener listener)
void | setComment (final String comment) throws CouldntSaveDataException
| Changes the function comment.
void | setDescription (final String description) throws CouldntSaveDataException
| Changes the function description.
void | setName (final String name) throws CouldntSaveDataException
| Changes the function name.
String | toString ()
| Printable representation of the function.

## Detailed Description

Function objects describe original functions from imported modules. This includes things like the name or the description of the function as well as the flowgraph of the function.

The structure of functions is immutable. That means the flowgraph of functions can not be modified. To modify the flowgraph of a function it is necessary to convert it to a View first.

## Member Function Documentation

void BinNavi.API.disassembly.Function.addListener | ( | final IFunctionListener | listener | ) |

Adds an object that is notified about changes in the function.

Parameters:

  | listener | The listener object that is notified about changes in the function.

Exceptions:

  | IllegalArgumentException | Thrown if the listener argument is null.
  | IllegalStateException | Thrown if the listener object is already listening on the function.

void BinNavi.API.disassembly.Function.close | ( |  | ) |

Unloads the function.

Address BinNavi.API.disassembly.Function.getAddress | ( |  | ) |

Returns the start address of the function.

Returns:
  The start address of the function.

int BinNavi.API.disassembly.Function.getBlockCount | ( |  | ) |

Returns the number of basic blocks in the function. This function can be called if the function has not yet been loaded.

Returns:
  The number of basic blocks in the function.

String BinNavi.API.disassembly.Function.getComment | ( |  | ) |

Returns the function comment. This is the comment that is shown as the global comment in views that show function nodes.

Returns:
  The function comment.

String BinNavi.API.disassembly.Function.getDescription | ( |  | ) |

Returns the description of the function. This is the string that is shown as the description of the function in the main window.

Returns:
  The function description.

int BinNavi.API.disassembly.Function.getEdgeCount | ( |  | ) |

Returns the number of edges in the function. This function can be called if the function has not yet been loaded.

Returns:
  The number of edges in the view.

FlowGraph BinNavi.API.disassembly.Function.getGraph | ( |  | ) |

Returns the flowgraph of the function. This graph contains the basic blocks of the function and edges that show how control flow can propagate through the function.

Returns:
  The flowgraph of the function.

Exceptions:

  | IllegalStateException | Thrown if the function is not loaded.

Module BinNavi.API.disassembly.Function.getModule | ( |  | ) |

Returns the module the function belongs to.

Returns:
  The module the function belongs to.

String BinNavi.API.disassembly.Function.getName | ( |  | ) |

Returns the name of the function.

Returns:
  The name of the function.

ReilFunction BinNavi.API.disassembly.Function.getReilCode | ( |  | ) | throws InternalTranslationException

Converts the View to REIL code. This function can only be used if the view has already been loaded.

Using this function over manual translation via ReilTranslator has the advantage that REIL translation results are automatically cached. Subsequent uses of this function requires no additional re-translation of the view provided that nothing relevant (like added/removed code nodes) changed.

Returns:
  The REIL representation of the view.

Exceptions:

  | InternalTranslationException | Thrown if the REIL translation failed.

FunctionType BinNavi.API.disassembly.Function.getType | ( |  | ) |

Returns the type of the function.

Returns:
  The type of the function.

boolean BinNavi.API.disassembly.Function.isLoaded | ( |  | ) |

Returns a flag that indicates whether the function is loaded.

Returns:
  True, if the function is loaded. False, otherwise.

void BinNavi.API.disassembly.Function.load | ( |  | ) | throws CouldntLoadDataException

Loads the function data from the database.

Exceptions:

  | IllegalStateException | Thrown if the function is already loaded.
  | CouldntLoadDataException | Thrown if the function data could not be loaded from the database.

void BinNavi.API.disassembly.Function.removeListener | ( | final IFunctionListener | listener | ) |

Removes a listener object from the function.

Parameters:

  | listener | The listener object to remove from the function.

Exceptions:

  | IllegalArgumentException | Thrown if the listener argument is null.
  | IllegalStateException | Thrown if the listener object was not listening on the function.

void BinNavi.API.disassembly.Function.setComment | ( | final String | comment | ) | throws CouldntSaveDataException

Changes the comment of the function. This is the comment that is shown as the global comment in views that show function nodes.

Parameters:

  | comment | The new value of the comment.

Exceptions:

  | IllegalArgumentException | Thrown if the comment argument is null.
  | CouldntSaveDataException | Thrown if the comment could not be changed.

void BinNavi.API.disassembly.Function.setDescription | ( | final String | description | ) | throws CouldntSaveDataException

Changes the description of the function.

Parameters:

  | description | The new value of the description.

Exceptions:

  | IllegalArgumentException | Thrown if the description argument is null.
  | CouldntSaveDataException | Thrown if the description could not be changed.

void BinNavi.API.disassembly.Function.setName | ( | final String | name | ) | throws CouldntSaveDataException

Changes the name of the function.

Parameters:

  | name | The new value of the name.

Exceptions:

  | IllegalArgumentException | Thrown if the name argument is null.
  | CouldntSaveDataException | Thrown if the name could not be changed.

String BinNavi.API.disassembly.Function.toString | ( |  | ) |

Returns the string representation of the function.

Returns:
  The string representation of the function.