1tcl::chan::halfpipe(n) Reflected/virtual channel supporttcl::chan::halfpipe(n)
2
3
4
5______________________________________________________________________________
6
8 tcl::chan::halfpipe - In-memory channel, half of a fifo2
9
11 package require Tcl 8.5
12
13 package require TclOO
14
15 package require tcl::chan::events ?1?
16
17 package require tcl::chan::halfpipe ?1?
18
19 package require tcl::chan::halfpipe ?1?
20
21 ::tcl::chan::halfpipe ?-option value...?
22
23 objectCmd put bytes
24
25______________________________________________________________________________
26
28 The tcl::chan::halfpipe package provides a command creating one half of
29 a tcl::chan::fifo2 pair. Writing into such a channel invokes a set of
30 callbacks which then handle the data. This is similar to a channel han‐
31 dler, except having a much simpler API.
32
33 The internal TclOO class implementing the channel handler is a sub-
34 class of the tcl::chan::events framework.
35
37 ::tcl::chan::halfpipe ?-option value...?
38 This command creates a halfpipe channel and configures it with
39 the callbacks to run when the channel is closed, data was writ‐
40 ten to it, or ran empty. See the section Options for the list of
41 options and associated semantics. The result of the command is
42 a list containing two elements, the handle of the new channel,
43 and the object command of the channel handler, in this order.
44 The latter is supplied to the caller to provide her with access
45 to the put method for adding data to the channel.
46
47 Two halfpipes with a bit of glue logic in the callbacks make for
48 one tcl::chan::fifo2.
49
50 objectCmd put bytes
51 This method of the channel handler object puts the data bytes
52 into the channel so that it can be read from it.
53
55 -close-command cmdprefix
56 This callback is invoked when the channel is closed. A single
57 argument is supplied, the handle of the channel being closed.
58 The result of the callback is ignored.
59
60 -write-command cmdprefix
61 This callback is invoked when data is written to the channel.
62 Two arguments are supplied, the handle of the channel written
63 to, and the data written. The result of the callback is
64 ignored.
65
66 -empty-command cmdprefix
67 This callback is invoked when the channel has run out of data to
68 read. A single argument is supplied, the handle of the channel.
69
71 This document, and the package it describes, will undoubtedly contain
72 bugs and other problems. Please report such in the category virtchan‐
73 nel of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist].
74 Please also report any ideas for enhancements you may have for either
75 package and/or documentation.
76
77 When proposing code changes, please provide unified diffs, i.e the out‐
78 put of diff -u.
79
80 Note further that attachments are strongly preferred over inlined
81 patches. Attachments can be made by going to the Edit form of the
82 ticket immediately after its creation, and then using the left-most
83 button in the secondary navigation bar.
84
86 callbacks, fifo, in-memory channel, reflected channel, tip 219, virtual
87 channel
88
90 Channels
91
93 Copyright (c) 2009 Andreas Kupries <andreas_kupries@users.sourceforge.net>
94
95
96
97
98tcllib 1 tcl::chan::halfpipe(n)