1# -*- tcl -*-
2# # ## ### ##### ######## #############
3# (C) 2009 Andreas Kupries
4
5# @@ Meta Begin
6# Package tcl::transform::identity 1
7# Meta as::author {Andreas Kupries}
8# Meta as::copyright 2009
9# Meta as::license BSD
10# Meta as::notes   The prototypical observer transformation.
11# Meta as::notes   To observers what null is to reflected
12# Meta as::notes   base channels. For other observers see
13# Meta as::notes   adler32, crc32, counter, and observer
14# Meta as::notes   (stream copy).
15# Meta description Implementation of an identity
16# Meta description transformation, i.e one which does not
17# Meta description change the data in any way, shape, or
18# Meta description form. Based on Tcl 8.6's transformation
19# Meta description reflection support. Exports a single
20# Meta description command adding a new transform of this
21# Meta description type to a channel. One argument, the
22# Meta description channel to extend. No result.
23# Meta platform tcl
24# Meta require tcl::transform::core
25# Meta require {Tcl 8.6}
26# @@ Meta End
27
28# # ## ### ##### ######## #############
29
30package require Tcl 8.6
31package require tcl::transform::core
32
33# # ## ### ##### ######## #############
34
35namespace eval ::tcl::transform {}
36
37proc ::tcl::transform::identity {chan} {
38    ::chan push $chan [identity::implementation new]
39}
40
41oo::class create ::tcl::transform::identity::implementation {
42    superclass tcl::transform::core ;# -> initialize, finalize, destructor
43
44    method write {c data} {
45	return $data
46    }
47
48    method read {c data} {
49	return $data
50    }
51
52    # No partial data, nor state => no flush, drain, nor clear needed.
53
54    # # ## ### ##### ######## #############
55}
56
57# # ## ### ##### ######## #############
58package provide tcl::transform::identity 1
59return
60