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.1?
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 namespace contains a commands for processing finite
35 queues.
36
37 It exports a single command, ::struct::queue. All functionality pro‐
38 vided here can be reached through a subcommand of this command.
39
40 Note: As of version 1.4.1 of this package a critcl based C implementa‐
41 tion is available. This implementation however requires Tcl 8.4 to run.
42
43 The ::struct::queue command creates a new queue object with an associ‐
44 ated global Tcl command whose name is queueName. This command may be
45 used to invoke various operations on the queue. It has the following
46 general form:
47
48 queueName option ?arg arg ...?
49 Option and the args determine the exact behavior of the command.
50 The following commands are possible for queue objects:
51
52 queueName clear
53 Remove all items from the queue.
54
55 queueName destroy
56 Destroy the queue, including its storage space and associated
57 command.
58
59 queueName get ?count?
60 Return the front count items of the queue and remove them from
61 the queue. If count is not specified, it defaults to 1. If
62 count is 1, the result is a simple string; otherwise, it is a
63 list. If specified, count must be greater than or equal to 1.
64 If there are not enoughs items in the queue to fulfull the
65 request, this command will throw an error.
66
67 queueName peek ?count?
68 Return the front count items of the queue, without removing them
69 from the queue. If count is not specified, it defaults to 1.
70 If count is 1, the result is a simple string; otherwise, it is a
71 list. If specified, count must be greater than or equal to 1.
72 If there are not enoughs items in the queue to fulfull the
73 request, this command will throw an error.
74
75 queueName put item ?item ...?
76 Put the item or items specified into the queue. If more than
77 one item is given, they will be added in the order they are
78 listed.
79
80 queueName unget item
81 Put the item into the queue, at the front, i.e. before any other
82 items already in the queue. This makes this operation the com‐
83 plement to the method get.
84
85 queueName size
86 Return the number of items in the queue.
87
89 This document, and the package it describes, will undoubtedly contain
90 bugs and other problems. Please report such in the category struct ::
91 queue of the Tcllib SF Trackers [http://source‐
92 forge.net/tracker/?group_id=12883]. Please also report any ideas for
93 enhancements you may have for either package and/or documentation.
94
96 graph, list, matrix, pool, prioqueue, record, set, skiplist, stack,
97 tree
98
99
100
101struct 1.4.1 struct::queue(n)