[source]

Class 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

function new ( string name ) [source]

Functions

virtual function void begin_v ( ) [source]

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

virtual function void end_v ( ) [source]

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

virtual function void visit ( uvm_component node ) [source]

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 = &quot;&quot;);
          super.new(name);
    endfunction
    local int cnt;
    virtual function void begin_v(); cnt = 0; endfunction
    virtual function void end_v(); uvm_info(&quot;TEXT&quot;,$sformatf(&quot;%d elements&quot;,cnt),UVM_NONE) endfunction
    virtual function void visit(T node); cnt++; endfunction
   endclass