PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • WLanguage properties that can be used with the Queue type
  • WLanguage functions for managing the queues
  • The queues and the multithread
  • Browsing the queues
  • Special cases
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
A queue variable is a structured type that is used to group a set of elements of 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.
Versions 18 and later
iPhone/iPad This type of variable is now available for the iPhone/iPad applications.
Universal Windows 10 App This type of variable is now available in Windows Store apps mode.
New in version 18
iPhone/iPad This type of variable is now available for the iPhone/iPad applications.
Universal Windows 10 App This type of variable is now available in Windows Store apps mode.
iPhone/iPad This type of variable is now available for the iPhone/iPad applications.
Universal Windows 10 App This type of variable is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This type of variable is now available in Universal Windows 10 App mode.
Android This type of variable is now available for the Android applications.
Android Widget This type of variable is now available in Android Widget mode.
WINDEVJava This type of variable is now available for the Java applications.
Apple Watch This type of variable is now available in Apple Watch mode.
New in version 21
Universal Windows 10 App This type of variable is now available in Universal Windows 10 App mode.
Android This type of variable is now available for the Android applications.
Android Widget This type of variable is now available in Android Widget mode.
WINDEVJava This type of variable is now available for the Java applications.
Apple Watch This type of variable is now available in Apple Watch mode.
Universal Windows 10 App This type of variable is now available in Universal Windows 10 App mode.
Android This type of variable is now available for the Android applications.
Android Widget This type of variable is now available in Android Widget mode.
WINDEVJava This type of variable is now available for the Java applications.
Apple Watch This type of variable is now available in Apple Watch mode.
Example
MyQueue is Queue of int

// Enqueue the values 1, 2 and 3
Enqueue(MyQueue, 1)
Enqueue(MyQueue, 2)
Enqueue(MyQueue, 3)

// Display the trace: 1, 2, 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 EXCEPT for the arrays, the associative arrays, the queues, the stacks and the lists.
Versions 20 and later
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
New in version 20
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
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 a Queue variable:
Property nameEffect
AdditionCompletedReturns and modifies the addition mode of elements.
This property is used for the multithread management.
NbPendingThreadReturns the number of pending threads.
This property is used for the multithread management.
OccurrenceReturns the number of queue occurrences.
Empty
  • True if the queue is empty,
  • False otherwise.
Note: These properties can be used with one of the following syntaxes:
  • <Variable Name>..<Property Name>
  • <Variable Name>.<Property Name>

WLanguage functions for managing the queues

The following functions can be used to handle a Queue variable:
Versions 14 and later
DeleteAll
New in version 14
DeleteAll
DeleteAll
Deletes all the elements:
  • from a one-dimensional or two-dimensional WLanguage array.
  • from an associative array.
  • from an advanced array property (array of gglCalendar events, ...).
  • from a WLanguage queue.
  • from a WLanguage stack.
  • from a WLanguage list.
Versions 14 and later
Dequeue
New in version 14
Dequeue
Dequeue
Dequeues an element from a queue.
Versions 10 and later
Deserialize
New in version 10
Deserialize
Deserialize
Deserializes a buffer or a character string containing the data of a class, structure, array (including an associative array), queue, stack, list or advanced variable as well as their sub-elements.
Versions 14 and later
Enqueue
New in version 14
Enqueue
Enqueue
Enqueues an element into a queue.
Versions 16 and later
QueueInfo
New in version 16
QueueInfo
QueueInfo
Retrieves the characteristics of a queue: types of elements and number of elements.
Versions 10 and later
Serialize
New in version 10
Serialize
Serialize
Transforms the following elements into a specific format:
  • a structure (and its sub-elements),
  • a class (and its sub-elements),
  • 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
// The queue may be empty when the thread reaches this point
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.
Minimum required version
  • Version 14
This page is also available for…
Comments
Click [Add] to post a comment