[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

Copyright 2013 Cadence Design Systems, Inc. All Rights Reserved Worldwide

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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)