1transfer::data::destination(Dna)ta transfer facilititersansfer::data::destination(n)
2
3
4
5______________________________________________________________________________
6
8 transfer::data::destination - Data destination
9
11 package require Tcl 8.4
12
13 package require snit ?1.0?
14
15 package require transfer::data::destination ?0.1?
16
17 transfer::data::destination object ?options...?
18
19 object destroy
20
21 object put chunk
22
23 object done
24
25 object valid msgvar
26
27 object receive channel done
28
29_________________________________________________________________
30
32 This package provides objects mainly describing the destination of a
33 data transfer. They are also able to initiate the reception of informa‐
34 tion from a channel into the described destination.
35
37 transfer::data::destination object ?options...?
38 This command creates and configures a new destination object.
39 The fully qualified name of the object command is returned as
40 the result of the command.
41
42 The recognized options are listed below. It should be noted that
43 all are semi-exclusive, each specifying a different type of des‐
44 tination and associated information. If these options are speci‐
45 fied more than once then the last option specified is used to
46 actually configure the object.
47
48 -channel handle
49 This option specifies that the destination of the data is
50 a channel, and its associated argument is the handle of
51 the channel to write the received data to.
52
53 -file path
54 This option specifies that the destination of the data is
55 a file, and its associated argument is the path of the
56 file to write the received data to.
57
58 -variable varname
59 This option specifies that the destination of the data is
60 a variable, and its associated argument contains the name
61 of the variable to write the received data to. The vari‐
62 able is assumed to be global or namespaced, anchored at
63 the global namespace.
64
65 object destroy
66 This method destroys the object. Doing so while the object is
67 busy with the reception of information from a channel will cause
68 errors later on, when the reception completes and tries to
69 access the now missing data structures of the destroyed object.
70
71 object put chunk
72 The main receptor method. Saves the received chunk of data into
73 the configured destination. It has to be called for each piece
74 of data received.
75
76 object done
77 The secondary receptor method. Finalizes the receiver. It has to
78 be called when the receiving channel signals EOF. Afterward nei‐
79 ther itself nor method put can be called anymore.
80
81 object valid msgvar
82 This method checks the configuration of the object for validity.
83 It returns a boolean flag as result, whose value is True if the
84 object is valid, and False otherwise. In the latter case the
85 variable whose name is stored in msgvar is set to an error mes‐
86 sage describing the problem found with the configuration. Other‐
87 wise this variable is not touched.
88
89 object receive channel done
90 This method initiates the reception of data from the specified
91 channel. The received data will be stored into the configured
92 destination, via calls to the methods put and done. When the
93 reception completes the command prefix done is invoked, with the
94 number of received characters appended to it as the sole addi‐
95 tional argument.
96
98 channel, copy, data destination, transfer
99
101 Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
102
103
104
105
106transfer 0.1 transfer::data::destination(n)