1struct::queue(n)              Tcl Data Structures             struct::queue(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       struct::queue - Create and manipulate queue objects
9

SYNOPSIS

11       package require Tcl  8.4
12
13       package require struct::queue  ?1.4.5?
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

DESCRIPTION

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  enough  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 enough  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

BUGS, IDEAS, FEEDBACK

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 Trackers [http://core.tcl.tk/tcllib/reportlist].
92       Please also report any ideas for enhancements you may have  for  either
93       package and/or documentation.
94
95       When proposing code changes, please provide unified diffs, i.e the out‐
96       put of diff -u.
97
98       Note further that  attachments  are  strongly  preferred  over  inlined
99       patches.  Attachments  can  be  made  by  going to the Edit form of the
100       ticket immediately after its creation, and  then  using  the  left-most
101       button in the secondary navigation bar.
102

KEYWORDS

104       graph,  list,  matrix,  pool,  prioqueue, record, set, skiplist, stack,
105       tree
106

CATEGORY

108       Data structures
109
110
111
112tcllib                               1.4.5                    struct::queue(n)
Impressum