Summary: information about the Call Hierarchy feature introduced in CAST Imaging ≥ 2.12.

Introduction

Navigating through a large codebase is time-consuming, inefficient and prone to oversight as developers may need to manually search for method or function usages.

Call Hierarchy helps developers understand the flow of code execution by displaying the callers and callees of a selected element. By examining the call hierarchy of a particular element, developers can assess the potential impact of making changes to that element. They can determine which parts of the codebase rely on the selected element and understand the ripple effects that modifications may have on other components. They can identify methods or functions that are frequently called and extract them into reusable components or libraries.

Several similar features are available in the UI: Path FinderShow Paths, Start Points, and End Points and Call Hierarchy - the basic differences are as follows:

  • Show Paths (renamed as Highlight Path) displays all paths between the two selected objects based on callee links .
  • Path Finder not only displays all paths between two selected objects using any link type, but also the shortest path. Additional filtering can also be applied to the results, for example, the ability to:
    • choose the specific link types between the source and target objects
    • choose the number of "hops" between the source and target objects
  • Start Points and End Points​ displays the start points and end points linked to a selected element.
  • Call Hierarchy displays a comprehensive call graph for a chosen element, showcasing its callers, callees, or both.

Accessing the feature

To access the Call Hierarchy feature, you must be working at Object level in any scope:

Right click an object in the view and select Call Hierarchy from the contextual menu - this object will then be designated the source object:

Using the feature

When the Call Hierarchy option is clicked, the following dialog box is displayed enabling you to configure how the feature will function:

≥ 2.17

≥ 2.13

2.12

ItemDescription
Information

  • Source Object > the object selected as the start/source
  • Maximum Depth for Caller > the maximum depth available for caller objects (calculated on the fly)
  • Maximum Depth for Callee > the maximum depth available for callee objects (calculated on the fly)
Select link type

Choose the type of links that will be taken into account by the Call Hierarchy feature:

  • Choosing Caller and Callee (default) will show objects that are called by and are calling the source object
  • Choosing Callee will only show other objects that are called by the source object.
  • Choosing Caller will only show other objects that are calling the source object.
Number of depths

Defines the maximum number of levels in the call graph.  By default this is set to 4 and can be changed as required. Note that changing to above 10 can impact performance - the higher the number, the more objects need to be discovered, therefore impacting performance.

Complete Call Graph

Available in ≥ 2.17.

Select this option to choose the maximum depth available for the specific link type you have selected. If you have chosen Caller and Callee (the joint option), then the maximum depth chosen will be the higher of the two link types.

Hide external objects

Not available in ≥ 2.17. By default in these releases, external objects and main object + sub objects are ALWAYS shown.

Use these options to filter the type of objects in the results:

  • Hide external objects > External objects are those that are considered "third-party", i.e. frameworks and libraries rather than custom source code.
  • Main objects only > This option will exclude any sub-objects, for example, those highlighted in yellow below are sub-objects and would not be displayed if the Main objects only option is ticked.

Main objects only

Results

The example below shows a source object "authors" at the bottoms of the image and then varying levels of callers (those objects calling the source object):

Click to enlarge