1struct::queue(n) Tcl Data Structures struct::queue(n)
2
3
4
5______________________________________________________________________________
6
8 struct::queue - Create and manipulate queue objects
9
11 package require Tcl 8.2
12
13 package require struct::queue ?1.4?
14
15 queueName option ?arg arg ...?
16
17 queueName clear
18
19 queueName destroy
20
21 queueName get ?count?
22
23 queueName peek ?count?
24
25 queueName put item ?item ...?
26
27 queueName unget item
28
29 queueName size
30
31_________________________________________________________________
32
34 The ::struct::queue command creates a new queue object with an associ‐
35 ated global Tcl command whose name is queueName. This command may be
36 used to invoke various operations on the queue. It has the following
37 general form:
38
39 queueName option ?arg arg ...?
40 Option and the args determine the exact behavior of the command.
41 The following commands are possible for queue objects:
42
43 queueName clear
44 Remove all items from the queue.
45
46 queueName destroy
47 Destroy the queue, including its storage space and associated
48 command.
49
50 queueName get ?count?
51 Return the front count items of the queue and remove them from
52 the queue. If count is not specified, it defaults to 1. If
53 count is 1, the result is a simple string; otherwise, it is a
54 list. If specified, count must be greater than or equal to 1.
55 If there are not enoughs items in the queue to fulfull the
56 request, this command will throw an error.
57
58 queueName peek ?count?
59 Return the front count items of the queue, without removing them
60 from the queue. If count is not specified, it defaults to 1.
61 If count is 1, the result is a simple string; otherwise, it is a
62 list. If specified, count must be greater than or equal to 1.
63 If there are not enoughs items in the queue to fulfull the
64 request, this command will throw an error.
65
66 queueName put item ?item ...?
67 Put the item or items specified into the queue. If more than
68 one item is given, they will be added in the order they are
69 listed.
70
71 queueName unget item
72 Put the item into the queue, at the front, i.e. before any other
73 items already in the queue. This makes this operation the com‐
74 plement to the method get.
75
76 queueName size
77 Return the number of items in the queue.
78
80 graph, list, matrix, pool, prioqueue, record, set, skiplist, stack,
81 tree
82
83
84
85struct 1.4 struct::queue(n)