# uvm_queue #(T)

Implements a class-based dynamic queue. Allows queues to be allocated on demand, and passed and stored by reference.

Summary

uvm_queue #(T)
Implements a class-based dynamic queue.
Class Hierarchy
uvm_void
uvm_object
uvm_queue#(T)
Class Declaration
> class uvm_queue #(
> | type | T | = | int
> ) extends uvm_object
Methods |
new | Creates a new queue with the given name.
get_global_queue | Returns the singleton global queue for the item type, T.
get_global | Returns the specified item instance from the global item queue.
get | Returns the item at the given index.
size | Returns the number of items stored in the queue.
insert | Inserts the item at the given index in the queue.
delete | Removes the item at the given index from the queue; if index is not provided, the entire contents of the queue are deleted.
pop_front | Returns the first element in the queue (index=0), or null if the queue is empty.
pop_back | Returns the last element in the queue (index=size()-1), or null if the queue is empty.
push_front | Inserts the given item at the front of the queue.
push_back | Inserts the given item at the back of the queue.

### Methods

### new

> function new (
> | string | name | = | ""
> )

Creates a new queue with the given name.

### get_global_queue

> static function this_type get_global_queue ()

Returns the singleton global queue for the item type, T.

This allows items to be shared amongst components throughout the verification environment.

### get_global

> static function T get_global (
> | int | index
> )

Returns the specified item instance from the global item queue.

### get

> virtual function T get (
> | int | index
> )

Returns the item at the given index.

If no item exists by that key, a new item is created with that key and returned.

### size

> virtual function int size ()

Returns the number of items stored in the queue.

### insert

> virtual function void insert (
> | int | index,
> | T | item
> )

Inserts the item at the given index in the queue.

### delete

> virtual function void delete (
> | int | index | = | -1
> )

Removes the item at the given index from the queue; if index is not provided, the entire contents of the queue are deleted.

### pop_front

> virtual function T pop_front()

Returns the first element in the queue (index=0), or null if the queue is empty.

### pop_back

> virtual function T pop_back()

Returns the last element in the queue (index=size()-1), or null if the queue is empty.

### push_front

> virtual function void push_front(
> | T | item
> )

Inserts the given item at the front of the queue.

### push_back

> virtual function void push_back(
> | T | item
> )

Inserts the given item at the back of the queue.

> virtual class uvm_void

The uvm_void class is the base class for all UVM classes.

> virtual class uvm_object extends uvm_void

The uvm_object class is the base class for all UVM data and hierarchical classes.

> class uvm_queue #(
> | type | T | = | int
> ) extends uvm_object

Implements a class-based dynamic queue.

> function new (
> | string | name | = | ""
> )

Creates a new queue with the given name.

> static function this_type get_global_queue ()

Returns the singleton global queue for the item type, T.

> static function T get_global (
> | int | index
> )

Returns the specified item instance from the global item queue.

> virtual function T get (
> | int | index
> )

Returns the item at the given index.

> virtual function int size ()

Returns the number of items stored in the queue.

> virtual function void insert (
> | int | index,
> | T | item
> )

Inserts the item at the given index in the queue.

> virtual function void delete (
> | int | index | = | -1
> )

Removes the item at the given index from the queue; if index is not provided, the entire contents of the queue are deleted.

> virtual function T pop_front()

Returns the first element in the queue (index=0), or null if the queue is empty.

> virtual function T pop_back()

Returns the last element in the queue (index=size()-1), or null if the queue is empty.

> virtual function void push_front(
> | T | item
> )

Inserts the given item at the front of the queue.

> virtual function void push_back(
> | T | item
> )

Inserts the given item at the back of the queue.