[source]

Class uvm_pkg::uvm_visitor

uvm_pkg::uvm_visitor <NODE> + begin_v(): void + end_v(): void + visit(): void uvm_pkg::uvm_component_name_check_visitor <NODE : uvm_component>

Inheritance Diagram of uvm_visitor

CLASS

uvm_visitor #(NODE)

The uvm_visitor class provides an abstract base class for a visitor. The visitor visits instances of type NODE. For general information regarding the visitor pattern see http://en.wikipedia.org/wiki/Visitor_pattern

Parameters

Name

Default value

Description

NODE

uvm_component

Constructors

new(string name = "")
Parameters:

name (string)

Functions

begin_v()

Function

begin_v

This method will be invoked by the visitor before the first NODE is visited

end_v()

Function

end_v

This method will be invoked by the visitor after the last NODE is visited

visit(uvm_component node)

Function

visit

This method will be invoked by the visitor for every visited node of the provided structure. The user is expected to provide the own functionality in this function.

 class count_nodes_visitor#(type T=uvm_component) extends uvm_visitor#(T);
     function new (string name = "");
           super.new(name);
     endfunction
     local int cnt;
     virtual function void begin_v(); cnt = 0; endfunction
     virtual function void end_v(); `uvm_info("TEXT",$sformatf("%d elements",cnt),UVM_NONE) endfunction
     virtual function void visit(T node); cnt++; endfunction
    endclass
Parameters:

node (uvm_component)