QUE. - Management

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Arrays and Data-Structures > QUE. - Queue >

QUE. - Management

QUE, - Management

Previous Top Next


MiniRobotLanguage (MRL)

 

QUE.-Management Commands

These commands let you manage the queue's

 

 

Overview

 

The QUE.-Management commands provide functionality for creating, managing, and manipulating queues.

A queue is a data structure that follows the First-In-First-Out (FIFO) principle, meaning the first element added to the queue is the first one to be removed. Queues are useful for managing ordered data, such as task scheduling, buffering, or processing sequences.

 

A handle is a unique identifier that references a specific queue. It is used to interact with the queue in subsequent commands. Handles are automatically generated when a queue is created and become invalid once the queue is deallocated.

 

 

What is a Queue?

A queue is a linear data structure that stores elements in a specific order. It follows the First-In-First-Out (FIFO) principle, meaning the first element added to the queue is the first one to be removed. Queues are commonly used for:

 

1.Task scheduling (e.g., processing tasks in the order they are received).

2.Buffering data (e.g., holding data temporarily before processing).

3.Managing sequences of operations or events.

 

What is a Handle?

A handle is a unique identifier that references a specific queue. It is generated when a queue is created using QUE.New and is used to interact with the queue in subsequent commands. Handles are essential for managing multiple queues simultaneously. Once a queue is deallocated using QUE.End or QUE.EndAll, its handle becomes invalid.

 

 

 

Example

 

'***********************************

' QUE.-Management Sample

'***********************************

QUE.New|$$QUE

DBP.New queue created with this Handle: $$QUE

 

QUE.Push|$$QUE|42

QUE.Push|$$QUE|"Hello"

QUE.Count|$$QUE|$$COUNT

DBP.Number of elements in queue: $$COUNT

 

QUE.Peek|$$QUE|$$VAL

DBP.First value in queue: $$VAL

 

QUE.Pop|$$QUE|$$VAL

DBP.Value popped from queue: $$VAL

 

QUE.Clear|$$QUE

DBP.Queue cleared.

 

QUE.End|$$QUE

DBP.Queue deallocated.

ENR.

 

 

 

 

 

Remarks

 

-

 

 

Limitations:

 

-

 

 

See also:

 

    1.6.1. Program Flow Control

    ! Smart Package Robot 's Parallel Robot Operations

    1.5. Features and Hints