@include <TypedQueue>

The TypedQueue class provides a queue implementation which enforces type restrictions on its elements. After setting the queue’s type, all elements must be pointers to objects of that type or its subclasses.

Methods

@TypedQueue.set_type

Scope: public

Sets the type of elements that this queue will hold. This method must be called before adding elements to the queue. The queue’s type cannot be changed after elements have been added.

Usage: @TypedQueue.set_type $type

Parameters

  • type
    • Type: primitive
    • The type to enforce for the elements of this queue.

@TypedQueue.enqueue

Scope: public

Adds a value to the end of the queue, enforcing the specified type.

Usage: @TypedQueue.enqueue $value

Parameters

  • value
    • Type: primitive
    • The value to add to the queue.

@TypedQueue.size

Scope: public

Echoes the number of elements in the queue.

Usage: @TypedQueue.size

@TypedQueue.empty

Scope: public

Echoes “true” if the queue is empty, “false” otherwise.

Usage: @TypedQueue.empty

@TypedQueue.dequeue

Scope: public

Removes and echoes the value at the front of the queue.

Usage: @TypedQueue.dequeue

@TypedQueue.front

Scope: public

Echoes the value at the front of the queue.

Usage: @TypedQueue.front

@TypedQueue.back

Scope: public

Echoes the value at the back of the queue.

Usage: @TypedQueue.back

@TypedQueue.clear

Scope: public

Removes all elements from the queue.

Usage: @TypedQueue.clear