1transfer::data::source(n)  Data transfer facilities  transfer::data::source(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       transfer::data::source - Data source
9

SYNOPSIS

11       package require Tcl  8.4
12
13       package require snit  ?1.0?
14
15       package require transfer::copy  ?0.1?
16
17       package require transfer::data::source  ?0.1?
18
19       transfer::data::source object ?options...?
20
21       object destroy
22
23       object type
24
25       object data
26
27       object size
28
29       object valid msgvar
30
31       object transmit channel blocksize done
32
33_________________________________________________________________
34

DESCRIPTION

36       This package provides objects mainly describing the origin of some data
37       to transfer. They are also able to initiate transfers of the  described
38       information to a channel using the foundation package transfer::copy.
39

API

41       transfer::data::source object ?options...?
42              This  command  creates  and  configures a new source object. The
43              fully qualified name of the object command is  returned  as  the
44              result of the command.
45
46              The recognized options are listed below. It should be noted that
47              the first four options are  semi-exclusive,  each  specifying  a
48              different  type  of data source and associated content. If these
49              options are specified more than once then the last option speci‐
50              fied is used to actually configure the object.
51
52              -string text
53                     This  option  specifies that the source of the data is an
54                     immediate string, and its  associated  argument  contains
55                     the string in question.
56
57              -channel handle
58                     This  option  specifies  that the source of the data is a
59                     channel, and its associated argument is the handle of the
60                     channel containing the data.
61
62              -file path
63                     This  option  specifies  that the source of the data is a
64                     file, and its associated argument is the path of the file
65                     containing the data.
66
67              -variable varname
68                     This  option  specifies  that the source of the data is a
69                     string stored in a variable, and its associated  argument
70                     contains  the name of the variable in question. The vari‐
71                     able is assumed to be global or namespaced,  anchored  at
72                     the global namespace.
73
74              -size int
75                     This  option  specifies the size of the data transfer. It
76                     is optional and defaults to -1. This value, and any other
77                     value  less  than  zero  signals to transfer all the data
78                     from the source.
79
80       object destroy
81              This method destroys the object. Doing so while a transfer  ini‐
82              tiated  by the object is active is safe as all data required for
83              the transfer itself was copied, and the completion of the trans‐
84              fer  will  not try to access the initiating object anymore. i.e.
85              the transfer is  completely  separate  from  the  source  object
86              itself.
87
88       object type
89              This method returns a string describing the type of the data the
90              object is refering to. The possible values  and  their  meanings
91              are:
92
93              undefined
94                     No  data was specified at all, or it was specified incom‐
95                     pletely. The object does not know the type.
96
97              string The data to transfer is contained in a string.
98
99              channel
100                     The data to transfer is contained in a channel.
101
102       object data
103              This method returns a value depending on the type  of  the  data
104              the  object  refers  to, through which the data can be accessed.
105              The method throws an error if the type is  undefined.  For  type
106              string  the returned result is the data itself, whereas for type
107              channel the returned result is the handle of  the  channel  con‐
108              taining the data.
109
110       object size
111              This  method  returns  a value depending on the type of the data
112              the object refers to, the size of the data.  The  method  throws
113              an  error  if  the type is undefined. Return of a negative value
114              signals that the object is unable to determine an absolute  size
115              upfront (like for data in a channel).
116
117       object valid msgvar
118              This method checks the configuration of the object for validity.
119              It returns a boolean flag as result, whose value is True if  the
120              object  is  valid,  and  False otherwise. In the latter case the
121              variable whose name is stored in msgvar is set to an error  mes‐
122              sage describing the problem found with the configuration. Other‐
123              wise this variable is not touched.
124
125       object transmit channel blocksize done
126              This method initiates a transfer of the referenced data  to  the
127              specified channel.  When the transfer completes the command pre‐
128              fix done is invoked, per the rules for the  option  -command  of
129              command  transfer::copy::do  in the package transfer::copy.  The
130              blocksize specifies the size of the chunks to  transfer  in  one
131              go.  See  the option -blocksize of command transfer::copy::do in
132              the package transfer::copy.
133

KEYWORDS

135       channel, copy, data source, transfer
136
138       Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
139
140
141
142
143transfer                              0.1            transfer::data::source(n)
Impressum