set_iterator

class set_iterator #(type T =  int) extends iterator#( T )

Provides an iterator to a set.

Parameter

Toptional The type of data collected in a set.  The default is int.
Summary
set_iteratorProvides an iterator to a set.
Types
aa_typeThe shorthand of the associative array type of type T.
set_typeThe shorthand of the set type of type T.
Functions
newCreates a set iterator.
has_nextvirtual Returns 1 if the iterator has more elements.
nextvirtual Returns the next element.
removevirtual Removes the last element returned by the iterator.

Types

aa_type

typedef bit aa_type[T]

The shorthand of the associative array type of type T.

set_type

typedef set#(T) set_type

The shorthand of the set type of type T.

Functions

new

function new(set_type s)

Creates a set iterator.

Argument

sA set to be iterated.

has_next

virtual function bit has_next()

virtual Returns 1 if the iterator has more elements.

Returns

If the iterator has more elements, returns 1.  Otherwise, returns 0.

next

virtual function T next()

virtual Returns the next element.

Returns

The next element in the iterator.

remove

virtual function void remove()

virtual Removes the last element returned by the iterator.  This function can be called once per call to next.

class set_iterator #(type T =  int) extends iterator#( T )
Provides an iterator to a set.
class set #(type T =  int) extends set_base#( T )
Implements the set_base using an associative array.
typedef bit aa_type[T]
The shorthand of the associative array type of type T.
typedef set#(T) set_type
The shorthand of the set type of type T.
function new(set_type s)
Creates a set iterator.
virtual function bit has_next()
virtual Returns 1 if the iterator has more elements.
virtual function T next()
virtual Returns the next element.
virtual function void remove()
virtual Removes the last element returned by the iterator.