|
|
|
|
|
- WLanguage properties that can be used with the Queue type
- WLanguage functions for managing queues
- The queues and the multithread
- Browsing the queues
- Special cases
Queue (Variable type) In french: File
A Queue variable is a structured type that groups a set of elements of the same type. The elements are added at the end of queue and they are retrieved in enqueue order. For example, if the elements are added in the following order: 1, 2, 3, they will be retrieved in the same order 1, 2, 3.
New in version 2025MyQueue is Queue of int
Enqueue(MyQueue, 1)
Enqueue(MyQueue, 2)
Enqueue(MyQueue, 3)
x is int
WHILE Dequeue(MyQueue, x)
Trace(x)
END
Syntax
Declaring and initializing a queue Hide the details
<Queue Name> is Queue of <Type of Queue Elements>
<Queue Name>: Name of the queue variable to declare. <Type of Queue Elements>: Type of elements found in the queue. All types of variables can be used including the arrays, the associative arrays, the queues, the stacks and the lists. For example: <variable> is queue of arrays of int
<variable> is queue of fixed arrays of 5 int
<variable> is queue of associative arrays of int
<variable> is queue of queues of int
<variable> is queue of stacks of int
<variable> is queue of lists of int Remarks WLanguage properties that can be used with the Queue type The following properties can be used to handle Queue variables: | | Property name | Effect |
---|
AdditionCompleted | Returns and modifies the addition mode of elements. This property is used for the multithread management. | Empty | - True if the queue is empty,
- False otherwise.
| NbPendingThread | Returns the number of pending threads. This property is used for the multithread management. | Occurrence | Returns the number of queue occurrences. |
WLanguage functions for managing queues The following functions can be used to handle Queue variables: | | DeleteAll | Deletes all elements: - from a one-dimensional or two-dimensional WLanguage array.
- from an associative array.
- from an advanced array property (array of gglCalendar events, etc.).
- from a WLanguage queue.
- from a WLanguage stack.
- from a WLanguage list.
| Dequeue | Removes an element from the queue. | Deserialize | Deserializes a buffer or a character string containing the data from a class, structure, array (including an associative array), queue, stack, list or advanced variable, as well as their subelements. | Enqueue | Adds an element to the queue. | QueueInfo | Retrieves the characteristics of a queue: types of elements and number of elements. | Serialize | Transforms the following elements into a specific format:- a structure (and its subelements),
- a class (and its subelements),
- an array (including the associative arrays),
- a queue,
- a stack,
- a list.
|
The queues and the multithread The management of multithread is taken into account when adding and deleting an element ( Enqueue and Dequeue). You also have the ability to use properties during a multithread management but the result is not permanent. For example: IF MyQueue.Occurrence > 0 THEN
END
Browsing the queues The FOR EACH syntax can be used to browse the queues. The elements are browsed in enqueue order that is similar to the dequeue order. The syntax used corresponds to the one used for the arrays: FOR EACH [ELEMENT] <Variable> [, <Counter> [, <Counter>]] OF <Queue> ... END The elements can be modified during the browse. If the queue is modified during a browse, the elements browsed will be the ones found when the browse was initialized: - the elements enqueued after the initialization of the browse will not be browsed.
- the elements dequeued after the initialization of the browse will still be browsed.
Special cases - In the debugger, the content of the queue is displayed in dequeue order.
- A queue can be used to type a procedure parameter.
- A queue can be copied with the = operator. You also have the ability to copy an instance of class or structure containing a queue.
- A queue can be initialized by a list of elements in enqueue order.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|