Version 2 of DataflowCanvas

Updated 2009-02-19 09:01:59 by FF

FF - 2009-02-18 - This widget is a canvas specialized for dataflow [L1 ] software. It features high level operations, as adding, moving, editing, removing, connecting and track objects. Other relevant features include: OO-design (by using the new TclOO, completion, gui objects, (minimal) internal dataflow capability.

The class loading mechanism is defined in DataflowCanvas::enumClasses. By default it looks for subclasses of DataflowClass, so it is possible to add classes which specify how many inlet/outlets object instances will have, and manage their initialization parameters.

http://dev.gentoo.org/~mescalinum/tclwiki-img/DataflowCanvas01.png


Example: we are going to create a + class, which performs the f(x, y) = x + y function, so it has two inlets (inbound connections), and one outlet (outgoing conn.).

oo::class create + {
    superclass DataflowClass
    method setup {args} {
        my variable state
        set state {0 0}
        return {inlets 2 outlets 1}
    }
    method inlet {n args} {
        my variable state
        lset state $n $args
        if {$n == 0} {
            my outlet 0 [expr [join $state +]]
        }
    }
}

The resulting patch:

http://dev.gentoo.org/~mescalinum/tclwiki-img/DataflowCanvas02.png

entry and scale classes (found in source distribution) have been used to interact with the object


Drawing Diagrams may be related to this package


AMG: Interesting. I am working on a project that has a dataflow model. Perhaps I can find some inspiration in your work, and maybe I can even use it as a graphical front-end. Will you post a link to the sources soon?

FF: Ooops! I forgot. Sources are hosted at http://dataflowcanvas.sf.net (SVN). Btw I tried it on my PDA (400 MHz) and doesn't perform very well, perhaps because I reimplemented lot of canvas functionality by myself, because Tk canvas does not track current item while mouse is grabbed (although is possible in pure Tcl... canvas oddity). Needs some optimization. I'm happy if you use it, and more happy if you can improve it somewhat and share your changes.


enter categories here