Instantiations is one of the interactive graphs Understand can draw of your code — call trees, dependencies, control flow, and more.
Instantiations
Languages: AdaTargets: Packages, Subprograms
Variants: Classic, Cluster, Compare, Relationship, Simplified
Show every instantiation of a selected Ada generic package, function, procedure, or task.
For a selected generic unit, this shows an edge to each package, function, procedure, or task instantiated from it. An instantiation doesn’t itself introduce a new generic to instantiate from, so this is always a single level and doesn’t recurse further.
Rooted at the generic package Generic_Stack below, the graph shows edges to its three instantiations: Integer_Stack, Float_Stack, and Character_Stack.
See the following code and corresponding graph
generic
type Element is private;
Capacity : Positive;
package Generic_Stack is
type Stack is limited private;
procedure Push (S : in out Stack; Item : Element);
procedure Pop (S : in out Stack; Item : out Element);
function Is_Empty (S : Stack) return Boolean;
function Is_Full (S : Stack) return Boolean;
private
type Element_Array is array (1 .. Capacity) of Element;
type Stack is record
Data : Element_Array;
Top : Natural := 0;
end record;
end Generic_Stack;
with Generic_Stack;
package Instances is
package Integer_Stack is new Generic_Stack
(Element => Integer, Capacity => 64);
package Float_Stack is new Generic_Stack
(Element => Float, Capacity => 32);
package Character_Stack is new Generic_Stack
(Element => Character, Capacity => 128);
end Instances;
Instantiations - Classic
The Classic variant is similar to the Simplified variant, showing all relationships in a simple tree, but it uses a custom layout algorithm instead of Graphviz.
Instantiations - Cluster
The Cluster variant groups entities by their containing class/file/architecture.
Instantiations - Compare
The Compare variant shows how the graph has changed relative to the project's comparison database.
Instantiations - Relationship
The Relationship variant filters the graph to only paths connecting the two entities.
Instantiations - Simplified
The Simplified variant shows all relationships in a simple tree (no clusters)